[issm-svn] r20500 - issm/trunk

morlighe at issm.ess.uci.edu morlighe at issm.ess.uci.edu
Tue Apr 12 21:32:02 PDT 2016


Author: morlighe
Date: 2016-04-12 21:32:01 -0700 (Tue, 12 Apr 2016)
New Revision: 20500

Added:
   issm/trunk/configs/config-discover-intel11.sh
   issm/trunk/configs/config-discover-intel13.sh
   issm/trunk/configs/config-linux64-cyclone.sh
   issm/trunk/configs/config-linux64-hexagon.sh
   issm/trunk/configs/config-macosx64-dakota.sh
   issm/trunk/externalpackages/autotools/install-discover.sh
   issm/trunk/externalpackages/autotools/patches/automake.patch
   issm/trunk/externalpackages/boost/configs/1.55/adl.hpp.lonestar.patch
   issm/trunk/externalpackages/boost/configs/1.55/adl.hpp.patch
   issm/trunk/externalpackages/boost/install-1.49-macosx-snowleopard.sh
   issm/trunk/externalpackages/boost/install-1.55-discover.sh
   issm/trunk/externalpackages/boost/install-1.55-linux.sh
   issm/trunk/externalpackages/boost/install-1.55-lonestar.sh
   issm/trunk/externalpackages/boost/install-1.55-macosx-el_capitan.sh
   issm/trunk/externalpackages/boost/install-1.55-macosx-snowleopard.sh
   issm/trunk/externalpackages/boost/install-1.55-macosx-yosemite.sh
   issm/trunk/externalpackages/boost/install-1.55-pleiades_dakota6.2.sh
   issm/trunk/externalpackages/chaco/install-macosx64.sh
   issm/trunk/externalpackages/chaco/patches/
   issm/trunk/externalpackages/chaco/patches/Makefile.patch
   issm/trunk/externalpackages/cmake/install-macosx64-snowleopard.sh
   issm/trunk/externalpackages/cvs/
   issm/trunk/externalpackages/cvs/install.sh
   issm/trunk/externalpackages/cython/install-22.sh
   issm/trunk/externalpackages/dakota/configs/5.3.1/BuildDakotaCustom.cmake.pfe.patch
   issm/trunk/externalpackages/dakota/configs/5.3.1/CMakeLists.txt.lonestar.patch
   issm/trunk/externalpackages/dakota/configs/6.1/
   issm/trunk/externalpackages/dakota/configs/6.1/BuildDakotaCustom.cmake.mac.patch
   issm/trunk/externalpackages/dakota/configs/6.1/BuildDakotaCustom.cmake.patch
   issm/trunk/externalpackages/dakota/configs/6.1/CMakeLists.txt.patch
   issm/trunk/externalpackages/dakota/configs/6.1/CMakeLists.txt.pfe.patch
   issm/trunk/externalpackages/dakota/configs/6.1/DakotaDev.cmake.patch
   issm/trunk/externalpackages/dakota/configs/6.1/NonDLocalReliability.cpp.patch
   issm/trunk/externalpackages/dakota/configs/6.1/NonDSampling.cpp.patch
   issm/trunk/externalpackages/dakota/configs/6.1/ParallelLibrary.cpp.patch
   issm/trunk/externalpackages/dakota/configs/6.1/ParallelLibrary.hpp.patch
   issm/trunk/externalpackages/dakota/configs/6.1/pecos_global_defs.hpp.patch
   issm/trunk/externalpackages/dakota/configs/6.2/
   issm/trunk/externalpackages/dakota/configs/6.2/BuildDakotaCustom.cmake.discover.patch
   issm/trunk/externalpackages/dakota/configs/6.2/BuildDakotaCustom.cmake.mac.patch
   issm/trunk/externalpackages/dakota/configs/6.2/BuildDakotaCustom.cmake.patch
   issm/trunk/externalpackages/dakota/configs/6.2/BuildDakotaCustom.cmake.pfe.patch
   issm/trunk/externalpackages/dakota/configs/6.2/BuildDakotaCustom.cmake.yosemite.patch
   issm/trunk/externalpackages/dakota/configs/6.2/CMakeLists.txt.discover.patch
   issm/trunk/externalpackages/dakota/configs/6.2/CMakeLists.txt.lonestar.patch
   issm/trunk/externalpackages/dakota/configs/6.2/CMakeLists.txt.patch
   issm/trunk/externalpackages/dakota/configs/6.2/CMakeLists.txt.pfe.patch
   issm/trunk/externalpackages/dakota/configs/6.2/DakotaDev.cmake.patch
   issm/trunk/externalpackages/dakota/configs/6.2/NonDLocalReliability.cpp.patch
   issm/trunk/externalpackages/dakota/configs/6.2/NonDSampling.cpp.patch
   issm/trunk/externalpackages/dakota/configs/6.2/pecos_global_defs.hpp.patch
   issm/trunk/externalpackages/dakota/install-5.2-linux64-caladan.sh
   issm/trunk/externalpackages/dakota/install-5.3.1-linux64-caladan.sh
   issm/trunk/externalpackages/dakota/install-5.3.1-lonestar.sh
   issm/trunk/externalpackages/dakota/install-5.3.1-macosx64-yosemite.sh
   issm/trunk/externalpackages/dakota/install-6.2-intel15-discover.sh
   issm/trunk/externalpackages/dakota/install-6.2-linux64.sh
   issm/trunk/externalpackages/dakota/install-6.2-lonestar.sh
   issm/trunk/externalpackages/dakota/install-6.2-macosx64-snowleopard.sh
   issm/trunk/externalpackages/dakota/install-6.2-macosx64-yosemite.sh
   issm/trunk/externalpackages/dakota/install-6.2-macosx64.sh
   issm/trunk/externalpackages/dakota/install-6.2-pleiades.sh
   issm/trunk/externalpackages/dakota/tests/
   issm/trunk/externalpackages/dakota/tests/test.in
   issm/trunk/externalpackages/dakota/tests/test2.in
   issm/trunk/externalpackages/geocode/
   issm/trunk/externalpackages/geocode/geoCode.zip
   issm/trunk/externalpackages/geocode/install.sh
   issm/trunk/externalpackages/gmt/configs/ConfigUser.cmake-jenkins
   issm/trunk/externalpackages/gmt/install-jenkins.sh
   issm/trunk/externalpackages/javascript/
   issm/trunk/externalpackages/javascript/compressor/
   issm/trunk/externalpackages/javascript/compressor/yuicompressor-2.4.8.jar
   issm/trunk/externalpackages/javascript/src/
   issm/trunk/externalpackages/javascript/src/gauge.min.js
   issm/trunk/externalpackages/javascript/src/gl-matrix-min.js
   issm/trunk/externalpackages/javascript/src/hammer.min.js
   issm/trunk/externalpackages/javascript/src/jquery.min.js
   issm/trunk/externalpackages/javascript/src/jsonfn.js
   issm/trunk/externalpackages/javascript/src/sprintf.js
   issm/trunk/externalpackages/m1qn3/install-macosx64-snowleopard.sh
   issm/trunk/externalpackages/matplotlib/install-macosx64-snowleopard.sh
   issm/trunk/externalpackages/mpich/install-3.0-cyclone.sh
   issm/trunk/externalpackages/mpich/install-3.0-macosx64-gforker.sh
   issm/trunk/externalpackages/mpich/install-3.0-macosx64-snowleopard-dakota.sh
   issm/trunk/externalpackages/mpich/install-3.0-macosx64-yosemite-dakota.sh
   issm/trunk/externalpackages/petsc/install-3.5-win-par.sh
   issm/trunk/externalpackages/petsc/install-3.6-discover.sh
   issm/trunk/externalpackages/petsc/install-3.6-linux64.sh
   issm/trunk/externalpackages/petsc/install-3.6-lonestar.sh
   issm/trunk/externalpackages/petsc/install-3.6-macosx64-static.sh
   issm/trunk/externalpackages/petsc/install-3.6-macosx64.sh
   issm/trunk/externalpackages/petsc/install-3.6-pleiades.sh
   issm/trunk/externalpackages/petsc/install-3.6-win10.sh
   issm/trunk/externalpackages/petsc/install-dev-win10-par.sh
   issm/trunk/externalpackages/petsc/install-dev-win10.sh
   issm/trunk/externalpackages/triangle/configs/javascript/
   issm/trunk/externalpackages/triangle/configs/javascript/configure.make
   issm/trunk/externalpackages/triangle/configs/javascript/makefile
   issm/trunk/externalpackages/triangle/configs/libtool/
   issm/trunk/externalpackages/triangle/configs/libtool/Makefile.am
   issm/trunk/externalpackages/triangle/configs/libtool/configure.ac
   issm/trunk/externalpackages/triangle/configs/libtool/src/
   issm/trunk/externalpackages/triangle/configs/libtool/src/Makefile.am
   issm/trunk/externalpackages/triangle/configs/macosx64_snowleopard/
   issm/trunk/externalpackages/triangle/configs/macosx64_snowleopard/configure.make
   issm/trunk/externalpackages/triangle/install-javascript.sh
   issm/trunk/externalpackages/triangle/install-macosx64-snowleopard.sh
   issm/trunk/externalpackages/triangle/triangle.h.patch.js
   issm/trunk/externalpackages/windows/configs/sdk10.0-win64.sh
   issm/trunk/externalpackages/windows/configs/sdk7.1-win32.sh
   issm/trunk/externalpackages/windows/configs/sdk7.1-win64.sh
   issm/trunk/jenkins/linux64_caladan
   issm/trunk/jenkins/linux64_caladan_ad
   issm/trunk/jenkins/linux64_caladan_ampi
   issm/trunk/jenkins/linux64_ross
   issm/trunk/jenkins/linux64_ross_ad
   issm/trunk/jenkins/linux64_ross_ampi
   issm/trunk/jenkins/linux64_ross_gia
   issm/trunk/jenkins/linux64_ross_iceocean
   issm/trunk/jenkins/linux64_ross_se
   issm/trunk/jenkins/linux64_ross_test
   issm/trunk/jenkins/macosx_pine-island
   issm/trunk/jenkins/macosx_pine-island_dakota
   issm/trunk/jenkins/macosx_pine-island_static
   issm/trunk/jenkins/windows-par
   issm/trunk/jenkins/windows_test
   issm/trunk/src/c/analyses/HydrologySommersAnalysis.cpp
   issm/trunk/src/c/analyses/HydrologySommersAnalysis.h
   issm/trunk/src/c/analyses/SealevelriseAnalysis.cpp
   issm/trunk/src/c/analyses/SealevelriseAnalysis.h
   issm/trunk/src/c/analyses/SmbAnalysis.cpp
   issm/trunk/src/c/analyses/SmbAnalysis.h
   issm/trunk/src/c/classes/Dakota/
   issm/trunk/src/c/classes/Dakota/IssmDirectApplicInterface.h
   issm/trunk/src/c/classes/Dakota/IssmParallelDirectApplicInterface.cpp
   issm/trunk/src/c/classes/Dakota/IssmParallelDirectApplicInterface.h
   issm/trunk/src/c/classes/Inputs/DoubleArrayInput.cpp
   issm/trunk/src/c/classes/Inputs/DoubleArrayInput.h
   issm/trunk/src/c/classes/Loads/Moulin.cpp
   issm/trunk/src/c/classes/Loads/Moulin.h
   issm/trunk/src/c/classes/Loads/Neumannflux.cpp
   issm/trunk/src/c/classes/Loads/Neumannflux.h
   issm/trunk/src/c/classes/Nodalvalue.h
   issm/trunk/src/c/cores/movingfront_core.cpp
   issm/trunk/src/c/cores/sealevelrise_core.cpp
   issm/trunk/src/c/cores/sealevelrise_core_eustatic.cpp
   issm/trunk/src/c/cores/sealevelrise_core_noneustatic.cpp
   issm/trunk/src/c/cores/smb_core.cpp
   issm/trunk/src/c/main/esmfbinders.cpp
   issm/trunk/src/c/main/issm.js
   issm/trunk/src/c/main/issm_dakota.cpp
   issm/trunk/src/c/main/issm_slr.cpp
   issm/trunk/src/c/modules/Damagex/
   issm/trunk/src/c/modules/Damagex/Damagex.cpp
   issm/trunk/src/c/modules/Damagex/Damagex.h
   issm/trunk/src/c/modules/DistanceToMaskBoundaryx/
   issm/trunk/src/c/modules/DistanceToMaskBoundaryx/DistanceToMaskBoundaryx.cpp
   issm/trunk/src/c/modules/DistanceToMaskBoundaryx/DistanceToMaskBoundaryx.h
   issm/trunk/src/c/modules/DistanceToMaskBoundaryx/DistanceToMaskBoundaryxt.cpp
   issm/trunk/src/c/modules/GeothermalFluxx/
   issm/trunk/src/c/modules/GeothermalFluxx/GeothermalFluxx.cpp
   issm/trunk/src/c/modules/GeothermalFluxx/GeothermalFluxx.h
   issm/trunk/src/c/modules/SurfaceMassBalancex/Gembx.cpp
   issm/trunk/src/c/shared/Elements/ComputeD18OTemperaturePrecipitationFromPD.cpp
   issm/trunk/src/c/shared/Numerics/legendre.cpp
   issm/trunk/src/c/shared/io/Marshalling/
   issm/trunk/src/c/shared/io/Marshalling/Marshalling.h
   issm/trunk/src/m/array/arrayoperations.js
   issm/trunk/src/m/boundaryconditions/SetIceShelfBC.js
   issm/trunk/src/m/boundaryconditions/love_numbers.m
   issm/trunk/src/m/boundaryconditions/love_numbers.py
   issm/trunk/src/m/classes/SMBd18opdd.m
   issm/trunk/src/m/classes/SMBd18opdd.py
   issm/trunk/src/m/classes/SMBforcing.js
   issm/trunk/src/m/classes/SMBforcing.m
   issm/trunk/src/m/classes/SMBforcing.py
   issm/trunk/src/m/classes/SMBgemb.m
   issm/trunk/src/m/classes/adinversion.py
   issm/trunk/src/m/classes/autodiff.js
   issm/trunk/src/m/classes/balancethickness.js
   issm/trunk/src/m/classes/basalforcings.js
   issm/trunk/src/m/classes/calving.js
   issm/trunk/src/m/classes/clusters/generic.js
   issm/trunk/src/m/classes/clusters/local.js
   issm/trunk/src/m/classes/clusters/lonestar.m
   issm/trunk/src/m/classes/clusters/pfe.py
   issm/trunk/src/m/classes/clusters/vilje.m
   issm/trunk/src/m/classes/clusters/vilje.py
   issm/trunk/src/m/classes/constants.js
   issm/trunk/src/m/classes/damage.js
   issm/trunk/src/m/classes/debug.js
   issm/trunk/src/m/classes/flaim.js
   issm/trunk/src/m/classes/flowequation.js
   issm/trunk/src/m/classes/friction.js
   issm/trunk/src/m/classes/frictioncoulomb.m
   issm/trunk/src/m/classes/frictioncoulomb.py
   issm/trunk/src/m/classes/frictionsommers.m
   issm/trunk/src/m/classes/geometry.js
   issm/trunk/src/m/classes/gia.js
   issm/trunk/src/m/classes/groundingline.js
   issm/trunk/src/m/classes/hydrologyshreve.js
   issm/trunk/src/m/classes/hydrologysommers.m
   issm/trunk/src/m/classes/initialization.js
   issm/trunk/src/m/classes/inversion.js
   issm/trunk/src/m/classes/levelset.js
   issm/trunk/src/m/classes/levelset.m
   issm/trunk/src/m/classes/levelset.py
   issm/trunk/src/m/classes/mask.js
   issm/trunk/src/m/classes/maskpsl.js
   issm/trunk/src/m/classes/maskpsl.m
   issm/trunk/src/m/classes/maskpsl.py
   issm/trunk/src/m/classes/masstransport.js
   issm/trunk/src/m/classes/matice.js
   issm/trunk/src/m/classes/mesh2d.js
   issm/trunk/src/m/classes/mesh3dsurface.js
   issm/trunk/src/m/classes/mesh3dsurface.py
   issm/trunk/src/m/classes/miscellaneous.js
   issm/trunk/src/m/classes/mismipbasalforcings.m
   issm/trunk/src/m/classes/mismipbasalforcings.py
   issm/trunk/src/m/classes/model.js
   issm/trunk/src/m/classes/nodalvalue.m
   issm/trunk/src/m/classes/oldclasses/SMB.m
   issm/trunk/src/m/classes/outputdefinition.js
   issm/trunk/src/m/classes/pairoptions.js
   issm/trunk/src/m/classes/plotoptions.js
   issm/trunk/src/m/classes/plumebasalforcings.m
   issm/trunk/src/m/classes/priv.js
   issm/trunk/src/m/classes/qmu.js
   issm/trunk/src/m/classes/radaroverlay.js
   issm/trunk/src/m/classes/rifts.js
   issm/trunk/src/m/classes/sealevelmodel.m
   issm/trunk/src/m/classes/settings.js
   issm/trunk/src/m/classes/slr.js
   issm/trunk/src/m/classes/slr.m
   issm/trunk/src/m/classes/slr.py
   issm/trunk/src/m/classes/steadystate.js
   issm/trunk/src/m/classes/stressbalance.js
   issm/trunk/src/m/classes/taoinversion.py
   issm/trunk/src/m/classes/template.js
   issm/trunk/src/m/classes/thermal.js
   issm/trunk/src/m/classes/timestepping.js
   issm/trunk/src/m/classes/toolkits.js
   issm/trunk/src/m/classes/trans.js
   issm/trunk/src/m/classes/verbose.js
   issm/trunk/src/m/consistency/QueueRequirements.py
   issm/trunk/src/m/consistency/checkfield.js
   issm/trunk/src/m/consistency/ismodelselfconsistent.js
   issm/trunk/src/m/contrib/buzzi/
   issm/trunk/src/m/contrib/buzzi/gravity/
   issm/trunk/src/m/contrib/buzzi/gravity/Makefile
   issm/trunk/src/m/contrib/buzzi/gravity/code_densite/
   issm/trunk/src/m/contrib/buzzi/gravity/code_densite/Makefile
   issm/trunk/src/m/contrib/buzzi/gravity/code_densite/density_rock.cpp
   issm/trunk/src/m/contrib/buzzi/gravity/code_densite/density_rock_uneven.cpp
   issm/trunk/src/m/contrib/buzzi/gravity/code_inversion/
   issm/trunk/src/m/contrib/buzzi/gravity/code_inversion/vfsa_mpi.cpp
   issm/trunk/src/m/contrib/buzzi/gravity/code_inversion/vfsa_mpi_uneven.cpp
   issm/trunk/src/m/contrib/buzzi/gravity/vfsa.cpp
   issm/trunk/src/m/contrib/buzzi/gravity/vfsa_mpi.cpp
   issm/trunk/src/m/contrib/defleurian/
   issm/trunk/src/m/contrib/defleurian/netCDF/
   issm/trunk/src/m/contrib/defleurian/netCDF/ClassTry.py
   issm/trunk/src/m/contrib/defleurian/netCDF/export_netCDF.m
   issm/trunk/src/m/contrib/defleurian/netCDF/export_netCDF.py
   issm/trunk/src/m/contrib/defleurian/netCDF/read_netCDF.m
   issm/trunk/src/m/contrib/defleurian/netCDF/read_netCDF.py
   issm/trunk/src/m/contrib/defleurian/paraview/
   issm/trunk/src/m/contrib/defleurian/paraview/enveloppeVTK.m
   issm/trunk/src/m/contrib/defleurian/paraview/exportVTK.m
   issm/trunk/src/m/contrib/defleurian/paraview/exportVTK.py
   issm/trunk/src/m/contrib/larour/
   issm/trunk/src/m/contrib/larour/ecco/
   issm/trunk/src/m/contrib/larour/ecco/MeltingGroundingLines.m
   issm/trunk/src/m/contrib/larour/ecco/PropagateFlagsUntilDistance.m
   issm/trunk/src/m/contrib/larour/ecco/ecco32issm.m
   issm/trunk/src/m/contrib/larour/ecco/issm2ecco3.m
   issm/trunk/src/m/contrib/larour/morphological/
   issm/trunk/src/m/contrib/larour/morphological/aggregation.m
   issm/trunk/src/m/contrib/larour/morphological/closing.m
   issm/trunk/src/m/contrib/larour/morphological/dilation.m
   issm/trunk/src/m/contrib/larour/morphological/erosion.m
   issm/trunk/src/m/contrib/larour/morphological/nunataks.m
   issm/trunk/src/m/contrib/larour/morphological/opening.m
   issm/trunk/src/m/contrib/larour/morphological/vectorialize.m
   issm/trunk/src/m/contrib/larour/resultstomatrix.m
   issm/trunk/src/m/contrib/larour/tres.m
   issm/trunk/src/m/contrib/morlighem/
   issm/trunk/src/m/contrib/morlighem/bamg/
   issm/trunk/src/m/contrib/morlighem/bamg/BamgCall.m
   issm/trunk/src/m/contrib/morlighem/bamg/BamgCallFromMetric.m
   issm/trunk/src/m/contrib/morlighem/bamg/YamsCall.m
   issm/trunk/src/m/contrib/morlighem/bamg/YamsCall.py
   issm/trunk/src/m/contrib/morlighem/bamg/gmsh.m
   issm/trunk/src/m/contrib/morlighem/bamg/gmsh3d.m
   issm/trunk/src/m/contrib/morlighem/bamg/meshread.m
   issm/trunk/src/m/contrib/morlighem/bamg/yams.m
   issm/trunk/src/m/contrib/morlighem/dassflow/
   issm/trunk/src/m/contrib/morlighem/dassflow/exportgmsh.m
   issm/trunk/src/m/contrib/morlighem/dassflow/importgmsh.m
   issm/trunk/src/m/contrib/morlighem/gslib/
   issm/trunk/src/m/contrib/morlighem/gslib/gamv.m
   issm/trunk/src/m/contrib/morlighem/gslib/gslib.m
   issm/trunk/src/m/contrib/morlighem/gslib/pkriging.m
   issm/trunk/src/m/contrib/morlighem/gslib/varmap.m
   issm/trunk/src/m/contrib/morlighem/massbalance/
   issm/trunk/src/m/contrib/morlighem/massbalance/contourmassbalance.m
   issm/trunk/src/m/contrib/morlighem/massbalance/divergence.m
   issm/trunk/src/m/contrib/morlighem/massbalance/outflow.m
   issm/trunk/src/m/contrib/morlighem/massbalance/outflux.m
   issm/trunk/src/m/contrib/morlighem/sia.m
   issm/trunk/src/m/contrib/morlighem/thicknessevolution.m
   issm/trunk/src/m/contrib/seroussi/
   issm/trunk/src/m/contrib/seroussi/oasis/
   issm/trunk/src/m/contrib/seroussi/oasis/carter.m
   issm/trunk/src/m/coordsystems/gmtmask.m
   issm/trunk/src/m/coordsystems/gmtmask.py
   issm/trunk/src/m/coordsystems/gmtmaskparallel.m
   issm/trunk/src/m/enum/BasalforcingsBottomplumedepthEnum.m
   issm/trunk/src/m/enum/BasalforcingsCrustthicknessEnum.m
   issm/trunk/src/m/enum/BasalforcingsDtbgEnum.m
   issm/trunk/src/m/enum/BasalforcingsLowercrustheatEnum.m
   issm/trunk/src/m/enum/BasalforcingsMantleconductivityEnum.m
   issm/trunk/src/m/enum/BasalforcingsMeltrateFactorEnum.m
   issm/trunk/src/m/enum/BasalforcingsNusseltEnum.m
   issm/trunk/src/m/enum/BasalforcingsPlumeradiusEnum.m
   issm/trunk/src/m/enum/BasalforcingsPlumexEnum.m
   issm/trunk/src/m/enum/BasalforcingsPlumeyEnum.m
   issm/trunk/src/m/enum/BasalforcingsThresholdThicknessEnum.m
   issm/trunk/src/m/enum/BasalforcingsTopplumedepthEnum.m
   issm/trunk/src/m/enum/BasalforcingsUppercrustheatEnum.m
   issm/trunk/src/m/enum/BasalforcingsUppercrustthicknessEnum.m
   issm/trunk/src/m/enum/BasalforcingsUpperdepthMeltEnum.m
   issm/trunk/src/m/enum/CalvingdevCoeffEnum.m
   issm/trunk/src/m/enum/DamageKappaEnum.m
   issm/trunk/src/m/enum/DataSetEnum.m
   issm/trunk/src/m/enum/DeviatoricStresseffectiveEnum.m
   issm/trunk/src/m/enum/Domain3DsurfaceEnum.m
   issm/trunk/src/m/enum/DoubleArrayInputEnum.m
   issm/trunk/src/m/enum/EarthIdEnum.m
   issm/trunk/src/m/enum/ElementHookEnum.m
   issm/trunk/src/m/enum/EnumDefinitions.js
   issm/trunk/src/m/enum/FemModelCommEnum.m
   issm/trunk/src/m/enum/FemModelEnum.m
   issm/trunk/src/m/enum/FloatingAreaEnum.m
   issm/trunk/src/m/enum/FrictionCoefficientcoulombEnum.m
   issm/trunk/src/m/enum/FrictionCouplingEnum.m
   issm/trunk/src/m/enum/FrictionFEnum.m
   issm/trunk/src/m/enum/GroundedAreaEnum.m
   issm/trunk/src/m/enum/HookEnum.m
   issm/trunk/src/m/enum/HydrologyBumpHeightEnum.m
   issm/trunk/src/m/enum/HydrologyBumpSpacingEnum.m
   issm/trunk/src/m/enum/HydrologyConductivityEnum.m
   issm/trunk/src/m/enum/HydrologyEnglacialInputEnum.m
   issm/trunk/src/m/enum/HydrologyGapHeightEnum.m
   issm/trunk/src/m/enum/HydrologyHeadEnum.m
   issm/trunk/src/m/enum/HydrologyMoulinInputEnum.m
   issm/trunk/src/m/enum/HydrologyNeumannfluxEnum.m
   issm/trunk/src/m/enum/HydrologyReynoldsEnum.m
   issm/trunk/src/m/enum/HydrologySommersAnalysisEnum.m
   issm/trunk/src/m/enum/HydrologySpcheadEnum.m
   issm/trunk/src/m/enum/HydrologysommersEnum.m
   issm/trunk/src/m/enum/IcecapToEarthCommEnum.m
   issm/trunk/src/m/enum/LevelsetReinitFrequencyEnum.m
   issm/trunk/src/m/enum/MantlePlumeGeothermalFluxEnum.m
   issm/trunk/src/m/enum/MaskLandLevelsetEnum.m
   issm/trunk/src/m/enum/MaskOceanLevelsetEnum.m
   issm/trunk/src/m/enum/MaterialsEarthDensityEnum.m
   issm/trunk/src/m/enum/MeshLatEnum.m
   issm/trunk/src/m/enum/MeshLongEnum.m
   issm/trunk/src/m/enum/MeshREnum.m
   issm/trunk/src/m/enum/MeshSegmentsEnum.m
   issm/trunk/src/m/enum/MismipFloatingMeltRateEnum.m
   issm/trunk/src/m/enum/ModelIdEnum.m
   issm/trunk/src/m/enum/MoulinEnum.m
   issm/trunk/src/m/enum/NeumannfluxEnum.m
   issm/trunk/src/m/enum/NodalvalueDefinitionenumEnum.m
   issm/trunk/src/m/enum/NodalvalueEnum.m
   issm/trunk/src/m/enum/NodalvalueModelEnumEnum.m
   issm/trunk/src/m/enum/NodalvalueNameEnum.m
   issm/trunk/src/m/enum/NodalvalueNodeEnum.m
   issm/trunk/src/m/enum/NumModelsEnum.m
   issm/trunk/src/m/enum/OutputBufferPointerEnum.m
   issm/trunk/src/m/enum/OutputBufferSizePointerEnum.m
   issm/trunk/src/m/enum/P0ArrayEnum.m
   issm/trunk/src/m/enum/RestartFileNameEnum.m
   issm/trunk/src/m/enum/SMBd18opddEnum.m
   issm/trunk/src/m/enum/SMBforcingEnum.m
   issm/trunk/src/m/enum/SMBgcmEnum.m
   issm/trunk/src/m/enum/SMBgembEnum.m
   issm/trunk/src/m/enum/SealevelEnum.m
   issm/trunk/src/m/enum/SealevelEustaticEnum.m
   issm/trunk/src/m/enum/SealevelriseAbstolEnum.m
   issm/trunk/src/m/enum/SealevelriseAnalysisEnum.m
   issm/trunk/src/m/enum/SealevelriseDegaccEnum.m
   issm/trunk/src/m/enum/SealevelriseDeltathicknessEnum.m
   issm/trunk/src/m/enum/SealevelriseElasticEnum.m
   issm/trunk/src/m/enum/SealevelriseEustaticEnum.m
   issm/trunk/src/m/enum/SealevelriseGElasticEnum.m
   issm/trunk/src/m/enum/SealevelriseLoveHEnum.m
   issm/trunk/src/m/enum/SealevelriseLoveKEnum.m
   issm/trunk/src/m/enum/SealevelriseMaxiterEnum.m
   issm/trunk/src/m/enum/SealevelriseNumRequestedOutputsEnum.m
   issm/trunk/src/m/enum/SealevelriseReltolEnum.m
   issm/trunk/src/m/enum/SealevelriseRequestedOutputsEnum.m
   issm/trunk/src/m/enum/SealevelriseRigidEnum.m
   issm/trunk/src/m/enum/SealevelriseRotationEnum.m
   issm/trunk/src/m/enum/SealevelriseSolutionEnum.m
   issm/trunk/src/m/enum/SealevelriseTideLoveHEnum.m
   issm/trunk/src/m/enum/SealevelriseTideLoveKEnum.m
   issm/trunk/src/m/enum/SealevelriseTransitionsEnum.m
   issm/trunk/src/m/enum/SettingsRecordingFrequencyEnum.m
   issm/trunk/src/m/enum/SmbAEnum.m
   issm/trunk/src/m/enum/SmbAIceEnum.m
   issm/trunk/src/m/enum/SmbAIdxEnum.m
   issm/trunk/src/m/enum/SmbASnowEnum.m
   issm/trunk/src/m/enum/SmbAccumulationEnum.m
   issm/trunk/src/m/enum/SmbAnalysisEnum.m
   issm/trunk/src/m/enum/SmbBNegEnum.m
   issm/trunk/src/m/enum/SmbBPosEnum.m
   issm/trunk/src/m/enum/SmbCEnum.m
   issm/trunk/src/m/enum/SmbCldFracEnum.m
   issm/trunk/src/m/enum/SmbCondensationEnum.m
   issm/trunk/src/m/enum/SmbDEnum.m
   issm/trunk/src/m/enum/SmbDelta18oEnum.m
   issm/trunk/src/m/enum/SmbDelta18oSurfaceEnum.m
   issm/trunk/src/m/enum/SmbDenIdxEnum.m
   issm/trunk/src/m/enum/SmbDesfacEnum.m
   issm/trunk/src/m/enum/SmbDlwrfEnum.m
   issm/trunk/src/m/enum/SmbDpermilEnum.m
   issm/trunk/src/m/enum/SmbDswrfEnum.m
   issm/trunk/src/m/enum/SmbDtEnum.m
   issm/trunk/src/m/enum/SmbDzEnum.m
   issm/trunk/src/m/enum/SmbDzMinEnum.m
   issm/trunk/src/m/enum/SmbDzTopEnum.m
   issm/trunk/src/m/enum/SmbEAirEnum.m
   issm/trunk/src/m/enum/SmbECEnum.m
   issm/trunk/src/m/enum/SmbEnum.m
   issm/trunk/src/m/enum/SmbEvaporationEnum.m
   issm/trunk/src/m/enum/SmbGdnEnum.m
   issm/trunk/src/m/enum/SmbGspEnum.m
   issm/trunk/src/m/enum/SmbHrefEnum.m
   issm/trunk/src/m/enum/SmbInitDensityScalingEnum.m
   issm/trunk/src/m/enum/SmbIsInitializedEnum.m
   issm/trunk/src/m/enum/SmbIsaccumulationEnum.m
   issm/trunk/src/m/enum/SmbIsalbedoEnum.m
   issm/trunk/src/m/enum/SmbIsd18opdEnum.m
   issm/trunk/src/m/enum/SmbIsdelta18oEnum.m
   issm/trunk/src/m/enum/SmbIsdensificationEnum.m
   issm/trunk/src/m/enum/SmbIsgraingrowthEnum.m
   issm/trunk/src/m/enum/SmbIsmeltEnum.m
   issm/trunk/src/m/enum/SmbIsmungsmEnum.m
   issm/trunk/src/m/enum/SmbIspddEnum.m
   issm/trunk/src/m/enum/SmbIsshortwaveEnum.m
   issm/trunk/src/m/enum/SmbIssmbgradientsEnum.m
   issm/trunk/src/m/enum/SmbIsthermalEnum.m
   issm/trunk/src/m/enum/SmbIsturbulentfluxEnum.m
   issm/trunk/src/m/enum/SmbKEnum.m
   issm/trunk/src/m/enum/SmbMassBalanceEnum.m
   issm/trunk/src/m/enum/SmbMeltEnum.m
   issm/trunk/src/m/enum/SmbMonthlytemperaturesEnum.m
   issm/trunk/src/m/enum/SmbNumRequestedOutputsEnum.m
   issm/trunk/src/m/enum/SmbOutputFreqEnum.m
   issm/trunk/src/m/enum/SmbPAirEnum.m
   issm/trunk/src/m/enum/SmbPEnum.m
   issm/trunk/src/m/enum/SmbPfacEnum.m
   issm/trunk/src/m/enum/SmbPrecipitationEnum.m
   issm/trunk/src/m/enum/SmbPrecipitationsLgmEnum.m
   issm/trunk/src/m/enum/SmbPrecipitationsPresentdayEnum.m
   issm/trunk/src/m/enum/SmbReEnum.m
   issm/trunk/src/m/enum/SmbRefreezeEnum.m
   issm/trunk/src/m/enum/SmbRequestedOutputsEnum.m
   issm/trunk/src/m/enum/SmbRlapsEnum.m
   issm/trunk/src/m/enum/SmbRlapslgmEnum.m
   issm/trunk/src/m/enum/SmbRunoffEnum.m
   issm/trunk/src/m/enum/SmbS0pEnum.m
   issm/trunk/src/m/enum/SmbS0tEnum.m
   issm/trunk/src/m/enum/SmbSealevEnum.m
   issm/trunk/src/m/enum/SmbSmbrefEnum.m
   issm/trunk/src/m/enum/SmbSolutionEnum.m
   issm/trunk/src/m/enum/SmbSwIdxEnum.m
   issm/trunk/src/m/enum/SmbSwfEnum.m
   issm/trunk/src/m/enum/SmbT0dryEnum.m
   issm/trunk/src/m/enum/SmbT0wetEnum.m
   issm/trunk/src/m/enum/SmbTEnum.m
   issm/trunk/src/m/enum/SmbTaEnum.m
   issm/trunk/src/m/enum/SmbTdiffEnum.m
   issm/trunk/src/m/enum/SmbTemperaturesLgmEnum.m
   issm/trunk/src/m/enum/SmbTemperaturesPresentdayEnum.m
   issm/trunk/src/m/enum/SmbTmeanEnum.m
   issm/trunk/src/m/enum/SmbTzEnum.m
   issm/trunk/src/m/enum/SmbVEnum.m
   issm/trunk/src/m/enum/SmbVzEnum.m
   issm/trunk/src/m/enum/SmbWEnum.m
   issm/trunk/src/m/enum/SmbZMaxEnum.m
   issm/trunk/src/m/enum/SmbZMinEnum.m
   issm/trunk/src/m/enum/SmbZTopEnum.m
   issm/trunk/src/m/enum/SmbZYEnum.m
   issm/trunk/src/m/enum/SpclevelsetEnum.m
   issm/trunk/src/m/enum/TemperaturePDDEnum.m
   issm/trunk/src/m/enum/ThicknessPositiveEnum.m
   issm/trunk/src/m/enum/TotalFloatingBmbEnum.m
   issm/trunk/src/m/enum/TotalGroundedBmbEnum.m
   issm/trunk/src/m/enum/TransientIscouplerEnum.m
   issm/trunk/src/m/enum/TransientIsmovingfrontEnum.m
   issm/trunk/src/m/enum/TransientIsslrEnum.m
   issm/trunk/src/m/enum/TransientIssmbEnum.m
   issm/trunk/src/m/enum/WorldCommEnum.m
   issm/trunk/src/m/exp/exp2levelsetfunction.m
   issm/trunk/src/m/exp/expdisp.py
   issm/trunk/src/m/exp/meshtodomain.m
   issm/trunk/src/m/geometry/FlagElements.js
   issm/trunk/src/m/geometry/GetAreas3DTria.m
   issm/trunk/src/m/geometry/GetAreasSphericalTria.m
   issm/trunk/src/m/geometry/locationtonode.m
   issm/trunk/src/m/inversions/marshallcostfunctions.js
   issm/trunk/src/m/io/fileptr.js
   issm/trunk/src/m/io/loadmodel.js
   issm/trunk/src/m/io/saveAsFile.js
   issm/trunk/src/m/io/savemodel.js
   issm/trunk/src/m/js/
   issm/trunk/src/m/js/writejs1Darray.m
   issm/trunk/src/m/js/writejs2Darray.m
   issm/trunk/src/m/js/writejscellarray.m
   issm/trunk/src/m/js/writejscellstring.m
   issm/trunk/src/m/js/writejsdouble.m
   issm/trunk/src/m/js/writejsstring.m
   issm/trunk/src/m/js/writejsstruct.m
   issm/trunk/src/m/materials/paterson.js
   issm/trunk/src/m/mech/newforcing.m
   issm/trunk/src/m/mesh/augment2dmesh.m
   issm/trunk/src/m/mesh/mesh3dsurfaceplug2d.m
   issm/trunk/src/m/mesh/meshintersect.m
   issm/trunk/src/m/mesh/patchglobe.m
   issm/trunk/src/m/mesh/planet/gmsh/
   issm/trunk/src/m/mesh/planet/gmsh/gmshplanet.m
   issm/trunk/src/m/mesh/planet/gmsh/gmshplanet.py
   issm/trunk/src/m/mesh/planet/spheretri/
   issm/trunk/src/m/mesh/planet/spheretri/mesh_refine_tri4.m
   issm/trunk/src/m/mesh/planet/spheretri/planettrimesh.m
   issm/trunk/src/m/mesh/planet/spheretri/sphere_project.m
   issm/trunk/src/m/mesh/planet/spheretri/sphere_tri.m
   issm/trunk/src/m/mesh/triangle.js
   issm/trunk/src/m/miscellaneous/alignsegments.m
   issm/trunk/src/m/miscellaneous/colorbars.js
   issm/trunk/src/m/miscellaneous/converttopowerof2.m
   issm/trunk/src/m/miscellaneous/fielddisplay.js
   issm/trunk/src/m/miscellaneous/rgbcolor.js
   issm/trunk/src/m/miscellaneous/transientrestart.m
   issm/trunk/src/m/parameterization/setflowequation.js
   issm/trunk/src/m/parameterization/setmask.js
   issm/trunk/src/m/plot/applyoptions.js
   issm/trunk/src/m/plot/checkplotoptions.js
   issm/trunk/src/m/plot/colormaps/bluewhitered_smooth.m
   issm/trunk/src/m/plot/gauge.js
   issm/trunk/src/m/plot/plot_manager.js
   issm/trunk/src/m/plot/plot_mesh.js
   issm/trunk/src/m/plot/plot_overlay.js
   issm/trunk/src/m/plot/plot_quiver.js
   issm/trunk/src/m/plot/plot_streamlines.py
   issm/trunk/src/m/plot/plot_unit.js
   issm/trunk/src/m/plot/plotgemb.m
   issm/trunk/src/m/plot/plotmodel.js
   issm/trunk/src/m/plot/processdata.js
   issm/trunk/src/m/plot/processmesh.js
   issm/trunk/src/m/plot/slider.js
   issm/trunk/src/m/plot/tooltips.js
   issm/trunk/src/m/plot/webgl.js
   issm/trunk/src/m/print/sprintf.js
   issm/trunk/src/m/psl/
   issm/trunk/src/m/psl/p_polynomial_prime.m
   issm/trunk/src/m/psl/p_polynomial_value.m
   issm/trunk/src/m/psl/sharmonics.m
   issm/trunk/src/m/psl/shlm.m
   issm/trunk/src/m/psl/shlm_element.m
   issm/trunk/src/m/shp/shp2js.m
   issm/trunk/src/m/solve/WriteData.js
   issm/trunk/src/m/solve/loadresultsfrombuffer.js
   issm/trunk/src/m/solve/marshall.js
   issm/trunk/src/m/solve/parseresultsfrombuffer.js
   issm/trunk/src/m/solve/solve.js
   issm/trunk/src/m/solve/solveslm.m
   issm/trunk/src/m/solvers/issmgslsolver.js
   issm/trunk/src/py3/
   issm/trunk/src/py3/boundaryconditions/
   issm/trunk/src/py3/boundaryconditions/PattynSMB.py
   issm/trunk/src/py3/boundaryconditions/SetIceSheetBC.py
   issm/trunk/src/py3/boundaryconditions/SetIceShelfBC.py
   issm/trunk/src/py3/boundaryconditions/SetMarineIceSheetBC.py
   issm/trunk/src/py3/classes/
   issm/trunk/src/py3/classes/SMBcomponents.py
   issm/trunk/src/py3/classes/SMBd18opdd.py
   issm/trunk/src/py3/classes/SMBforcing.py
   issm/trunk/src/py3/classes/SMBgradients.py
   issm/trunk/src/py3/classes/SMBmeltcomponents.py
   issm/trunk/src/py3/classes/SMBpdd.py
   issm/trunk/src/py3/classes/adinversion.py
   issm/trunk/src/py3/classes/autodiff.py
   issm/trunk/src/py3/classes/balancethickness.py
   issm/trunk/src/py3/classes/bamggeom.py
   issm/trunk/src/py3/classes/bamgmesh.py
   issm/trunk/src/py3/classes/basalforcings.py
   issm/trunk/src/py3/classes/calving.py
   issm/trunk/src/py3/classes/calvinglevermann.py
   issm/trunk/src/py3/classes/clusters/
   issm/trunk/src/py3/classes/clusters/generic.py
   issm/trunk/src/py3/classes/clusters/pfe.py
   issm/trunk/src/py3/classes/constants.py
   issm/trunk/src/py3/classes/damage.py
   issm/trunk/src/py3/classes/debug.py
   issm/trunk/src/py3/classes/dependent.py
   issm/trunk/src/py3/classes/flaim.py
   issm/trunk/src/py3/classes/flowequation.py
   issm/trunk/src/py3/classes/friction.py
   issm/trunk/src/py3/classes/frictioncoulomb.py
   issm/trunk/src/py3/classes/frictionweertman.py
   issm/trunk/src/py3/classes/geometry.py
   issm/trunk/src/py3/classes/gia.py
   issm/trunk/src/py3/classes/groundingline.py
   issm/trunk/src/py3/classes/hydrologydc.py
   issm/trunk/src/py3/classes/hydrologyshreve.py
   issm/trunk/src/py3/classes/independent.py
   issm/trunk/src/py3/classes/initialization.py
   issm/trunk/src/py3/classes/inversion.py
   issm/trunk/src/py3/classes/linearbasalforcings.py
   issm/trunk/src/py3/classes/m1qn3inversion.py
   issm/trunk/src/py3/classes/mask.py
   issm/trunk/src/py3/classes/massfluxatgate.py
   issm/trunk/src/py3/classes/masstransport.py
   issm/trunk/src/py3/classes/matdamageice.py
   issm/trunk/src/py3/classes/matice.py
   issm/trunk/src/py3/classes/mesh2d.py
   issm/trunk/src/py3/classes/mesh3dprisms.py
   issm/trunk/src/py3/classes/miscellaneous.py
   issm/trunk/src/py3/classes/mismipbasalforcings.py
   issm/trunk/src/py3/classes/model.py
   issm/trunk/src/py3/classes/organizer.py
   issm/trunk/src/py3/classes/outputdefinition.py
   issm/trunk/src/py3/classes/pairoptions.py
   issm/trunk/src/py3/classes/plotoptions.py
   issm/trunk/src/py3/classes/private.py
   issm/trunk/src/py3/classes/qmu.py
   issm/trunk/src/py3/classes/radaroverlay.py
   issm/trunk/src/py3/classes/results.py
   issm/trunk/src/py3/classes/rifts.py
   issm/trunk/src/py3/classes/settings.py
   issm/trunk/src/py3/classes/steadystate.py
   issm/trunk/src/py3/classes/stressbalance.py
   issm/trunk/src/py3/classes/taoinversion.py
   issm/trunk/src/py3/classes/thermal.py
   issm/trunk/src/py3/classes/timestepping.py
   issm/trunk/src/py3/classes/toolkits.py
   issm/trunk/src/py3/classes/transient.py
   issm/trunk/src/py3/classes/verbose.py
   issm/trunk/src/py3/consistency/
   issm/trunk/src/py3/consistency/QueueRequirements.py
   issm/trunk/src/py3/consistency/checkfield.py
   issm/trunk/src/py3/consistency/ismodelselfconsistent.py
   issm/trunk/src/py3/contrib/
   issm/trunk/src/py3/contrib/bamg/
   issm/trunk/src/py3/contrib/bamg/YamsCall.py
   issm/trunk/src/py3/contrib/bamg/YamsCall.py.bak
   issm/trunk/src/py3/contrib/netCDF/
   issm/trunk/src/py3/contrib/netCDF/ClassTry.py
   issm/trunk/src/py3/contrib/netCDF/ClassTry.py.bak
   issm/trunk/src/py3/contrib/netCDF/export_netCDF.py
   issm/trunk/src/py3/contrib/netCDF/export_netCDF.py.bak
   issm/trunk/src/py3/contrib/netCDF/read_netCDF.py
   issm/trunk/src/py3/contrib/netCDF/read_netCDF.py.bak
   issm/trunk/src/py3/contrib/paraview/
   issm/trunk/src/py3/contrib/paraview/exportVTK.py
   issm/trunk/src/py3/contrib/paraview/exportVTK.py.bak
   issm/trunk/src/py3/coordsystems/
   issm/trunk/src/py3/coordsystems/ll2xy.py
   issm/trunk/src/py3/coordsystems/xy2ll.py
   issm/trunk/src/py3/dev/
   issm/trunk/src/py3/dev/devpath.py
   issm/trunk/src/py3/dev/issmversion.py
   issm/trunk/src/py3/enum/
   issm/trunk/src/py3/enum/EnumDefinitions.py
   issm/trunk/src/py3/exp/
   issm/trunk/src/py3/exp/expcoarsen.py
   issm/trunk/src/py3/exp/expdisp.py
   issm/trunk/src/py3/exp/expread.py
   issm/trunk/src/py3/exp/expwrite.py
   issm/trunk/src/py3/extrusion/
   issm/trunk/src/py3/extrusion/DepthAverage.py
   issm/trunk/src/py3/extrusion/project2d.py
   issm/trunk/src/py3/extrusion/project3d.py
   issm/trunk/src/py3/geometry/
   issm/trunk/src/py3/geometry/FlagElements.py
   issm/trunk/src/py3/geometry/GetAreas.py
   issm/trunk/src/py3/geometry/SegIntersect.py
   issm/trunk/src/py3/geometry/slope.py
   issm/trunk/src/py3/interp/
   issm/trunk/src/py3/interp/SectionValues.py
   issm/trunk/src/py3/interp/averaging.py
   issm/trunk/src/py3/interp/holefiller.py
   issm/trunk/src/py3/interp/interp.py
   issm/trunk/src/py3/inversions/
   issm/trunk/src/py3/inversions/marshallcostfunctions.py
   issm/trunk/src/py3/inversions/parametercontroldrag.py
   issm/trunk/src/py3/inversions/supportedcontrols.py
   issm/trunk/src/py3/inversions/supportedcostfunctions.py
   issm/trunk/src/py3/io/
   issm/trunk/src/py3/io/loadmodel.py
   issm/trunk/src/py3/io/loadvars.py
   issm/trunk/src/py3/io/savevars.py
   issm/trunk/src/py3/materials/
   issm/trunk/src/py3/materials/DepthAvgTempCond.py
   issm/trunk/src/py3/materials/TMeltingPoint.py
   issm/trunk/src/py3/materials/cuffey.py
   issm/trunk/src/py3/materials/paterson.py
   issm/trunk/src/py3/mech/
   issm/trunk/src/py3/mech/analyticaldamage.py
   issm/trunk/src/py3/mech/backstressfrominversion.py
   issm/trunk/src/py3/mech/calcbackstress.py
   issm/trunk/src/py3/mech/damagefrominversion.py
   issm/trunk/src/py3/mech/mechanicalproperties.py
   issm/trunk/src/py3/mech/robintemperature.py
   issm/trunk/src/py3/mech/steadystateiceshelftemp.py
   issm/trunk/src/py3/mech/thomasparams.py
   issm/trunk/src/py3/mesh/
   issm/trunk/src/py3/mesh/ComputeHessian.py
   issm/trunk/src/py3/mesh/ComputeMetric.py
   issm/trunk/src/py3/mesh/ElementsFromEdge.py
   issm/trunk/src/py3/mesh/GetNodalFunctionsCoeff.py
   issm/trunk/src/py3/mesh/bamg.py
   issm/trunk/src/py3/mesh/meshconvert.py
   issm/trunk/src/py3/mesh/rifts/
   issm/trunk/src/py3/mesh/rifts/meshprocessoutsiderifts.py
   issm/trunk/src/py3/mesh/rifts/meshprocessrifts.py
   issm/trunk/src/py3/mesh/roundmesh.py
   issm/trunk/src/py3/mesh/squaremesh.py
   issm/trunk/src/py3/mesh/triangle.py
   issm/trunk/src/py3/miscellaneous/
   issm/trunk/src/py3/miscellaneous/MatlabFuncs.py
   issm/trunk/src/py3/miscellaneous/PythonFuncs.py
   issm/trunk/src/py3/miscellaneous/fielddisplay.py
   issm/trunk/src/py3/miscellaneous/isnans.py
   issm/trunk/src/py3/miscellaneous/parallelrange.py
   issm/trunk/src/py3/modifier.sh
   issm/trunk/src/py3/os/
   issm/trunk/src/py3/os/issmdir.py
   issm/trunk/src/py3/os/issmscpin.py
   issm/trunk/src/py3/os/issmscpout.py
   issm/trunk/src/py3/os/issmssh.py
   issm/trunk/src/py3/parameterization/
   issm/trunk/src/py3/parameterization/contourenvelope.py
   issm/trunk/src/py3/parameterization/parameterize.py
   issm/trunk/src/py3/parameterization/setflowequation.py
   issm/trunk/src/py3/parameterization/sethydrostaticmask.py
   issm/trunk/src/py3/parameterization/setmask.py
   issm/trunk/src/py3/plot/
   issm/trunk/src/py3/plot/applyoptions.py
   issm/trunk/src/py3/plot/checkplotoptions.py
   issm/trunk/src/py3/plot/colormaps/
   issm/trunk/src/py3/plot/colormaps/cmaptools.py
   issm/trunk/src/py3/plot/export_gl.py
   issm/trunk/src/py3/plot/plot_contour.py
   issm/trunk/src/py3/plot/plot_manager.py
   issm/trunk/src/py3/plot/plot_mesh.py
   issm/trunk/src/py3/plot/plot_overlay.py
   issm/trunk/src/py3/plot/plot_streamlines.py
   issm/trunk/src/py3/plot/plot_unit.py
   issm/trunk/src/py3/plot/plotmodel.py
   issm/trunk/src/py3/plot/processdata.py
   issm/trunk/src/py3/plot/processmesh.py
   issm/trunk/src/py3/plot/writejsfield.py
   issm/trunk/src/py3/plot/writejsfile.py
   issm/trunk/src/py3/shp/
   issm/trunk/src/py3/shp/shp2exp.py
   issm/trunk/src/py3/solve/
   issm/trunk/src/py3/solve/WriteData.py
   issm/trunk/src/py3/solve/loadresultsfromcluster.py
   issm/trunk/src/py3/solve/loadresultsfromdisk.py
   issm/trunk/src/py3/solve/marshall.py
   issm/trunk/src/py3/solve/parseresultsfromdisk.py
   issm/trunk/src/py3/solve/solve.py
   issm/trunk/src/py3/solve/waitonlock.py
   issm/trunk/src/py3/solvers/
   issm/trunk/src/py3/solvers/asmoptions.py
   issm/trunk/src/py3/solvers/iluasmoptions.py
   issm/trunk/src/py3/solvers/issmgslsolver.py
   issm/trunk/src/py3/solvers/issmmumpssolver.py
   issm/trunk/src/py3/solvers/jacobiasmoptions.py
   issm/trunk/src/py3/solvers/jacobicgoptions.py
   issm/trunk/src/py3/solvers/matlaboptions.py
   issm/trunk/src/py3/solvers/mumpsoptions.py
   issm/trunk/src/py3/solvers/soroptions.py
   issm/trunk/src/py3/solvers/stokesoptions.py
   issm/trunk/src/py3/test.txt
   issm/trunk/src/py3/tmp
   issm/trunk/src/wrappers/ContourToMesh/ContourToMesh.js
   issm/trunk/src/wrappers/DistanceToMaskBoundary/
   issm/trunk/src/wrappers/DistanceToMaskBoundary/DistanceToMaskBoundary.cpp
   issm/trunk/src/wrappers/DistanceToMaskBoundary/DistanceToMaskBoundary.h
   issm/trunk/src/wrappers/ElementConnectivity/ElementConnectivity.js
   issm/trunk/src/wrappers/EnumToString/EnumToString.js
   issm/trunk/src/wrappers/InterpFromMeshToMesh2d/InterpFromMeshToMesh2d.js
   issm/trunk/src/wrappers/Issm/
   issm/trunk/src/wrappers/Issm/issm.cpp
   issm/trunk/src/wrappers/Issm/issm.js
   issm/trunk/src/wrappers/IssmConfig/IssmConfig.js
   issm/trunk/src/wrappers/NodeConnectivity/NodeConnectivity.js
   issm/trunk/src/wrappers/StringToEnum/StringToEnum.js
   issm/trunk/src/wrappers/TriMesh/TriMesh.js
   issm/trunk/src/wrappers/javascript/
   issm/trunk/src/wrappers/javascript/Makefile.am
   issm/trunk/src/wrappers/javascript/include/
   issm/trunk/src/wrappers/javascript/include/javascriptincludes.h
   issm/trunk/src/wrappers/javascript/include/wrapper_macros.h
   issm/trunk/src/wrappers/javascript/io/
   issm/trunk/src/wrappers/javascript/io/ApiPrintf.cpp
   issm/trunk/src/wrappers/javascript/io/FetchJavascriptData.cpp
   issm/trunk/src/wrappers/javascript/io/WriteJavascriptData.cpp
   issm/trunk/src/wrappers/javascript/io/javascriptio.h
   issm/trunk/test/Archives/Archive125.nc
   issm/trunk/test/Archives/Archive126.nc
   issm/trunk/test/Archives/Archive2002.nc
   issm/trunk/test/Archives/Archive240.nc
   issm/trunk/test/Archives/Archive241.nc
   issm/trunk/test/Archives/Archive242.nc
   issm/trunk/test/Archives/Archive2424.nc
   issm/trunk/test/Archives/Archive2425.nc
   issm/trunk/test/Archives/Archive243.nc
   issm/trunk/test/Archives/Archive273.nc
   issm/trunk/test/Archives/Archive293.nc
   issm/trunk/test/Archives/Archive342.nc
   issm/trunk/test/Archives/Archive350.nc
   issm/trunk/test/Data/SquareShelfConstrained.data.js
   issm/trunk/test/Data/gemb_input.mat
   issm/trunk/test/Data/love_numbers_10k.txt
   issm/trunk/test/Exp/Square.js
   issm/trunk/test/NightlyRun/test101.html
   issm/trunk/test/NightlyRun/test125.m
   issm/trunk/test/NightlyRun/test125.py
   issm/trunk/test/NightlyRun/test126.m
   issm/trunk/test/NightlyRun/test126.py
   issm/trunk/test/NightlyRun/test2002.m
   issm/trunk/test/NightlyRun/test2002.py
   issm/trunk/test/NightlyRun/test238.py
   issm/trunk/test/NightlyRun/test239.py
   issm/trunk/test/NightlyRun/test240.m
   issm/trunk/test/NightlyRun/test240.py
   issm/trunk/test/NightlyRun/test241.m
   issm/trunk/test/NightlyRun/test241.py
   issm/trunk/test/NightlyRun/test242.m
   issm/trunk/test/NightlyRun/test242.py
   issm/trunk/test/NightlyRun/test2424.m
   issm/trunk/test/NightlyRun/test2425.m
   issm/trunk/test/NightlyRun/test243.m
   issm/trunk/test/NightlyRun/test273.m
   issm/trunk/test/NightlyRun/test273.py
   issm/trunk/test/NightlyRun/test293.m
   issm/trunk/test/NightlyRun/test341.py
   issm/trunk/test/NightlyRun/test342.m
   issm/trunk/test/NightlyRun/test350.m
   issm/trunk/test/Par/SquareShelfConstrained.js
Removed:
   issm/trunk/configs/config-discover.sh
   issm/trunk/configs/config-greenplanet.sh
   issm/trunk/configs/config-hoffman2.sh
   issm/trunk/configs/config-linux64-ad.sh
   issm/trunk/configs/config-linux64-cmake.sh
   issm/trunk/configs/config-linux64-larsen-ad.sh
   issm/trunk/configs/config-linux64-larsen-gia.sh
   issm/trunk/configs/config-linux64-larsen.sh
   issm/trunk/configs/config-linux64-murdo-nopetsc.sh
   issm/trunk/configs/config-linux64-murdo.sh
   issm/trunk/configs/config-linux64-ubuntu64.sh
   issm/trunk/configs/config-macosx64-static.sh
   issm/trunk/configs/config-win7-32.sh
   issm/trunk/configs/config-win7-64-parallel.sh
   issm/trunk/configs/config-win7-64.sh
   issm/trunk/externalpackages/boost/install-macosx-snowleopard.sh
   issm/trunk/externalpackages/chaco/patches/Makefile.patch
   issm/trunk/externalpackages/cvs/install.sh
   issm/trunk/externalpackages/dakota/configs/6.1/BuildDakotaCustom.cmake.mac.patch
   issm/trunk/externalpackages/dakota/configs/6.1/BuildDakotaCustom.cmake.patch
   issm/trunk/externalpackages/dakota/configs/6.1/CMakeLists.txt.patch
   issm/trunk/externalpackages/dakota/configs/6.1/CMakeLists.txt.pfe.patch
   issm/trunk/externalpackages/dakota/configs/6.1/DakotaDev.cmake.patch
   issm/trunk/externalpackages/dakota/configs/6.1/NonDLocalReliability.cpp.patch
   issm/trunk/externalpackages/dakota/configs/6.1/NonDSampling.cpp.patch
   issm/trunk/externalpackages/dakota/configs/6.1/ParallelLibrary.cpp.patch
   issm/trunk/externalpackages/dakota/configs/6.1/ParallelLibrary.hpp.patch
   issm/trunk/externalpackages/dakota/configs/6.1/pecos_global_defs.hpp.patch
   issm/trunk/externalpackages/dakota/configs/6.2/BuildDakotaCustom.cmake.discover.patch
   issm/trunk/externalpackages/dakota/configs/6.2/BuildDakotaCustom.cmake.mac.patch
   issm/trunk/externalpackages/dakota/configs/6.2/BuildDakotaCustom.cmake.patch
   issm/trunk/externalpackages/dakota/configs/6.2/BuildDakotaCustom.cmake.pfe.patch
   issm/trunk/externalpackages/dakota/configs/6.2/BuildDakotaCustom.cmake.yosemite.patch
   issm/trunk/externalpackages/dakota/configs/6.2/CMakeLists.txt.discover.patch
   issm/trunk/externalpackages/dakota/configs/6.2/CMakeLists.txt.lonestar.patch
   issm/trunk/externalpackages/dakota/configs/6.2/CMakeLists.txt.patch
   issm/trunk/externalpackages/dakota/configs/6.2/CMakeLists.txt.pfe.patch
   issm/trunk/externalpackages/dakota/configs/6.2/DakotaDev.cmake.patch
   issm/trunk/externalpackages/dakota/configs/6.2/NonDLocalReliability.cpp.patch
   issm/trunk/externalpackages/dakota/configs/6.2/NonDSampling.cpp.patch
   issm/trunk/externalpackages/dakota/configs/6.2/pecos_global_defs.hpp.patch
   issm/trunk/externalpackages/dakota/tests/test.in
   issm/trunk/externalpackages/dakota/tests/test2.in
   issm/trunk/externalpackages/geocode/geoCode.zip
   issm/trunk/externalpackages/geocode/install.sh
   issm/trunk/externalpackages/javascript/compressor/
   issm/trunk/externalpackages/javascript/compressor/yuicompressor-2.4.8.jar
   issm/trunk/externalpackages/javascript/src/
   issm/trunk/externalpackages/javascript/src/gauge.min.js
   issm/trunk/externalpackages/javascript/src/gl-matrix-min.js
   issm/trunk/externalpackages/javascript/src/hammer.min.js
   issm/trunk/externalpackages/javascript/src/jquery.min.js
   issm/trunk/externalpackages/javascript/src/jsonfn.js
   issm/trunk/externalpackages/javascript/src/sprintf.js
   issm/trunk/externalpackages/petsc/README
   issm/trunk/externalpackages/petsc/install-3.1-altix64-castor.sh
   issm/trunk/externalpackages/petsc/install-3.1-cosmos.sh
   issm/trunk/externalpackages/petsc/install-3.1-linux64-berg.sh
   issm/trunk/externalpackages/petsc/install-3.1-macosx32-mathieu.sh
   issm/trunk/externalpackages/petsc/install-3.1-macosx32-ogive.sh
   issm/trunk/externalpackages/petsc/install-3.1-pleiades.sh
   issm/trunk/externalpackages/petsc/install-3.1-ubuntu64.sh
   issm/trunk/externalpackages/petsc/install-3.1-win7-parallel.sh
   issm/trunk/externalpackages/petsc/install-3.1-win7.sh
   issm/trunk/externalpackages/petsc/install-3.2-discover-intel13.sh
   issm/trunk/externalpackages/petsc/install-3.2-discover.sh
   issm/trunk/externalpackages/petsc/install-3.2-greenplanet.sh
   issm/trunk/externalpackages/petsc/install-3.2-hoffman2.sh
   issm/trunk/externalpackages/petsc/install-3.2-linux64.sh
   issm/trunk/externalpackages/petsc/install-3.2-macosx64.sh
   issm/trunk/externalpackages/petsc/install-3.2-pleiades.sh
   issm/trunk/externalpackages/petsc/install-3.2-ubuntu64.sh
   issm/trunk/externalpackages/petsc/install-3.3-linux64.sh
   issm/trunk/externalpackages/petsc/install-3.3-macosx64.sh
   issm/trunk/externalpackages/petsc/install-3.3-pleiades.sh
   issm/trunk/externalpackages/petsc/install-3.3-walgreen.sh
   issm/trunk/externalpackages/triangle/configs/javascript/configure.make
   issm/trunk/externalpackages/triangle/configs/javascript/makefile
   issm/trunk/externalpackages/triangle/configs/libtool/Makefile.am
   issm/trunk/externalpackages/triangle/configs/libtool/configure.ac
   issm/trunk/externalpackages/triangle/configs/libtool/src/
   issm/trunk/externalpackages/triangle/configs/libtool/src/Makefile.am
   issm/trunk/externalpackages/triangle/configs/macosx64_snowleopard/configure.make
   issm/trunk/externalpackages/triangle/configs/triangle-libtool.tar.gz
   issm/trunk/jenkins/execute_shell
   issm/trunk/jenkins/execute_shell_ad
   issm/trunk/jenkins/imac-012301-gil
   issm/trunk/jenkins/linux64_murdo
   issm/trunk/jenkins/linux64_murdo_ad
   issm/trunk/jenkins/linux64_murdo_ampi
   issm/trunk/jenkins/linux64_murdo_gia
   issm/trunk/jenkins/linux64_murdo_iceocean
   issm/trunk/src/c/classes/Dakota/IssmDirectApplicInterface.h
   issm/trunk/src/c/classes/Dakota/IssmParallelDirectApplicInterface.cpp
   issm/trunk/src/c/classes/Dakota/IssmParallelDirectApplicInterface.h
   issm/trunk/src/c/cores/DakotaSpawnCore.cpp
   issm/trunk/src/c/cores/DakotaSpawnCore.h
   issm/trunk/src/c/modules/Damagex/Damagex.cpp
   issm/trunk/src/c/modules/Damagex/Damagex.h
   issm/trunk/src/c/modules/DistanceToMaskBoundaryx/DistanceToMaskBoundaryx.cpp
   issm/trunk/src/c/modules/DistanceToMaskBoundaryx/DistanceToMaskBoundaryx.h
   issm/trunk/src/c/modules/DistanceToMaskBoundaryx/DistanceToMaskBoundaryxt.cpp
   issm/trunk/src/c/modules/GeothermalFluxx/GeothermalFluxx.cpp
   issm/trunk/src/c/modules/GeothermalFluxx/GeothermalFluxx.h
   issm/trunk/src/c/shared/io/Marshalling/Marshalling.h
   issm/trunk/src/m/classes/SMB.m
   issm/trunk/src/m/classes/SMB.py
   issm/trunk/src/m/classes/calvingpi.m
   issm/trunk/src/m/contrib/bamg/
   issm/trunk/src/m/contrib/buzzi/gravity/
   issm/trunk/src/m/contrib/buzzi/gravity/Makefile
   issm/trunk/src/m/contrib/buzzi/gravity/code_densite/
   issm/trunk/src/m/contrib/buzzi/gravity/code_densite/Makefile
   issm/trunk/src/m/contrib/buzzi/gravity/code_densite/density_rock.cpp
   issm/trunk/src/m/contrib/buzzi/gravity/code_densite/density_rock_uneven.cpp
   issm/trunk/src/m/contrib/buzzi/gravity/code_inversion/
   issm/trunk/src/m/contrib/buzzi/gravity/code_inversion/vfsa_mpi.cpp
   issm/trunk/src/m/contrib/buzzi/gravity/code_inversion/vfsa_mpi_uneven.cpp
   issm/trunk/src/m/contrib/buzzi/gravity/vfsa.cpp
   issm/trunk/src/m/contrib/buzzi/gravity/vfsa_mpi.cpp
   issm/trunk/src/m/contrib/dassflow/
   issm/trunk/src/m/contrib/defleurian/netCDF/
   issm/trunk/src/m/contrib/defleurian/netCDF/ClassTry.py
   issm/trunk/src/m/contrib/defleurian/netCDF/export_netCDF.m
   issm/trunk/src/m/contrib/defleurian/netCDF/export_netCDF.py
   issm/trunk/src/m/contrib/defleurian/netCDF/read_netCDF.m
   issm/trunk/src/m/contrib/defleurian/netCDF/read_netCDF.py
   issm/trunk/src/m/contrib/defleurian/paraview/
   issm/trunk/src/m/contrib/defleurian/paraview/enveloppeVTK.m
   issm/trunk/src/m/contrib/defleurian/paraview/exportVTK.m
   issm/trunk/src/m/contrib/defleurian/paraview/exportVTK.py
   issm/trunk/src/m/contrib/ecco/
   issm/trunk/src/m/contrib/gravity/
   issm/trunk/src/m/contrib/gslib/
   issm/trunk/src/m/contrib/hack/
   issm/trunk/src/m/contrib/hydrology/
   issm/trunk/src/m/contrib/larour/ecco/
   issm/trunk/src/m/contrib/larour/ecco/MeltingGroundingLines.m
   issm/trunk/src/m/contrib/larour/ecco/PropagateFlagsUntilDistance.m
   issm/trunk/src/m/contrib/larour/ecco/ecco32issm.m
   issm/trunk/src/m/contrib/larour/ecco/issm2ecco3.m
   issm/trunk/src/m/contrib/larour/morphological/
   issm/trunk/src/m/contrib/larour/morphological/aggregation.m
   issm/trunk/src/m/contrib/larour/morphological/closing.m
   issm/trunk/src/m/contrib/larour/morphological/dilation.m
   issm/trunk/src/m/contrib/larour/morphological/erosion.m
   issm/trunk/src/m/contrib/larour/morphological/nunataks.m
   issm/trunk/src/m/contrib/larour/morphological/opening.m
   issm/trunk/src/m/contrib/larour/morphological/vectorialize.m
   issm/trunk/src/m/contrib/larour/resultstomatrix.m
   issm/trunk/src/m/contrib/larour/tres.m
   issm/trunk/src/m/contrib/massbalance/
   issm/trunk/src/m/contrib/morlighem/bamg/
   issm/trunk/src/m/contrib/morlighem/bamg/BamgCall.m
   issm/trunk/src/m/contrib/morlighem/bamg/BamgCallFromMetric.m
   issm/trunk/src/m/contrib/morlighem/bamg/YamsCall.m
   issm/trunk/src/m/contrib/morlighem/bamg/YamsCall.py
   issm/trunk/src/m/contrib/morlighem/bamg/gmsh.m
   issm/trunk/src/m/contrib/morlighem/bamg/gmsh3d.m
   issm/trunk/src/m/contrib/morlighem/bamg/meshread.m
   issm/trunk/src/m/contrib/morlighem/bamg/yams.m
   issm/trunk/src/m/contrib/morlighem/dassflow/
   issm/trunk/src/m/contrib/morlighem/dassflow/exportgmsh.m
   issm/trunk/src/m/contrib/morlighem/dassflow/importgmsh.m
   issm/trunk/src/m/contrib/morlighem/gslib/
   issm/trunk/src/m/contrib/morlighem/gslib/gamv.m
   issm/trunk/src/m/contrib/morlighem/gslib/gslib.m
   issm/trunk/src/m/contrib/morlighem/gslib/pkriging.m
   issm/trunk/src/m/contrib/morlighem/gslib/varmap.m
   issm/trunk/src/m/contrib/morlighem/massbalance/
   issm/trunk/src/m/contrib/morlighem/massbalance/contourmassbalance.m
   issm/trunk/src/m/contrib/morlighem/massbalance/divergence.m
   issm/trunk/src/m/contrib/morlighem/massbalance/outflow.m
   issm/trunk/src/m/contrib/morlighem/massbalance/outflux.m
   issm/trunk/src/m/contrib/morlighem/sia.m
   issm/trunk/src/m/contrib/morlighem/thicknessevolution.m
   issm/trunk/src/m/contrib/netCDF/
   issm/trunk/src/m/contrib/oasis/
   issm/trunk/src/m/contrib/paraview/
   issm/trunk/src/m/contrib/seroussi/oasis/
   issm/trunk/src/m/contrib/seroussi/oasis/carter.m
   issm/trunk/src/m/contrib/uci/
   issm/trunk/src/m/enum/CalvingPiEnum.m
   issm/trunk/src/m/enum/CalvingpiCoeffEnum.m
   issm/trunk/src/m/enum/CalvingpiMeltingrateEnum.m
   issm/trunk/src/m/enum/ConstantsOmegaEnum.m
   issm/trunk/src/m/enum/DamagePenaltyFactorEnum.m
   issm/trunk/src/m/enum/DamagePenaltyLockEnum.m
   issm/trunk/src/m/enum/DamagePenaltyThresholdEnum.m
   issm/trunk/src/m/enum/MaxIterationConvergenceFlagEnum.m
   issm/trunk/src/m/enum/SMBEnum.m
   issm/trunk/src/m/enum/SurfaceforcingsAccumulationEnum.m
   issm/trunk/src/m/enum/SurfaceforcingsBNegEnum.m
   issm/trunk/src/m/enum/SurfaceforcingsBPosEnum.m
   issm/trunk/src/m/enum/SurfaceforcingsDelta18oEnum.m
   issm/trunk/src/m/enum/SurfaceforcingsDelta18oSurfaceEnum.m
   issm/trunk/src/m/enum/SurfaceforcingsDesfacEnum.m
   issm/trunk/src/m/enum/SurfaceforcingsEnum.m
   issm/trunk/src/m/enum/SurfaceforcingsEvaporationEnum.m
   issm/trunk/src/m/enum/SurfaceforcingsHrefEnum.m
   issm/trunk/src/m/enum/SurfaceforcingsIsdelta18oEnum.m
   issm/trunk/src/m/enum/SurfaceforcingsIsmungsmEnum.m
   issm/trunk/src/m/enum/SurfaceforcingsIspddEnum.m
   issm/trunk/src/m/enum/SurfaceforcingsIssmbgradientsEnum.m
   issm/trunk/src/m/enum/SurfaceforcingsMassBalanceEnum.m
   issm/trunk/src/m/enum/SurfaceforcingsMeltEnum.m
   issm/trunk/src/m/enum/SurfaceforcingsMonthlytemperaturesEnum.m
   issm/trunk/src/m/enum/SurfaceforcingsPfacEnum.m
   issm/trunk/src/m/enum/SurfaceforcingsPrecipitationEnum.m
   issm/trunk/src/m/enum/SurfaceforcingsPrecipitationsLgmEnum.m
   issm/trunk/src/m/enum/SurfaceforcingsPrecipitationsPresentdayEnum.m
   issm/trunk/src/m/enum/SurfaceforcingsRefreezeEnum.m
   issm/trunk/src/m/enum/SurfaceforcingsRlapsEnum.m
   issm/trunk/src/m/enum/SurfaceforcingsRlapslgmEnum.m
   issm/trunk/src/m/enum/SurfaceforcingsRunoffEnum.m
   issm/trunk/src/m/enum/SurfaceforcingsS0pEnum.m
   issm/trunk/src/m/enum/SurfaceforcingsS0tEnum.m
   issm/trunk/src/m/enum/SurfaceforcingsSealevEnum.m
   issm/trunk/src/m/enum/SurfaceforcingsSmbrefEnum.m
   issm/trunk/src/m/enum/SurfaceforcingsTdiffEnum.m
   issm/trunk/src/m/enum/SurfaceforcingsTemperaturesLgmEnum.m
   issm/trunk/src/m/enum/SurfaceforcingsTemperaturesPresentdayEnum.m
   issm/trunk/src/m/enum/TransientIscalvingEnum.m
   issm/trunk/src/m/enum/TransientIslevelsetEnum.m
   issm/trunk/src/m/exp/exp_to_levelset.m
   issm/trunk/src/m/inversions/MisfitDeinterlace.m
   issm/trunk/src/m/js/writejs1Darray.m
   issm/trunk/src/m/js/writejs2Darray.m
   issm/trunk/src/m/js/writejscellarray.m
   issm/trunk/src/m/js/writejscellstring.m
   issm/trunk/src/m/js/writejsdouble.m
   issm/trunk/src/m/js/writejsstring.m
   issm/trunk/src/m/js/writejsstruct.m
   issm/trunk/src/m/materials/DepthAvgTempCond.m
   issm/trunk/src/m/materials/DepthAvgTempCond.py
   issm/trunk/src/m/mesh/planet/gmsh/gmshplanet.m
   issm/trunk/src/m/mesh/planet/gmsh/gmshplanet.py
   issm/trunk/src/m/mesh/planet/mesh_refine_tri4.m
   issm/trunk/src/m/mesh/planet/planettrimesh.m
   issm/trunk/src/m/mesh/planet/sphere_project.m
   issm/trunk/src/m/mesh/planet/sphere_tri.m
   issm/trunk/src/m/mesh/planet/spheretri/mesh_refine_tri4.m
   issm/trunk/src/m/mesh/planet/spheretri/planettrimesh.m
   issm/trunk/src/m/mesh/planet/spheretri/sphere_project.m
   issm/trunk/src/m/mesh/planet/spheretri/sphere_tri.m
   issm/trunk/src/m/morphological/
   issm/trunk/src/m/psl/p_polynomial_prime.m
   issm/trunk/src/m/psl/p_polynomial_value.m
   issm/trunk/src/m/psl/sharmonics.m
   issm/trunk/src/m/psl/shlm.m
   issm/trunk/src/m/psl/shlm_element.m
   issm/trunk/src/m/solve/createxml.m
   issm/trunk/src/m/string/ddewhite.m
   issm/trunk/src/m/string/strsplit.m
   issm/trunk/src/py3/boundaryconditions/
   issm/trunk/src/py3/boundaryconditions/PattynSMB.py
   issm/trunk/src/py3/boundaryconditions/SetIceSheetBC.py
   issm/trunk/src/py3/boundaryconditions/SetIceShelfBC.py
   issm/trunk/src/py3/boundaryconditions/SetMarineIceSheetBC.py
   issm/trunk/src/py3/classes/
   issm/trunk/src/py3/classes/SMBcomponents.py
   issm/trunk/src/py3/classes/SMBd18opdd.py
   issm/trunk/src/py3/classes/SMBforcing.py
   issm/trunk/src/py3/classes/SMBgradients.py
   issm/trunk/src/py3/classes/SMBmeltcomponents.py
   issm/trunk/src/py3/classes/SMBpdd.py
   issm/trunk/src/py3/classes/adinversion.py
   issm/trunk/src/py3/classes/autodiff.py
   issm/trunk/src/py3/classes/balancethickness.py
   issm/trunk/src/py3/classes/bamggeom.py
   issm/trunk/src/py3/classes/bamgmesh.py
   issm/trunk/src/py3/classes/basalforcings.py
   issm/trunk/src/py3/classes/calving.py
   issm/trunk/src/py3/classes/calvinglevermann.py
   issm/trunk/src/py3/classes/clusters/
   issm/trunk/src/py3/classes/clusters/generic.py
   issm/trunk/src/py3/classes/clusters/pfe.py
   issm/trunk/src/py3/classes/constants.py
   issm/trunk/src/py3/classes/damage.py
   issm/trunk/src/py3/classes/debug.py
   issm/trunk/src/py3/classes/dependent.py
   issm/trunk/src/py3/classes/flaim.py
   issm/trunk/src/py3/classes/flowequation.py
   issm/trunk/src/py3/classes/friction.py
   issm/trunk/src/py3/classes/frictioncoulomb.py
   issm/trunk/src/py3/classes/frictionweertman.py
   issm/trunk/src/py3/classes/geometry.py
   issm/trunk/src/py3/classes/gia.py
   issm/trunk/src/py3/classes/groundingline.py
   issm/trunk/src/py3/classes/hydrologydc.py
   issm/trunk/src/py3/classes/hydrologyshreve.py
   issm/trunk/src/py3/classes/independent.py
   issm/trunk/src/py3/classes/initialization.py
   issm/trunk/src/py3/classes/inversion.py
   issm/trunk/src/py3/classes/linearbasalforcings.py
   issm/trunk/src/py3/classes/m1qn3inversion.py
   issm/trunk/src/py3/classes/mask.py
   issm/trunk/src/py3/classes/massfluxatgate.py
   issm/trunk/src/py3/classes/masstransport.py
   issm/trunk/src/py3/classes/matdamageice.py
   issm/trunk/src/py3/classes/matice.py
   issm/trunk/src/py3/classes/mesh2d.py
   issm/trunk/src/py3/classes/mesh3dprisms.py
   issm/trunk/src/py3/classes/miscellaneous.py
   issm/trunk/src/py3/classes/mismipbasalforcings.py
   issm/trunk/src/py3/classes/model.py
   issm/trunk/src/py3/classes/organizer.py
   issm/trunk/src/py3/classes/outputdefinition.py
   issm/trunk/src/py3/classes/pairoptions.py
   issm/trunk/src/py3/classes/plotoptions.py
   issm/trunk/src/py3/classes/private.py
   issm/trunk/src/py3/classes/qmu.py
   issm/trunk/src/py3/classes/radaroverlay.py
   issm/trunk/src/py3/classes/results.py
   issm/trunk/src/py3/classes/rifts.py
   issm/trunk/src/py3/classes/settings.py
   issm/trunk/src/py3/classes/steadystate.py
   issm/trunk/src/py3/classes/stressbalance.py
   issm/trunk/src/py3/classes/taoinversion.py
   issm/trunk/src/py3/classes/thermal.py
   issm/trunk/src/py3/classes/timestepping.py
   issm/trunk/src/py3/classes/toolkits.py
   issm/trunk/src/py3/classes/transient.py
   issm/trunk/src/py3/classes/verbose.py
   issm/trunk/src/py3/consistency/
   issm/trunk/src/py3/consistency/QueueRequirements.py
   issm/trunk/src/py3/consistency/checkfield.py
   issm/trunk/src/py3/consistency/ismodelselfconsistent.py
   issm/trunk/src/py3/contrib/
   issm/trunk/src/py3/contrib/bamg/
   issm/trunk/src/py3/contrib/bamg/YamsCall.py
   issm/trunk/src/py3/contrib/bamg/YamsCall.py.bak
   issm/trunk/src/py3/contrib/netCDF/
   issm/trunk/src/py3/contrib/netCDF/ClassTry.py
   issm/trunk/src/py3/contrib/netCDF/ClassTry.py.bak
   issm/trunk/src/py3/contrib/netCDF/export_netCDF.py
   issm/trunk/src/py3/contrib/netCDF/export_netCDF.py.bak
   issm/trunk/src/py3/contrib/netCDF/read_netCDF.py
   issm/trunk/src/py3/contrib/netCDF/read_netCDF.py.bak
   issm/trunk/src/py3/contrib/paraview/
   issm/trunk/src/py3/contrib/paraview/exportVTK.py
   issm/trunk/src/py3/contrib/paraview/exportVTK.py.bak
   issm/trunk/src/py3/coordsystems/
   issm/trunk/src/py3/coordsystems/ll2xy.py
   issm/trunk/src/py3/coordsystems/xy2ll.py
   issm/trunk/src/py3/dev/
   issm/trunk/src/py3/dev/devpath.py
   issm/trunk/src/py3/dev/issmversion.py
   issm/trunk/src/py3/enum/
   issm/trunk/src/py3/enum/EnumDefinitions.py
   issm/trunk/src/py3/exp/
   issm/trunk/src/py3/exp/expcoarsen.py
   issm/trunk/src/py3/exp/expdisp.py
   issm/trunk/src/py3/exp/expread.py
   issm/trunk/src/py3/exp/expwrite.py
   issm/trunk/src/py3/extrusion/
   issm/trunk/src/py3/extrusion/DepthAverage.py
   issm/trunk/src/py3/extrusion/project2d.py
   issm/trunk/src/py3/extrusion/project3d.py
   issm/trunk/src/py3/geometry/
   issm/trunk/src/py3/geometry/FlagElements.py
   issm/trunk/src/py3/geometry/GetAreas.py
   issm/trunk/src/py3/geometry/SegIntersect.py
   issm/trunk/src/py3/geometry/slope.py
   issm/trunk/src/py3/interp/
   issm/trunk/src/py3/interp/SectionValues.py
   issm/trunk/src/py3/interp/averaging.py
   issm/trunk/src/py3/interp/holefiller.py
   issm/trunk/src/py3/interp/interp.py
   issm/trunk/src/py3/inversions/
   issm/trunk/src/py3/inversions/marshallcostfunctions.py
   issm/trunk/src/py3/inversions/parametercontroldrag.py
   issm/trunk/src/py3/inversions/supportedcontrols.py
   issm/trunk/src/py3/inversions/supportedcostfunctions.py
   issm/trunk/src/py3/io/
   issm/trunk/src/py3/io/loadmodel.py
   issm/trunk/src/py3/io/loadvars.py
   issm/trunk/src/py3/io/savevars.py
   issm/trunk/src/py3/materials/
   issm/trunk/src/py3/materials/DepthAvgTempCond.py
   issm/trunk/src/py3/materials/TMeltingPoint.py
   issm/trunk/src/py3/materials/cuffey.py
   issm/trunk/src/py3/materials/paterson.py
   issm/trunk/src/py3/mech/
   issm/trunk/src/py3/mech/analyticaldamage.py
   issm/trunk/src/py3/mech/backstressfrominversion.py
   issm/trunk/src/py3/mech/calcbackstress.py
   issm/trunk/src/py3/mech/damagefrominversion.py
   issm/trunk/src/py3/mech/mechanicalproperties.py
   issm/trunk/src/py3/mech/robintemperature.py
   issm/trunk/src/py3/mech/steadystateiceshelftemp.py
   issm/trunk/src/py3/mech/thomasparams.py
   issm/trunk/src/py3/mesh/
   issm/trunk/src/py3/mesh/ComputeHessian.py
   issm/trunk/src/py3/mesh/ComputeMetric.py
   issm/trunk/src/py3/mesh/ElementsFromEdge.py
   issm/trunk/src/py3/mesh/GetNodalFunctionsCoeff.py
   issm/trunk/src/py3/mesh/bamg.py
   issm/trunk/src/py3/mesh/meshconvert.py
   issm/trunk/src/py3/mesh/rifts/
   issm/trunk/src/py3/mesh/rifts/meshprocessoutsiderifts.py
   issm/trunk/src/py3/mesh/rifts/meshprocessrifts.py
   issm/trunk/src/py3/mesh/roundmesh.py
   issm/trunk/src/py3/mesh/squaremesh.py
   issm/trunk/src/py3/mesh/triangle.py
   issm/trunk/src/py3/miscellaneous/
   issm/trunk/src/py3/miscellaneous/MatlabFuncs.py
   issm/trunk/src/py3/miscellaneous/PythonFuncs.py
   issm/trunk/src/py3/miscellaneous/fielddisplay.py
   issm/trunk/src/py3/miscellaneous/isnans.py
   issm/trunk/src/py3/miscellaneous/parallelrange.py
   issm/trunk/src/py3/modifier.sh
   issm/trunk/src/py3/os/
   issm/trunk/src/py3/os/issmdir.py
   issm/trunk/src/py3/os/issmscpin.py
   issm/trunk/src/py3/os/issmscpout.py
   issm/trunk/src/py3/os/issmssh.py
   issm/trunk/src/py3/parameterization/
   issm/trunk/src/py3/parameterization/contourenvelope.py
   issm/trunk/src/py3/parameterization/parameterize.py
   issm/trunk/src/py3/parameterization/setflowequation.py
   issm/trunk/src/py3/parameterization/sethydrostaticmask.py
   issm/trunk/src/py3/parameterization/setmask.py
   issm/trunk/src/py3/plot/
   issm/trunk/src/py3/plot/applyoptions.py
   issm/trunk/src/py3/plot/checkplotoptions.py
   issm/trunk/src/py3/plot/colormaps/
   issm/trunk/src/py3/plot/colormaps/cmaptools.py
   issm/trunk/src/py3/plot/export_gl.py
   issm/trunk/src/py3/plot/plot_contour.py
   issm/trunk/src/py3/plot/plot_manager.py
   issm/trunk/src/py3/plot/plot_mesh.py
   issm/trunk/src/py3/plot/plot_overlay.py
   issm/trunk/src/py3/plot/plot_streamlines.py
   issm/trunk/src/py3/plot/plot_unit.py
   issm/trunk/src/py3/plot/plotmodel.py
   issm/trunk/src/py3/plot/processdata.py
   issm/trunk/src/py3/plot/processmesh.py
   issm/trunk/src/py3/plot/writejsfield.py
   issm/trunk/src/py3/plot/writejsfile.py
   issm/trunk/src/py3/shp/
   issm/trunk/src/py3/shp/shp2exp.py
   issm/trunk/src/py3/solve/
   issm/trunk/src/py3/solve/WriteData.py
   issm/trunk/src/py3/solve/loadresultsfromcluster.py
   issm/trunk/src/py3/solve/loadresultsfromdisk.py
   issm/trunk/src/py3/solve/marshall.py
   issm/trunk/src/py3/solve/parseresultsfromdisk.py
   issm/trunk/src/py3/solve/solve.py
   issm/trunk/src/py3/solve/waitonlock.py
   issm/trunk/src/py3/solvers/
   issm/trunk/src/py3/solvers/asmoptions.py
   issm/trunk/src/py3/solvers/iluasmoptions.py
   issm/trunk/src/py3/solvers/issmgslsolver.py
   issm/trunk/src/py3/solvers/issmmumpssolver.py
   issm/trunk/src/py3/solvers/jacobiasmoptions.py
   issm/trunk/src/py3/solvers/jacobicgoptions.py
   issm/trunk/src/py3/solvers/matlaboptions.py
   issm/trunk/src/py3/solvers/mumpsoptions.py
   issm/trunk/src/py3/solvers/soroptions.py
   issm/trunk/src/py3/solvers/stokesoptions.py
   issm/trunk/src/py3/test.txt
   issm/trunk/src/py3/tmp
   issm/trunk/src/wrappers/DistanceToMaskBoundary/DistanceToMaskBoundary.cpp
   issm/trunk/src/wrappers/DistanceToMaskBoundary/DistanceToMaskBoundary.h
   issm/trunk/src/wrappers/Issm/issm.cpp
   issm/trunk/src/wrappers/Issm/issm.js
   issm/trunk/src/wrappers/javascript/Makefile.am
   issm/trunk/src/wrappers/javascript/include/
   issm/trunk/src/wrappers/javascript/include/javascriptincludes.h
   issm/trunk/src/wrappers/javascript/include/wrapper_macros.h
   issm/trunk/src/wrappers/javascript/io/
   issm/trunk/src/wrappers/javascript/io/ApiPrintf.cpp
   issm/trunk/src/wrappers/javascript/io/FetchJavascriptData.cpp
   issm/trunk/src/wrappers/javascript/io/WriteJavascriptData.cpp
   issm/trunk/src/wrappers/javascript/io/javascriptio.h
   issm/trunk/test/Archives/Archive271.nc
   issm/trunk/test/NightlyRun/test238.py
   issm/trunk/test/NightlyRun/test239.py
   issm/trunk/test/NightlyRun/test271.m
   issm/trunk/test/NightlyRun/test271.py
Modified:
   issm/trunk/
   issm/trunk/configure.ac
   issm/trunk/etc/environment.csh
   issm/trunk/etc/environment.sh
   issm/trunk/examples/Greenland/CheatSheet.m
   issm/trunk/examples/Greenland/Greenland.par
   issm/trunk/examples/Greenland/runme.m
   issm/trunk/examples/Pig/Pig.par
   issm/trunk/externalpackages/adolc/install-withampi-macosx64.sh
   issm/trunk/externalpackages/adolc/install-withampi.sh
   issm/trunk/externalpackages/adolc/install.sh
   issm/trunk/externalpackages/autotools/install-win.sh
   issm/trunk/externalpackages/autotools/patches/libtool.m4.patch
   issm/trunk/externalpackages/boost/install-1.49-linux.sh
   issm/trunk/externalpackages/cmake/install.sh
   issm/trunk/externalpackages/dakota/configs/5.3.1/CMakeLists.txt.pfe.patch
   issm/trunk/externalpackages/dakota/install-5.3.1-linux64.sh
   issm/trunk/externalpackages/dakota/install-5.3.1-pleiades.sh
   issm/trunk/externalpackages/esmf/install.sh
   issm/trunk/externalpackages/fti/
   issm/trunk/externalpackages/gdal/install-1.10-linux64.sh
   issm/trunk/externalpackages/gmsh/
   issm/trunk/externalpackages/gmsh/install.sh
   issm/trunk/externalpackages/gshhg/install.sh
   issm/trunk/externalpackages/mercurial/install.sh
   issm/trunk/externalpackages/numpy/install-macosx-snowleopard.sh
   issm/trunk/externalpackages/petsc/install-3.5-win7.sh
   issm/trunk/externalpackages/python/install-2.7.3-macosx-snowleopard.sh
   issm/trunk/externalpackages/scipy/install-macosx-snowleopard.sh
   issm/trunk/externalpackages/triangle/
   issm/trunk/externalpackages/triangle/install.sh
   issm/trunk/externalpackages/valgrind/install-macosx64.sh
   issm/trunk/externalpackages/vim/addons/vim/syntax/c.vim
   issm/trunk/externalpackages/windows/windows_environment.sh
   issm/trunk/jenkins/jenkins.sh
   issm/trunk/jenkins/windows
   issm/trunk/m4/analyses.m4
   issm/trunk/m4/issm_options.m4
   issm/trunk/packagers/macosx/install.sh
   issm/trunk/packagers/macosx/package.sh
   issm/trunk/packagers/ubuntu/install.sh
   issm/trunk/packagers/win7/package64.sh
   issm/trunk/scripts/BinRead.py
   issm/trunk/scripts/automakererun.sh
   issm/trunk/scripts/ol.m
   issm/trunk/src/
   issm/trunk/src/c/Makefile.am
   issm/trunk/src/c/analyses/AdjointBalancethicknessAnalysis.cpp
   issm/trunk/src/c/analyses/AdjointHorizAnalysis.cpp
   issm/trunk/src/c/analyses/Analysis.h
   issm/trunk/src/c/analyses/Balancethickness2Analysis.cpp
   issm/trunk/src/c/analyses/BalancethicknessAnalysis.cpp
   issm/trunk/src/c/analyses/BalancevelocityAnalysis.cpp
   issm/trunk/src/c/analyses/DamageEvolutionAnalysis.cpp
   issm/trunk/src/c/analyses/DamageEvolutionAnalysis.h
   issm/trunk/src/c/analyses/EnthalpyAnalysis.cpp
   issm/trunk/src/c/analyses/EnumToAnalysis.cpp
   issm/trunk/src/c/analyses/ExtrapolationAnalysis.cpp
   issm/trunk/src/c/analyses/ExtrapolationAnalysis.h
   issm/trunk/src/c/analyses/FreeSurfaceBaseAnalysis.cpp
   issm/trunk/src/c/analyses/FreeSurfaceTopAnalysis.cpp
   issm/trunk/src/c/analyses/GiaAnalysis.cpp
   issm/trunk/src/c/analyses/HydrologyShreveAnalysis.cpp
   issm/trunk/src/c/analyses/L2ProjectionBaseAnalysis.cpp
   issm/trunk/src/c/analyses/LevelsetAnalysis.cpp
   issm/trunk/src/c/analyses/MasstransportAnalysis.cpp
   issm/trunk/src/c/analyses/MeltingAnalysis.cpp
   issm/trunk/src/c/analyses/StressbalanceAnalysis.cpp
   issm/trunk/src/c/analyses/StressbalanceSIAAnalysis.cpp
   issm/trunk/src/c/analyses/StressbalanceVerticalAnalysis.cpp
   issm/trunk/src/c/analyses/StressbalanceVerticalAnalysis.h
   issm/trunk/src/c/analyses/ThermalAnalysis.cpp
   issm/trunk/src/c/analyses/analyses.h
   issm/trunk/src/c/classes/Constraints/SpcDynamic.cpp
   issm/trunk/src/c/classes/Constraints/SpcDynamic.h
   issm/trunk/src/c/classes/Constraints/SpcStatic.cpp
   issm/trunk/src/c/classes/Constraints/SpcStatic.h
   issm/trunk/src/c/classes/Constraints/SpcTransient.cpp
   issm/trunk/src/c/classes/Constraints/SpcTransient.h
   issm/trunk/src/c/classes/Contour.h
   issm/trunk/src/c/classes/DependentObject.h
   issm/trunk/src/c/classes/DofIndexing.cpp
   issm/trunk/src/c/classes/DofIndexing.h
   issm/trunk/src/c/classes/Elements/Element.cpp
   issm/trunk/src/c/classes/Elements/Element.h
   issm/trunk/src/c/classes/Elements/ElementHook.cpp
   issm/trunk/src/c/classes/Elements/ElementHook.h
   issm/trunk/src/c/classes/Elements/Penta.cpp
   issm/trunk/src/c/classes/Elements/Penta.h
   issm/trunk/src/c/classes/Elements/PentaRef.h
   issm/trunk/src/c/classes/Elements/Seg.cpp
   issm/trunk/src/c/classes/Elements/Seg.h
   issm/trunk/src/c/classes/Elements/SegRef.h
   issm/trunk/src/c/classes/Elements/Tetra.cpp
   issm/trunk/src/c/classes/Elements/Tetra.h
   issm/trunk/src/c/classes/Elements/TetraRef.h
   issm/trunk/src/c/classes/Elements/Tria.cpp
   issm/trunk/src/c/classes/Elements/Tria.h
   issm/trunk/src/c/classes/Elements/TriaRef.h
   issm/trunk/src/c/classes/ExternalResults/GenericExternalResult.h
   issm/trunk/src/c/classes/FemModel.cpp
   issm/trunk/src/c/classes/FemModel.h
   issm/trunk/src/c/classes/Hook.cpp
   issm/trunk/src/c/classes/Hook.h
   issm/trunk/src/c/classes/IndependentObject.h
   issm/trunk/src/c/classes/Inputs/BoolInput.cpp
   issm/trunk/src/c/classes/Inputs/BoolInput.h
   issm/trunk/src/c/classes/Inputs/ControlInput.cpp
   issm/trunk/src/c/classes/Inputs/ControlInput.h
   issm/trunk/src/c/classes/Inputs/DatasetInput.cpp
   issm/trunk/src/c/classes/Inputs/DatasetInput.h
   issm/trunk/src/c/classes/Inputs/DoubleInput.cpp
   issm/trunk/src/c/classes/Inputs/DoubleInput.h
   issm/trunk/src/c/classes/Inputs/Input.h
   issm/trunk/src/c/classes/Inputs/Inputs.h
   issm/trunk/src/c/classes/Inputs/IntInput.cpp
   issm/trunk/src/c/classes/Inputs/IntInput.h
   issm/trunk/src/c/classes/Inputs/PentaInput.cpp
   issm/trunk/src/c/classes/Inputs/PentaInput.h
   issm/trunk/src/c/classes/Inputs/SegInput.cpp
   issm/trunk/src/c/classes/Inputs/SegInput.h
   issm/trunk/src/c/classes/Inputs/TetraInput.cpp
   issm/trunk/src/c/classes/Inputs/TetraInput.h
   issm/trunk/src/c/classes/Inputs/TransientInput.cpp
   issm/trunk/src/c/classes/Inputs/TransientInput.h
   issm/trunk/src/c/classes/Inputs/TriaInput.cpp
   issm/trunk/src/c/classes/Inputs/TriaInput.h
   issm/trunk/src/c/classes/IoModel.cpp
   issm/trunk/src/c/classes/IoModel.h
   issm/trunk/src/c/classes/Loads/Friction.cpp
   issm/trunk/src/c/classes/Loads/Friction.h
   issm/trunk/src/c/classes/Loads/Loads.cpp
   issm/trunk/src/c/classes/Loads/Numericalflux.cpp
   issm/trunk/src/c/classes/Loads/Numericalflux.h
   issm/trunk/src/c/classes/Loads/Pengrid.cpp
   issm/trunk/src/c/classes/Loads/Pengrid.h
   issm/trunk/src/c/classes/Loads/Penpair.cpp
   issm/trunk/src/c/classes/Loads/Penpair.h
   issm/trunk/src/c/classes/Loads/Riftfront.cpp
   issm/trunk/src/c/classes/Loads/Riftfront.h
   issm/trunk/src/c/classes/Masscon.h
   issm/trunk/src/c/classes/Massconaxpby.h
   issm/trunk/src/c/classes/Massfluxatgate.h
   issm/trunk/src/c/classes/Materials/Matice.cpp
   issm/trunk/src/c/classes/Materials/Matice.h
   issm/trunk/src/c/classes/Materials/Matpar.cpp
   issm/trunk/src/c/classes/Materials/Matpar.h
   issm/trunk/src/c/classes/Misfit.h
   issm/trunk/src/c/classes/Node.cpp
   issm/trunk/src/c/classes/Node.h
   issm/trunk/src/c/classes/Nodes.cpp
   issm/trunk/src/c/classes/Options/Option.h
   issm/trunk/src/c/classes/Params/BoolParam.cpp
   issm/trunk/src/c/classes/Params/BoolParam.h
   issm/trunk/src/c/classes/Params/DataSetParam.cpp
   issm/trunk/src/c/classes/Params/DataSetParam.h
   issm/trunk/src/c/classes/Params/DoubleMatArrayParam.cpp
   issm/trunk/src/c/classes/Params/DoubleMatArrayParam.h
   issm/trunk/src/c/classes/Params/DoubleMatParam.cpp
   issm/trunk/src/c/classes/Params/DoubleMatParam.h
   issm/trunk/src/c/classes/Params/DoubleParam.cpp
   issm/trunk/src/c/classes/Params/DoubleParam.h
   issm/trunk/src/c/classes/Params/DoubleVecParam.cpp
   issm/trunk/src/c/classes/Params/DoubleVecParam.h
   issm/trunk/src/c/classes/Params/FileParam.cpp
   issm/trunk/src/c/classes/Params/FileParam.h
   issm/trunk/src/c/classes/Params/GenericParam.h
   issm/trunk/src/c/classes/Params/IntMatParam.cpp
   issm/trunk/src/c/classes/Params/IntMatParam.h
   issm/trunk/src/c/classes/Params/IntParam.cpp
   issm/trunk/src/c/classes/Params/IntParam.h
   issm/trunk/src/c/classes/Params/IntVecParam.cpp
   issm/trunk/src/c/classes/Params/IntVecParam.h
   issm/trunk/src/c/classes/Params/MatrixParam.cpp
   issm/trunk/src/c/classes/Params/MatrixParam.h
   issm/trunk/src/c/classes/Params/Parameters.cpp
   issm/trunk/src/c/classes/Params/StringArrayParam.cpp
   issm/trunk/src/c/classes/Params/StringArrayParam.h
   issm/trunk/src/c/classes/Params/StringParam.cpp
   issm/trunk/src/c/classes/Params/StringParam.h
   issm/trunk/src/c/classes/Params/TransientParam.cpp
   issm/trunk/src/c/classes/Params/TransientParam.h
   issm/trunk/src/c/classes/Params/VectorParam.h
   issm/trunk/src/c/classes/Profiler.cpp
   issm/trunk/src/c/classes/Profiler.h
   issm/trunk/src/c/classes/Segment.h
   issm/trunk/src/c/classes/Vertex.cpp
   issm/trunk/src/c/classes/Vertex.h
   issm/trunk/src/c/classes/classes.h
   issm/trunk/src/c/classes/gauss/GaussPenta.cpp
   issm/trunk/src/c/classes/kriging/Covertree.cpp
   issm/trunk/src/c/classes/kriging/Covertree.h
   issm/trunk/src/c/classes/kriging/ExponentialVariogram.h
   issm/trunk/src/c/classes/kriging/GaussianVariogram.h
   issm/trunk/src/c/classes/kriging/Observation.h
   issm/trunk/src/c/classes/kriging/Observations.cpp
   issm/trunk/src/c/classes/kriging/Observations.h
   issm/trunk/src/c/classes/kriging/PowerVariogram.h
   issm/trunk/src/c/classes/kriging/Quadtree.h
   issm/trunk/src/c/classes/kriging/SphericalVariogram.h
   issm/trunk/src/c/cores/CorePointerFromSolutionEnum.cpp
   issm/trunk/src/c/cores/ProcessArguments.cpp
   issm/trunk/src/c/cores/ad_core.cpp
   issm/trunk/src/c/cores/control_core.cpp
   issm/trunk/src/c/cores/controlad_core.cpp
   issm/trunk/src/c/cores/controlm1qn3_core.cpp
   issm/trunk/src/c/cores/controltao_core.cpp
   issm/trunk/src/c/cores/controlvalidation_core.cpp
   issm/trunk/src/c/cores/cores.h
   issm/trunk/src/c/cores/dakota_core.cpp
   issm/trunk/src/c/cores/damage_core.cpp
   issm/trunk/src/c/cores/gia_core.cpp
   issm/trunk/src/c/cores/hydrology_core.cpp
   issm/trunk/src/c/cores/masstransport_core.cpp
   issm/trunk/src/c/cores/steadystate_core.cpp
   issm/trunk/src/c/cores/stressbalance_core.cpp
   issm/trunk/src/c/cores/thermal_core.cpp
   issm/trunk/src/c/cores/transient_core.cpp
   issm/trunk/src/c/datastructures/DataSet.cpp
   issm/trunk/src/c/datastructures/DataSet.h
   issm/trunk/src/c/datastructures/Object.h
   issm/trunk/src/c/kml/KML_Attribute.h
   issm/trunk/src/c/kml/KML_ColorStyle.h
   issm/trunk/src/c/kml/KML_Comment.h
   issm/trunk/src/c/kml/KML_Container.h
   issm/trunk/src/c/kml/KML_Document.h
   issm/trunk/src/c/kml/KML_Feature.h
   issm/trunk/src/c/kml/KML_File.h
   issm/trunk/src/c/kml/KML_Folder.h
   issm/trunk/src/c/kml/KML_Geometry.h
   issm/trunk/src/c/kml/KML_GroundOverlay.h
   issm/trunk/src/c/kml/KML_Icon.h
   issm/trunk/src/c/kml/KML_LatLonBox.h
   issm/trunk/src/c/kml/KML_LineString.h
   issm/trunk/src/c/kml/KML_LineStyle.h
   issm/trunk/src/c/kml/KML_LinearRing.h
   issm/trunk/src/c/kml/KML_MultiGeometry.h
   issm/trunk/src/c/kml/KML_Object.h
   issm/trunk/src/c/kml/KML_Overlay.h
   issm/trunk/src/c/kml/KML_Placemark.h
   issm/trunk/src/c/kml/KML_Point.h
   issm/trunk/src/c/kml/KML_PolyStyle.h
   issm/trunk/src/c/kml/KML_Polygon.h
   issm/trunk/src/c/kml/KML_Style.h
   issm/trunk/src/c/kml/KML_StyleSelector.h
   issm/trunk/src/c/kml/KML_SubStyle.h
   issm/trunk/src/c/kml/KML_Unknown.h
   issm/trunk/src/c/main/globals.h
   issm/trunk/src/c/modules/Calvingx/Calvingx.cpp
   issm/trunk/src/c/modules/FloatingiceMeltingRatex/FloatingiceMeltingRatex.cpp
   issm/trunk/src/c/modules/FloatingiceMeltingRatex/FloatingiceMeltingRatex.h
   issm/trunk/src/c/modules/InterpFromMeshToMesh2dx/InterpFromMeshToMesh2dx.cpp
   issm/trunk/src/c/modules/IoModelToConstraintsx/IoModelToConstraintsx.cpp
   issm/trunk/src/c/modules/IoModelToConstraintsx/IoModelToConstraintsx.h
   issm/trunk/src/c/modules/Krigingx/pKrigingx.cpp
   issm/trunk/src/c/modules/MeshProfileIntersectionx/MeshProfileIntersectionx.cpp
   issm/trunk/src/c/modules/ModelProcessorx/Autodiff/CreateParametersAutodiff.cpp
   issm/trunk/src/c/modules/ModelProcessorx/Control/UpdateElementsAndMaterialsControl.cpp
   issm/trunk/src/c/modules/ModelProcessorx/CreateElementsVerticesAndMaterials.cpp
   issm/trunk/src/c/modules/ModelProcessorx/CreateNodes.cpp
   issm/trunk/src/c/modules/ModelProcessorx/CreateOutputDefinitions.cpp
   issm/trunk/src/c/modules/ModelProcessorx/CreateParameters.cpp
   issm/trunk/src/c/modules/ModelProcessorx/ModelProcessorx.cpp
   issm/trunk/src/c/modules/NodalValuex/NodalValuex.cpp
   issm/trunk/src/c/modules/OutputResultsx/OutputResultsx.cpp
   issm/trunk/src/c/modules/SetActiveNodesLSMx/SetActiveNodesLSMx.cpp
   issm/trunk/src/c/modules/SurfaceMassBalancex/SurfaceMassBalancex.cpp
   issm/trunk/src/c/modules/SurfaceMassBalancex/SurfaceMassBalancex.h
   issm/trunk/src/c/modules/TriMeshx/TriMeshx.cpp
   issm/trunk/src/c/modules/VertexCoordinatesx/VertexCoordinatesx.cpp
   issm/trunk/src/c/modules/VertexCoordinatesx/VertexCoordinatesx.h
   issm/trunk/src/c/modules/modules.h
   issm/trunk/src/c/shared/Elements/ComputeMungsmTemperaturePrecipitation.cpp
   issm/trunk/src/c/shared/Elements/LliboutryDuval.cpp
   issm/trunk/src/c/shared/Elements/PddSurfaceMassBalance.cpp
   issm/trunk/src/c/shared/Elements/elements.h
   issm/trunk/src/c/shared/Enum/EnumDefinitions.h
   issm/trunk/src/c/shared/Enum/EnumToStringx.cpp
   issm/trunk/src/c/shared/Enum/StringToEnumx.cpp
   issm/trunk/src/c/shared/Enum/Synchronize.sh
   issm/trunk/src/c/shared/Exceptions/Exceptions.cpp
   issm/trunk/src/c/shared/Exceptions/exceptions.h
   issm/trunk/src/c/shared/FSanalyticals/fsanalyticals.cpp
   issm/trunk/src/c/shared/Matrix/MatrixUtils.cpp
   issm/trunk/src/c/shared/Matrix/matrix.h
   issm/trunk/src/c/shared/Numerics/Verbosity.cpp
   issm/trunk/src/c/shared/Numerics/Verbosity.h
   issm/trunk/src/c/shared/Numerics/constants.h
   issm/trunk/src/c/shared/Numerics/isnan.h
   issm/trunk/src/c/shared/Numerics/numerics.h
   issm/trunk/src/c/shared/io/Disk/diskio.h
   issm/trunk/src/c/shared/io/Disk/pfopen.cpp
   issm/trunk/src/c/shared/io/io.h
   issm/trunk/src/c/solutionsequences/solutionsequence_fct.cpp
   issm/trunk/src/c/solutionsequences/solutionsequence_hydro_nonlinear.cpp
   issm/trunk/src/c/solutionsequences/solutionsequence_newton.cpp
   issm/trunk/src/c/solutionsequences/solutionsequence_nonlinear.cpp
   issm/trunk/src/c/solutionsequences/solutionsequence_thermal_nonlinear.cpp
   issm/trunk/src/c/toolkits/gsl/DenseGslSolve.cpp
   issm/trunk/src/c/toolkits/issm/Bucket.h
   issm/trunk/src/c/toolkits/issm/IssmAbsVec.h
   issm/trunk/src/c/toolkits/issm/IssmMpiVec.h
   issm/trunk/src/c/toolkits/issm/IssmSeqVec.h
   issm/trunk/src/c/toolkits/issm/IssmVec.h
   issm/trunk/src/c/toolkits/mpi/issmmpi.cpp
   issm/trunk/src/c/toolkits/mpi/issmmpi.h
   issm/trunk/src/c/toolkits/mumps/MumpsSolve.cpp
   issm/trunk/src/c/toolkits/objects/Vector.h
   issm/trunk/src/c/toolkits/petsc/objects/PetscMat.cpp
   issm/trunk/src/c/toolkits/petsc/objects/PetscVec.cpp
   issm/trunk/src/c/toolkits/petsc/objects/PetscVec.h
   issm/trunk/src/dox/issm.dox
   issm/trunk/src/m/Makefile.am
   issm/trunk/src/m/boundaryconditions/SetIceSheetBC.m
   issm/trunk/src/m/boundaryconditions/SetIceSheetBC.py
   issm/trunk/src/m/boundaryconditions/SetIceShelfBC.m
   issm/trunk/src/m/boundaryconditions/SetIceShelfBC.py
   issm/trunk/src/m/boundaryconditions/SetMarineIceSheetBC.m
   issm/trunk/src/m/boundaryconditions/SetMarineIceSheetBC.py
   issm/trunk/src/m/classes/SMBcomponents.m
   issm/trunk/src/m/classes/SMBcomponents.py
   issm/trunk/src/m/classes/SMBgradients.m
   issm/trunk/src/m/classes/SMBgradients.py
   issm/trunk/src/m/classes/SMBhenning.m
   issm/trunk/src/m/classes/SMBmeltcomponents.m
   issm/trunk/src/m/classes/SMBmeltcomponents.py
   issm/trunk/src/m/classes/SMBpdd.m
   issm/trunk/src/m/classes/SMBpdd.py
   issm/trunk/src/m/classes/adinversion.m
   issm/trunk/src/m/classes/autodiff.m
   issm/trunk/src/m/classes/autodiff.py
   issm/trunk/src/m/classes/balancethickness.m
   issm/trunk/src/m/classes/balancethickness.py
   issm/trunk/src/m/classes/basalforcings.m
   issm/trunk/src/m/classes/basalforcings.py
   issm/trunk/src/m/classes/calving.m
   issm/trunk/src/m/classes/calving.py
   issm/trunk/src/m/classes/calvingdev.m
   issm/trunk/src/m/classes/calvinglevermann.m
   issm/trunk/src/m/classes/calvinglevermann.py
   issm/trunk/src/m/classes/clusters/acenet.m
   issm/trunk/src/m/classes/clusters/castor.m
   issm/trunk/src/m/classes/clusters/cloud.m
   issm/trunk/src/m/classes/clusters/cosmos.m
   issm/trunk/src/m/classes/clusters/discover.m
   issm/trunk/src/m/classes/clusters/gemini.m
   issm/trunk/src/m/classes/clusters/generic.m
   issm/trunk/src/m/classes/clusters/generic.py
   issm/trunk/src/m/classes/clusters/generic_static.m
   issm/trunk/src/m/classes/clusters/greenplanet.m
   issm/trunk/src/m/classes/clusters/hpc.m
   issm/trunk/src/m/classes/clusters/pfe.m
   issm/trunk/src/m/classes/clusters/pollux.m
   issm/trunk/src/m/classes/constants.m
   issm/trunk/src/m/classes/damage.m
   issm/trunk/src/m/classes/damage.py
   issm/trunk/src/m/classes/debug.m
   issm/trunk/src/m/classes/dependent.py
   issm/trunk/src/m/classes/flaim.m
   issm/trunk/src/m/classes/flowequation.m
   issm/trunk/src/m/classes/flowequation.py
   issm/trunk/src/m/classes/friction.m
   issm/trunk/src/m/classes/friction.py
   issm/trunk/src/m/classes/frictionhydro.m
   issm/trunk/src/m/classes/frictiontemp.m
   issm/trunk/src/m/classes/frictionwaterlayer.m
   issm/trunk/src/m/classes/frictionweertman.m
   issm/trunk/src/m/classes/frictionweertman.py
   issm/trunk/src/m/classes/frictionweertmantemp.m
   issm/trunk/src/m/classes/geometry.m
   issm/trunk/src/m/classes/geometry.py
   issm/trunk/src/m/classes/gia.m
   issm/trunk/src/m/classes/gia.py
   issm/trunk/src/m/classes/groundingline.m
   issm/trunk/src/m/classes/hydrologydc.m
   issm/trunk/src/m/classes/hydrologydc.py
   issm/trunk/src/m/classes/hydrologyshreve.m
   issm/trunk/src/m/classes/hydrologyshreve.py
   issm/trunk/src/m/classes/independent.py
   issm/trunk/src/m/classes/initialization.m
   issm/trunk/src/m/classes/initialization.py
   issm/trunk/src/m/classes/inversion.m
   issm/trunk/src/m/classes/inversion.py
   issm/trunk/src/m/classes/inversionvalidation.m
   issm/trunk/src/m/classes/linearbasalforcings.m
   issm/trunk/src/m/classes/linearbasalforcings.py
   issm/trunk/src/m/classes/m1qn3inversion.m
   issm/trunk/src/m/classes/m1qn3inversion.py
   issm/trunk/src/m/classes/mask.m
   issm/trunk/src/m/classes/mask.py
   issm/trunk/src/m/classes/masscon.m
   issm/trunk/src/m/classes/massconaxpby.m
   issm/trunk/src/m/classes/masstransport.m
   issm/trunk/src/m/classes/masstransport.py
   issm/trunk/src/m/classes/matdamageice.m
   issm/trunk/src/m/classes/matdamageice.py
   issm/trunk/src/m/classes/matice.m
   issm/trunk/src/m/classes/matice.py
   issm/trunk/src/m/classes/mesh2d.m
   issm/trunk/src/m/classes/mesh2d.py
   issm/trunk/src/m/classes/mesh2dvertical.m
   issm/trunk/src/m/classes/mesh3dprisms.m
   issm/trunk/src/m/classes/mesh3dprisms.py
   issm/trunk/src/m/classes/mesh3dsurface.m
   issm/trunk/src/m/classes/mesh3dtetras.m
   issm/trunk/src/m/classes/miscellaneous.m
   issm/trunk/src/m/classes/misfit.m
   issm/trunk/src/m/classes/model.m
   issm/trunk/src/m/classes/model.py
   issm/trunk/src/m/classes/oldclasses/surfaceforcings.m
   issm/trunk/src/m/classes/organizer.m
   issm/trunk/src/m/classes/organizer.py
   issm/trunk/src/m/classes/outputdefinition.m
   issm/trunk/src/m/classes/pairoptions.m
   issm/trunk/src/m/classes/private.m
   issm/trunk/src/m/classes/qmu.m
   issm/trunk/src/m/classes/radaroverlay.m
   issm/trunk/src/m/classes/rifts.m
   issm/trunk/src/m/classes/settings.m
   issm/trunk/src/m/classes/settings.py
   issm/trunk/src/m/classes/spheremesh.m
   issm/trunk/src/m/classes/steadystate.m
   issm/trunk/src/m/classes/stressbalance.m
   issm/trunk/src/m/classes/stressbalance.py
   issm/trunk/src/m/classes/taoinversion.m
   issm/trunk/src/m/classes/thermal.m
   issm/trunk/src/m/classes/thermal.py
   issm/trunk/src/m/classes/timestepping.m
   issm/trunk/src/m/classes/timestepping.py
   issm/trunk/src/m/classes/toolkits.m
   issm/trunk/src/m/classes/toolkits.py
   issm/trunk/src/m/classes/transient.m
   issm/trunk/src/m/classes/transient.py
   issm/trunk/src/m/classes/verbose.m
   issm/trunk/src/m/classes/verbose.py
   issm/trunk/src/m/consistency/checkfield.m
   issm/trunk/src/m/consistency/checkfield.py
   issm/trunk/src/m/consistency/comparemodels.m
   issm/trunk/src/m/consistency/ismodelselfconsistent.m
   issm/trunk/src/m/consistency/ismodelselfconsistent.py
   issm/trunk/src/m/coordsystems/gdaltransform.m
   issm/trunk/src/m/dev/devpath.py
   issm/trunk/src/m/dev/issmversion.m
   issm/trunk/src/m/dev/issmversion.py
   issm/trunk/src/m/enum/EnumDefinitions.py
   issm/trunk/src/m/exp/exptool.m
   issm/trunk/src/m/exp/expwrite.m
   issm/trunk/src/m/exp/expwrite.py
   issm/trunk/src/m/interp/ProfileValues.m
   issm/trunk/src/m/interp/SectionValues.py
   issm/trunk/src/m/interp/averaging.py
   issm/trunk/src/m/inversions/marshallcostfunctions.m
   issm/trunk/src/m/inversions/supportedcostfunctions.m
   issm/trunk/src/m/io/structtonc.m
   issm/trunk/src/m/mech/mechanicalproperties.m
   issm/trunk/src/m/mech/mechanicalproperties.py
   issm/trunk/src/m/mesh/bamg.m
   issm/trunk/src/m/mesh/rifts/meshaddrifts.m
   issm/trunk/src/m/mesh/rifts/meshprocessrifts.m
   issm/trunk/src/m/mesh/roundmesh.py
   issm/trunk/src/m/mesh/triangle.m
   issm/trunk/src/m/os/issmbbftpin.m
   issm/trunk/src/m/os/issmbbftpout.m
   issm/trunk/src/m/os/issmdir.m
   issm/trunk/src/m/os/issmscpin.py
   issm/trunk/src/m/os/oshostname.m
   issm/trunk/src/m/parameterization/contourenvelope.m
   issm/trunk/src/m/parameterization/setflowequation.m
   issm/trunk/src/m/parameterization/setflowequation.py
   issm/trunk/src/m/plot/applyoptions.m
   issm/trunk/src/m/plot/applyoptions.py
   issm/trunk/src/m/plot/checkplotoptions.py
   issm/trunk/src/m/plot/colormaps/lbmap.m
   issm/trunk/src/m/plot/googlemaps.m
   issm/trunk/src/m/plot/manualcb.m
   issm/trunk/src/m/plot/plot_BC.m
   issm/trunk/src/m/plot/plot_contour.py
   issm/trunk/src/m/plot/plot_elementstype.m
   issm/trunk/src/m/plot/plot_googlemaps.m
   issm/trunk/src/m/plot/plot_icefront.m
   issm/trunk/src/m/plot/plot_manager.py
   issm/trunk/src/m/plot/plot_overlay.py
   issm/trunk/src/m/plot/plot_quiver.m
   issm/trunk/src/m/plot/plot_tensor_components.m
   issm/trunk/src/m/plot/plot_tensor_principal.m
   issm/trunk/src/m/plot/plot_tensor_principalaxis.m
   issm/trunk/src/m/plot/plot_transient_movie.m
   issm/trunk/src/m/plot/plot_unit.py
   issm/trunk/src/m/plot/plot_vstime.m
   issm/trunk/src/m/plot/plotmodel.py
   issm/trunk/src/m/plot/processdata.m
   issm/trunk/src/m/plot/processdata.py
   issm/trunk/src/m/plot/quiver_colorbar.m
   issm/trunk/src/m/plot/radarpower.m
   issm/trunk/src/m/qmu/dakota_in_params.m
   issm/trunk/src/m/qmu/dakota_in_write.m
   issm/trunk/src/m/qmu/dakota_out_parse.m
   issm/trunk/src/m/qmu/postqmu.m
   issm/trunk/src/m/shp/shp2exp.py
   issm/trunk/src/m/shp/shpread.m
   issm/trunk/src/m/solve/loadresultsfromcluster.m
   issm/trunk/src/m/solve/loadresultsfromcluster.py
   issm/trunk/src/m/solve/parseresultsfromdisk.m
   issm/trunk/src/m/solve/parseresultsfromdisk.py
   issm/trunk/src/m/solve/solve.m
   issm/trunk/src/m/solve/solve.py
   issm/trunk/src/m/solvers/issmgslsolver.py
   issm/trunk/src/m/solvers/issmmumpssolver.py
   issm/trunk/src/m/string/strsplit_strict.m
   issm/trunk/src/wrappers/ContourToMesh/ContourToMesh.cpp
   issm/trunk/src/wrappers/ContourToMesh/ContourToMesh.h
   issm/trunk/src/wrappers/ContourToNodes/ContourToNodes.cpp
   issm/trunk/src/wrappers/ElementConnectivity/ElementConnectivity.cpp
   issm/trunk/src/wrappers/ElementConnectivity/ElementConnectivity.h
   issm/trunk/src/wrappers/EnumToString/EnumToString.cpp
   issm/trunk/src/wrappers/EnumToString/EnumToString.h
   issm/trunk/src/wrappers/ExpSimplify/ExpSimplify.cpp
   issm/trunk/src/wrappers/ExpToLevelSet/ExpToLevelSet.cpp
   issm/trunk/src/wrappers/InterpFromGridToMesh/InterpFromGridToMesh.cpp
   issm/trunk/src/wrappers/InterpFromMesh2d/InterpFromMesh2d.cpp
   issm/trunk/src/wrappers/InterpFromMeshToGrid/InterpFromMeshToGrid.cpp
   issm/trunk/src/wrappers/InterpFromMeshToMesh2d/InterpFromMeshToMesh2d.cpp
   issm/trunk/src/wrappers/InterpFromMeshToMesh2d/InterpFromMeshToMesh2d.h
   issm/trunk/src/wrappers/InterpFromMeshToMesh3d/InterpFromMeshToMesh3d.cpp
   issm/trunk/src/wrappers/IssmConfig/IssmConfig.cpp
   issm/trunk/src/wrappers/IssmConfig/IssmConfig.h
   issm/trunk/src/wrappers/Ll2xy/Ll2xy.cpp
   issm/trunk/src/wrappers/M1qn3/M1qn3.cpp
   issm/trunk/src/wrappers/Makefile.am
   issm/trunk/src/wrappers/MeshPartition/MeshPartition.cpp
   issm/trunk/src/wrappers/MeshProfileIntersection/MeshProfileIntersection.cpp
   issm/trunk/src/wrappers/NodeConnectivity/NodeConnectivity.cpp
   issm/trunk/src/wrappers/NodeConnectivity/NodeConnectivity.h
   issm/trunk/src/wrappers/PointCloudFindNeighbors/PointCloudFindNeighbors.cpp
   issm/trunk/src/wrappers/PropagateFlagsFromConnectivity/PropagateFlagsFromConnectivity.cpp
   issm/trunk/src/wrappers/StringToEnum/StringToEnum.cpp
   issm/trunk/src/wrappers/StringToEnum/StringToEnum.h
   issm/trunk/src/wrappers/TriMesh/TriMesh.cpp
   issm/trunk/src/wrappers/TriMesh/TriMesh.h
   issm/trunk/src/wrappers/TriMeshProcessRifts/TriMeshProcessRifts.cpp
   issm/trunk/src/wrappers/TriaSearch/TriaSearch.cpp
   issm/trunk/src/wrappers/Xy2ll/Xy2ll.cpp
   issm/trunk/src/wrappers/bindings.h
   issm/trunk/src/wrappers/matlab/Makefile.am
   issm/trunk/src/wrappers/matlab/include/wrapper_macros.h
   issm/trunk/src/wrappers/python/include/pythonincludes.h
   issm/trunk/src/wrappers/python/include/wrapper_macros.h
   issm/trunk/src/wrappers/python/io/FetchPythonData.cpp
   issm/trunk/src/wrappers/python/io/WritePythonData.cpp
   issm/trunk/test/
   issm/trunk/test/Archives/Archive108.nc
   issm/trunk/test/Archives/Archive109.nc
   issm/trunk/test/Archives/Archive111.nc
   issm/trunk/test/Archives/Archive120.nc
   issm/trunk/test/Archives/Archive121.nc
   issm/trunk/test/Archives/Archive122.nc
   issm/trunk/test/Archives/Archive124.nc
   issm/trunk/test/Archives/Archive206.nc
   issm/trunk/test/Archives/Archive207.nc
   issm/trunk/test/Archives/Archive208.nc
   issm/trunk/test/Archives/Archive209.nc
   issm/trunk/test/Archives/Archive210.nc
   issm/trunk/test/Archives/Archive211.nc
   issm/trunk/test/Archives/Archive214.nc
   issm/trunk/test/Archives/Archive224.nc
   issm/trunk/test/Archives/Archive225.nc
   issm/trunk/test/Archives/Archive226.nc
   issm/trunk/test/Archives/Archive227.nc
   issm/trunk/test/Archives/Archive232.nc
   issm/trunk/test/Archives/Archive233.nc
   issm/trunk/test/Archives/Archive236.nc
   issm/trunk/test/Archives/Archive237.nc
   issm/trunk/test/Archives/Archive238.nc
   issm/trunk/test/Archives/Archive239.nc
   issm/trunk/test/Archives/Archive285.nc
   issm/trunk/test/Archives/Archive3008.nc
   issm/trunk/test/Archives/Archive3009.nc
   issm/trunk/test/Archives/Archive302.nc
   issm/trunk/test/Archives/Archive303.nc
   issm/trunk/test/Archives/Archive306.nc
   issm/trunk/test/Archives/Archive3108.nc
   issm/trunk/test/Archives/Archive3109.nc
   issm/trunk/test/Archives/Archive312.nc
   issm/trunk/test/Archives/Archive313.nc
   issm/trunk/test/Archives/Archive314.nc
   issm/trunk/test/Archives/Archive315.nc
   issm/trunk/test/Archives/Archive316.nc
   issm/trunk/test/Archives/Archive317.nc
   issm/trunk/test/Archives/Archive318.nc
   issm/trunk/test/Archives/Archive323.nc
   issm/trunk/test/Archives/Archive324.nc
   issm/trunk/test/Archives/Archive325.nc
   issm/trunk/test/Archives/Archive326.nc
   issm/trunk/test/Archives/Archive327.nc
   issm/trunk/test/Archives/Archive329.nc
   issm/trunk/test/Archives/Archive406.nc
   issm/trunk/test/Archives/Archive407.nc
   issm/trunk/test/Archives/Archive408.nc
   issm/trunk/test/Archives/Archive409.nc
   issm/trunk/test/Archives/Archive410.nc
   issm/trunk/test/Archives/Archive411.nc
   issm/trunk/test/Archives/Archive415.nc
   issm/trunk/test/Archives/Archive416.nc
   issm/trunk/test/Archives/Archive426.nc
   issm/trunk/test/Archives/Archive427.nc
   issm/trunk/test/Archives/Archive431.nc
   issm/trunk/test/Archives/Archive432.nc
   issm/trunk/test/Archives/Archive436.nc
   issm/trunk/test/Archives/Archive437.nc
   issm/trunk/test/Archives/Archive438.nc
   issm/trunk/test/Archives/Archive439.nc
   issm/trunk/test/Archives/Archive455.nc
   issm/trunk/test/Archives/Archive505.nc
   issm/trunk/test/Archives/Archive506.nc
   issm/trunk/test/Archives/Archive507.nc
   issm/trunk/test/Archives/Archive508.nc
   issm/trunk/test/Archives/Archive509.nc
   issm/trunk/test/Archives/Archive510.nc
   issm/trunk/test/Archives/Archive513.nc
   issm/trunk/test/Archives/Archive515.nc
   issm/trunk/test/Archives/Archive516.nc
   issm/trunk/test/Archives/Archive802.nc
   issm/trunk/test/Archives/Archive803.nc
   issm/trunk/test/Archives/Archive804.nc
   issm/trunk/test/Archives/Archive805.nc
   issm/trunk/test/Archives/Archive806.nc
   issm/trunk/test/Data/delta18o.data
   issm/trunk/test/NightlyRun/IdFromString.m
   issm/trunk/test/NightlyRun/runme.m
   issm/trunk/test/NightlyRun/runme.py
   issm/trunk/test/NightlyRun/test109.m
   issm/trunk/test/NightlyRun/test109.py
   issm/trunk/test/NightlyRun/test120.m
   issm/trunk/test/NightlyRun/test1201.m
   issm/trunk/test/NightlyRun/test1201.py
   issm/trunk/test/NightlyRun/test121.m
   issm/trunk/test/NightlyRun/test121.py
   issm/trunk/test/NightlyRun/test124.m
   issm/trunk/test/NightlyRun/test1501.m
   issm/trunk/test/NightlyRun/test1501.py
   issm/trunk/test/NightlyRun/test1502.m
   issm/trunk/test/NightlyRun/test1502.py
   issm/trunk/test/NightlyRun/test2001.py
   issm/trunk/test/NightlyRun/test207.m
   issm/trunk/test/NightlyRun/test207.py
   issm/trunk/test/NightlyRun/test208.m
   issm/trunk/test/NightlyRun/test208.py
   issm/trunk/test/NightlyRun/test210.m
   issm/trunk/test/NightlyRun/test211.m
   issm/trunk/test/NightlyRun/test215.m
   issm/trunk/test/NightlyRun/test215.py
   issm/trunk/test/NightlyRun/test218.m
   issm/trunk/test/NightlyRun/test226.m
   issm/trunk/test/NightlyRun/test226.py
   issm/trunk/test/NightlyRun/test227.m
   issm/trunk/test/NightlyRun/test227.py
   issm/trunk/test/NightlyRun/test228.m
   issm/trunk/test/NightlyRun/test228.py
   issm/trunk/test/NightlyRun/test229.m
   issm/trunk/test/NightlyRun/test229.py
   issm/trunk/test/NightlyRun/test230.m
   issm/trunk/test/NightlyRun/test230.py
   issm/trunk/test/NightlyRun/test231.m
   issm/trunk/test/NightlyRun/test231.py
   issm/trunk/test/NightlyRun/test232.m
   issm/trunk/test/NightlyRun/test232.py
   issm/trunk/test/NightlyRun/test233.m
   issm/trunk/test/NightlyRun/test233.py
   issm/trunk/test/NightlyRun/test234.m
   issm/trunk/test/NightlyRun/test235.m
   issm/trunk/test/NightlyRun/test236.m
   issm/trunk/test/NightlyRun/test236.py
   issm/trunk/test/NightlyRun/test237.m
   issm/trunk/test/NightlyRun/test237.py
   issm/trunk/test/NightlyRun/test238.m
   issm/trunk/test/NightlyRun/test239.m
   issm/trunk/test/NightlyRun/test272.m
   issm/trunk/test/NightlyRun/test272.py
   issm/trunk/test/NightlyRun/test275.m
   issm/trunk/test/NightlyRun/test275.py
   issm/trunk/test/NightlyRun/test3001.py
   issm/trunk/test/NightlyRun/test3002.py
   issm/trunk/test/NightlyRun/test3003.py
   issm/trunk/test/NightlyRun/test3004.py
   issm/trunk/test/NightlyRun/test3005.py
   issm/trunk/test/NightlyRun/test3006.py
   issm/trunk/test/NightlyRun/test3007.py
   issm/trunk/test/NightlyRun/test3008.py
   issm/trunk/test/NightlyRun/test3009.m
   issm/trunk/test/NightlyRun/test3009.py
   issm/trunk/test/NightlyRun/test3010.py
   issm/trunk/test/NightlyRun/test3015.py
   issm/trunk/test/NightlyRun/test3019.m
   issm/trunk/test/NightlyRun/test3019.py
   issm/trunk/test/NightlyRun/test3020.py
   issm/trunk/test/NightlyRun/test3101.py
   issm/trunk/test/NightlyRun/test3102.py
   issm/trunk/test/NightlyRun/test3103.py
   issm/trunk/test/NightlyRun/test3104.py
   issm/trunk/test/NightlyRun/test3105.py
   issm/trunk/test/NightlyRun/test3106.py
   issm/trunk/test/NightlyRun/test3107.py
   issm/trunk/test/NightlyRun/test3108.py
   issm/trunk/test/NightlyRun/test3109.m
   issm/trunk/test/NightlyRun/test3109.py
   issm/trunk/test/NightlyRun/test3110.py
   issm/trunk/test/NightlyRun/test3119.m
   issm/trunk/test/NightlyRun/test3119.py
   issm/trunk/test/NightlyRun/test313.m
   issm/trunk/test/NightlyRun/test313.py
   issm/trunk/test/NightlyRun/test314.m
   issm/trunk/test/NightlyRun/test314.py
   issm/trunk/test/NightlyRun/test315.m
   issm/trunk/test/NightlyRun/test315.py
   issm/trunk/test/NightlyRun/test317.m
   issm/trunk/test/NightlyRun/test317.py
   issm/trunk/test/NightlyRun/test318.m
   issm/trunk/test/NightlyRun/test318.py
   issm/trunk/test/NightlyRun/test323.m
   issm/trunk/test/NightlyRun/test323.py
   issm/trunk/test/NightlyRun/test324.m
   issm/trunk/test/NightlyRun/test324.py
   issm/trunk/test/NightlyRun/test326.m
   issm/trunk/test/NightlyRun/test326.py
   issm/trunk/test/NightlyRun/test328.m
   issm/trunk/test/NightlyRun/test328.py
   issm/trunk/test/NightlyRun/test329.m
   issm/trunk/test/NightlyRun/test329.py
   issm/trunk/test/NightlyRun/test333.m
   issm/trunk/test/NightlyRun/test333.py
   issm/trunk/test/NightlyRun/test334.m
   issm/trunk/test/NightlyRun/test335.m
   issm/trunk/test/NightlyRun/test336.m
   issm/trunk/test/NightlyRun/test336.py
   issm/trunk/test/NightlyRun/test337.m
   issm/trunk/test/NightlyRun/test337.py
   issm/trunk/test/NightlyRun/test338.m
   issm/trunk/test/NightlyRun/test338.py
   issm/trunk/test/NightlyRun/test339.m
   issm/trunk/test/NightlyRun/test339.py
   issm/trunk/test/NightlyRun/test341.m
   issm/trunk/test/NightlyRun/test4001.m
   issm/trunk/test/NightlyRun/test403.m
   issm/trunk/test/NightlyRun/test403.py
   issm/trunk/test/NightlyRun/test404.m
   issm/trunk/test/NightlyRun/test404.py
   issm/trunk/test/NightlyRun/test407.m
   issm/trunk/test/NightlyRun/test407.py
   issm/trunk/test/NightlyRun/test408.m
   issm/trunk/test/NightlyRun/test408.py
   issm/trunk/test/NightlyRun/test409.m
   issm/trunk/test/NightlyRun/test409.py
   issm/trunk/test/NightlyRun/test410.m
   issm/trunk/test/NightlyRun/test410.py
   issm/trunk/test/NightlyRun/test412.m
   issm/trunk/test/NightlyRun/test413.m
   issm/trunk/test/NightlyRun/test414.m
   issm/trunk/test/NightlyRun/test417.m
   issm/trunk/test/NightlyRun/test420.m
   issm/trunk/test/NightlyRun/test422.m
   issm/trunk/test/NightlyRun/test422.py
   issm/trunk/test/NightlyRun/test423.m
   issm/trunk/test/NightlyRun/test423.py
   issm/trunk/test/NightlyRun/test424.m
   issm/trunk/test/NightlyRun/test424.py
   issm/trunk/test/NightlyRun/test425.m
   issm/trunk/test/NightlyRun/test425.py
   issm/trunk/test/NightlyRun/test426.m
   issm/trunk/test/NightlyRun/test426.py
   issm/trunk/test/NightlyRun/test427.m
   issm/trunk/test/NightlyRun/test427.py
   issm/trunk/test/NightlyRun/test431.m
   issm/trunk/test/NightlyRun/test431.py
   issm/trunk/test/NightlyRun/test432.m
   issm/trunk/test/NightlyRun/test432.py
   issm/trunk/test/NightlyRun/test433.m
   issm/trunk/test/NightlyRun/test433.py
   issm/trunk/test/NightlyRun/test435.m
   issm/trunk/test/NightlyRun/test437.m
   issm/trunk/test/NightlyRun/test438.m
   issm/trunk/test/NightlyRun/test439.m
   issm/trunk/test/NightlyRun/test455.m
   issm/trunk/test/NightlyRun/test455.py
   issm/trunk/test/NightlyRun/test505.py
   issm/trunk/test/NightlyRun/test513.m
   issm/trunk/test/NightlyRun/test513.py
   issm/trunk/test/NightlyRun/test515.m
   issm/trunk/test/NightlyRun/test515.py
   issm/trunk/test/NightlyRun/test701.m
   issm/trunk/test/NightlyRun/test703.m
   issm/trunk/test/NightlyRun/test801.m
   issm/trunk/test/NightlyRun/test801.py
   issm/trunk/test/NightlyRun/test802.m
   issm/trunk/test/NightlyRun/test802.py
   issm/trunk/test/NightlyRun/test803.m
   issm/trunk/test/NightlyRun/test803.py
   issm/trunk/test/NightlyRun/test804.m
   issm/trunk/test/NightlyRun/test804.py
   issm/trunk/test/NightlyRun/test805.m
   issm/trunk/test/NightlyRun/test805.py
   issm/trunk/test/NightlyRun/test806.m
   issm/trunk/test/NightlyRun/test806.py
   issm/trunk/test/NightlyRun/test807.m
   issm/trunk/test/NightlyRun/test807.py
   issm/trunk/test/Par/79North.par
   issm/trunk/test/Par/79North.py
   issm/trunk/test/Par/RoundSheetEISMINT.par
   issm/trunk/test/Par/RoundSheetEISMINT.py
   issm/trunk/test/Par/RoundSheetShelf.par
   issm/trunk/test/Par/RoundSheetShelf.py
   issm/trunk/test/Par/RoundSheetStaticEISMINT.par
   issm/trunk/test/Par/RoundSheetStaticEISMINT.py
   issm/trunk/test/Par/SquareEISMINT.par
   issm/trunk/test/Par/SquareEISMINT.py
   issm/trunk/test/Par/SquareSheetConstrained.par
   issm/trunk/test/Par/SquareSheetConstrained.py
   issm/trunk/test/Par/SquareSheetShelf.par
   issm/trunk/test/Par/SquareSheetShelf.py
   issm/trunk/test/Par/SquareShelfConstrained.par
   issm/trunk/test/Par/SquareShelfConstrained.py
   issm/trunk/test/Par/SquareThermal.par
   issm/trunk/test/Par/SquareThermal.py
   issm/trunk/test/Par/ValleyGlacierShelf.par
   issm/trunk/test/Par/ValleyGlacierShelf.py
Log:
merged trunk-jpl and trunk for revision 20497


Property changes on: issm/trunk
___________________________________________________________________
Modified: svn:ignore
   - build-fw
build-ad
nightlylog
configure.sh
par
ad
proj-*
projects
autom4te.cache
aclocal.m4
bin
config.log
config.h
config.h.in
config.status
configure
ISSM.paf
ISSM.ppf
ISSM.ppf_cache
libtool
Makefile
Makefile.in
stamp-h1
svn-commit*

   + build-js
build-esmf
build-gcm
build-fw
build-ad
nightlylog
configure.sh
par
ad
proj-*
projects
autom4te.cache
aclocal.m4
bin
config.log
config.h
config.h.in
config.status
configure
ISSM.paf
ISSM.ppf
ISSM.ppf_cache
libtool
Makefile
Makefile.in
stamp-h1
svn-commit*

Modified: svn:mergeinfo
   - /issm/trunk-jpl:10936-11994,11996-12326,12333-12336,12338-12703,12705-12707,12710-13393,13396-13974,13976-14066,14068-14308,14311-15394,15397-16135,16138-16554,16561,16565-17804,17807-17986,17990-18299,18302-19103
   + /issm/trunk-jpl:10936-11994,11996-12326,12333-12336,12338-12703,12705-12707,12710-13393,13396-13974,13976-14066,14068-14308,14311-15394,15397-16135,16138-16554,16561,16565-17804,17807-17986,17990-18299,18302-20496

Modified: issm/trunk/configure.ac
===================================================================
--- issm/trunk/configure.ac	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/configure.ac	2016-04-13 04:32:01 UTC (rev 20500)
@@ -1,7 +1,7 @@
 # Process this file with autoconf to produce a configure script.
 
 #AUTOCONF
-AC_INIT([Ice Sheet System Model (ISSM)],[4.9],[issm at jpl.nasa.gov],[issm],[http://issm.jpl.nasa.gov]) #Initializing configure
+AC_INIT([Ice Sheet System Model (ISSM)],[4.10],[issm at jpl.nasa.gov],[issm],[http://issm.jpl.nasa.gov]) #Initializing configure
 AC_CONFIG_AUX_DIR([./aux-config])         #Put config files in aux-config
 AC_CONFIG_MACRO_DIR([m4])                 #m4 macros are located in m4
 m4_include([m4/issm_options.m4])
@@ -10,9 +10,9 @@
 AC_CANONICAL_TARGET
 
 #Compilers
-AC_PROG_CC([icc cccl cl icl gcc])
+AC_PROG_CC([icc cl icl gcc])
 AC_PROG_CPP
-AC_PROG_CXX([icpc cccl cl icl g++])
+AC_PROG_CXX([icpc cl icl g++])
 AC_PROG_F77([ifort g77 gfortran])
 
 #AUTOMAKE
@@ -36,6 +36,7 @@
 					  src/wrappers/Makefile
 					  src/wrappers/python/Makefile
 					  src/wrappers/matlab/Makefile
+					  src/wrappers/javascript/Makefile
 					  src/mobile/Makefile
 					  src/mobile/native/Makefile
 					  src/m/Makefile

Modified: issm/trunk/etc/environment.csh
===================================================================
--- issm/trunk/etc/environment.csh	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/etc/environment.csh	2016-04-13 04:32:01 UTC (rev 20500)
@@ -108,3 +108,9 @@
 if (-d $SHELL2JUNIT_DIR) then
 	setenv PATH {$SHELL2JUNIT_DIR}/install:{$PATH}
 endif
+
+#GMT
+set GMT_DIR="$ISSM_DIR/externalpackages/gmt"
+if (-d $GMT_DIR) then
+	setenv PATH {$GMT_DIR}/install/bin/:{$PATH}
+endif

Modified: issm/trunk/etc/environment.sh
===================================================================
--- issm/trunk/etc/environment.sh	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/etc/environment.sh	2016-04-13 04:32:01 UTC (rev 20500)
@@ -95,8 +95,10 @@
 export MPI_INC_DIR="$MPI_DIR/include"
 
 PETSC_DIR="$ISSM_DIR/externalpackages/petsc/install"
-export PETSC_DIR
-libpathappend "$PETSC_DIR/lib"
+if [ -d "$PETSC_DIR" ]; then
+	export PETSC_DIR
+	libpathappend "$PETSC_DIR/lib"
+fi
 
 SLEPC_DIR="$ISSM_DIR/externalpackages/slepc/install"
 libpathappend "$SLEPC_DIR/lib"
@@ -281,6 +283,9 @@
 pathprepend   "$SVN_DIR/bin"
 libpathappend "$SVN_DIR/lib"
 
+CVS_DIR="$ISSM_DIR/externalpackages/cvs/install"
+pathprepend   "$CVS_DIR/bin"
+
 APR_DIR="$ISSM_DIR/externalpackages/apr/install"
 pathappend    "$APR_DIR/bin"
 libpathappend "$APR_DIR/lib"
@@ -312,7 +317,13 @@
 libpathprepend   "$ISSM_DIR/externalpackages/expat/install"
 dylibpathprepend   "$ISSM_DIR/externalpackages/expat/install"
 
+#GMSH
+pathappend   "$ISSM_DIR/externalpackages/gmsh/install"
+
 #CURL
 libpathprepend   "$ISSM_DIR/externalpackages/curl/install/lib"
 dylibpathprepend   "$ISSM_DIR/externalpackages/curl/install/lib"
 pathprepend "$ISSM_DIR/externalpackages/curl/install/bin"
+
+#GMT
+pathprepend "$ISSM_DIR/externalpackages/gmt/install/bin"

Modified: issm/trunk/examples/Greenland/CheatSheet.m
===================================================================
--- issm/trunk/examples/Greenland/CheatSheet.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/examples/Greenland/CheatSheet.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -9,7 +9,7 @@
 
 	%Save surface mass balance, by looping through 200 years, or 1000 steps
 	surfmb=[]; for i=1:1000; surfmb=[surfmb ...
-		md.results.TransientSolution(i).SurfaceforcingsMassBalance]; end
+		md.results.TransientSolution(i).SmbMassBalance]; end
 
 	%Plot surface mass balance time series in first subplot
 	subplot(3,1,1); plot([0.2:0.2:200],mean(surfmb));

Modified: issm/trunk/examples/Greenland/Greenland.par
===================================================================
--- issm/trunk/examples/Greenland/Greenland.par	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/examples/Greenland/Greenland.par	2016-04-13 04:32:01 UTC (rev 20500)
@@ -39,8 +39,8 @@
 md.initialization.temperature=InterpFromGridToMesh(x1,y1,temp,md.mesh.x,md.mesh.y,0)+273.15;
 
 disp('   Interpolating surface mass balance');
-md.surfaceforcings.mass_balance=InterpFromGridToMesh(x1,y1,smb,md.mesh.x,md.mesh.y,0);
-md.surfaceforcings.mass_balance=md.surfaceforcings.mass_balance*md.materials.rho_water/md.materials.rho_ice;
+md.smb.mass_balance=InterpFromGridToMesh(x1,y1,smb,md.mesh.x,md.mesh.y,0);
+md.smb.mass_balance=md.smb.mass_balance*md.materials.rho_water/md.materials.rho_ice;
 
 disp('   Construct basal friction parameters');
 md.friction.coefficient=30*ones(md.mesh.numberofvertices,1);

Modified: issm/trunk/examples/Greenland/runme.m
===================================================================
--- issm/trunk/examples/Greenland/runme.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/examples/Greenland/runme.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -1,5 +1,5 @@
 clear all;
-steps=[1];
+steps=[1 2 3 4 5];
 
 %Location of SeaRISE dataset
 ncdata='../Data/Greenland_5km_dev1.2.nc';
@@ -91,7 +91,7 @@
 	smb = InterpFromGridToMesh(x1,y1,smb',md.mesh.x,md.mesh.y,0);
 	smb = smb*md.materials.rho_freshwater/md.materials.rho_ice;
 	smb = [smb smb smb-1.0];
-	md.surfaceforcings.mass_balance = [smb;1 10 20];
+	md.smb.mass_balance = [smb;1 10 20];
 
 	%Set transient options, run for 20 years, saving every timestep
 	md.timestepping.time_step=0.2;
@@ -101,7 +101,7 @@
 	%Additional options
 	md.inversion.iscontrol=0;
 	md.transient.requested_outputs={'IceVolume','TotalSmb', ...
-		                             'SurfaceforcingsMassBalance'};
+		                             'SmbMassBalance'};
 	md.verbose=verbose('solution',true,'module',true,'convergence',true);
 
 	%Go solve
@@ -116,21 +116,14 @@
 	md = loadmodel('./Models/Greenland.Transient');
 
 	%Planview plots
-	plotmodel(md,'data',md.results.TransientSolution(end).Vel,'caxis',[1e-1 6000],...
-		'log', 10, 'title', 'Velocity (m/y)','gridded',1, ...
-		'data', md.results.TransientSolution(1).SurfaceforcingsMassBalance, ...
-		'title', 'Surface mass balance (m/y)', 'gridded',1,...
-		'data',md.results.TransientSolution(end).Thickness,...
-		'title','Thickness (m)', 'gridded',1, ...
-		'data',md.results.TransientSolution(end).Surface, ...
-		'title', 'Surface (m)', 'gridded',1);
+	plotmodel(md,'data',md.results.TransientSolution(end).Vel,'caxis',[1e-1 6000],'log', 10, 'title', 'Velocity (m/y)','gridded',11);
 
 	%Line Plots
 	figure
 
 	%Plot surface mass balance
 	surfmb=[]; for i=1:100; surfmb=[surfmb ...
-		md.results.TransientSolution(i).SurfaceforcingsMassBalance]; end
+		md.results.TransientSolution(i).SmbMassBalance]; end
 	subplot(3,1,1); plot([0.2:0.2:20],mean(surfmb)); title('Mean Surface mass balance');
 
 	%Plot velocity
@@ -187,7 +180,7 @@
 	index = BamgTriangulate(x1(:),y1(:));
 	smb_mo = InterpFromMeshToMesh2d(index,x1(:),y1(:),smbmean(:),xi,yi);
 	smb = smb_mo*12/1000*md.materials.rho_freshwater/md.materials.rho_ice;
-	md.surfaceforcings.mass_balance = [smb;1 ];
+	md.smb.mass_balance = [smb;1 ];
 
 	%Set transient options, run for 20 years, saving every timestep
 	md.timestepping.time_step=0.2;
@@ -197,7 +190,7 @@
 	%Additional options
 	md.inversion.iscontrol=0;
 	md.transient.requested_outputs={'IceVolume','TotalSmb', ...
-		'SurfaceforcingsMassBalance'};
+		'SmbMassBalance'};
 	md.verbose=verbose('solution',true,'module',true);
 
 	%Go solve
@@ -278,7 +271,7 @@
 			smb(:,(year-years_of_simulation(1))*12+month) = smb_mo;
 		end
 	end
-	md.surfaceforcings.mass_balance = ...
+	md.smb.mass_balance = ...
 		[smb*12/1000*md.materials.rho_freshwater/md.materials.rho_ice; ...
 		[1/24:1/12:length(years_of_simulation)]];
 
@@ -290,7 +283,7 @@
 	%Additional options
 	md.inversion.iscontrol=0;
 	md.transient.requested_outputs={'IceVolume','TotalSmb', ...
-		'SurfaceforcingsMassBalance'};
+		'SmbMassBalance'};
 	md.verbose=verbose('solution',true,'module',true);
 
 	%Go solve

Modified: issm/trunk/examples/Pig/Pig.par
===================================================================
--- issm/trunk/examples/Pig/Pig.par	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/examples/Pig/Pig.par	2016-04-13 04:32:01 UTC (rev 20500)
@@ -98,8 +98,8 @@
 
 %Forcings
 disp('   Interpolating surface mass balance');
-md.surfaceforcings.mass_balance=InterpFromGridToMesh(x1,y1,smb,md.mesh.x,md.mesh.y,0);
-md.surfaceforcings.mass_balance=md.surfaceforcings.mass_balance*md.materials.rho_water/md.materials.rho_ice;
+md.smb.mass_balance=InterpFromGridToMesh(x1,y1,smb,md.mesh.x,md.mesh.y,0);
+md.smb.mass_balance=md.smb.mass_balance*md.materials.rho_water/md.materials.rho_ice;
 clear smb;
 
 disp('   Set geothermal heat flux');

Modified: issm/trunk/externalpackages/adolc/install-withampi-macosx64.sh
===================================================================
--- issm/trunk/externalpackages/adolc/install-withampi-macosx64.sh	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/externalpackages/adolc/install-withampi-macosx64.sh	2016-04-13 04:32:01 UTC (rev 20500)
@@ -4,7 +4,8 @@
 #Some cleanup
 rm -rf install src
 
-git clone -b ampi git://git.mcs.anl.gov/adol-c.git src
+git clone https://gitlab.com/adol-c/adol-c.git src
+#git clone -b ampi git://git.mcs.anl.gov/adol-c.git src
 #git reset --hard b254b2a001a1b7a024a9184cd087ae06eb975cad
 
 #Compile ADOL-C

Modified: issm/trunk/externalpackages/adolc/install-withampi.sh
===================================================================
--- issm/trunk/externalpackages/adolc/install-withampi.sh	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/externalpackages/adolc/install-withampi.sh	2016-04-13 04:32:01 UTC (rev 20500)
@@ -4,7 +4,7 @@
 #Some cleanup
 rm -rf install src
 
-git clone -b ampi git://git.mcs.anl.gov/adol-c.git src
+git clone https://gitlab.com/adol-c/adol-c.git src
 #git reset --hard b254b2a001a1b7a024a9184cd087ae06eb975cad
 
 #Compile ADOL-C

Modified: issm/trunk/externalpackages/adolc/install.sh
===================================================================
--- issm/trunk/externalpackages/adolc/install.sh	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/externalpackages/adolc/install.sh	2016-04-13 04:32:01 UTC (rev 20500)
@@ -4,7 +4,7 @@
 #Some cleanup
 rm -rf install src
 
-git clone -b ampi git://git.mcs.anl.gov/adol-c.git src
+git clone https://gitlab.com/adol-c/adol-c.git src
 #git reset --hard b254b2a001a1b7a024a9184cd087ae06eb975cad
 
 #Compile ADOL-C

Modified: issm/trunk/externalpackages/autotools/install-win.sh
===================================================================
--- issm/trunk/externalpackages/autotools/install-win.sh	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/externalpackages/autotools/install-win.sh	2016-04-13 04:32:01 UTC (rev 20500)
@@ -9,9 +9,9 @@
 #install autoconf
 echo " === INSTALLING AUTOCONF =="
 rm -rf src
-$ISSM_DIR/scripts/DownloadExternalPackage.py 'http://issm.jpl.nasa.gov/files/externalpackages/autoconf-2.68.tar.gz' 'autoconf-2.68.tar.gz'
-tar -zxvf autoconf-2.68.tar.gz
-mv autoconf-2.68 src
+$ISSM_DIR/scripts/DownloadExternalPackage.py 'http://issm.jpl.nasa.gov/files/externalpackages/autoconf-2.69.tar.gz' 'autoconf-2.69.tar.gz'
+tar -zxvf autoconf-2.69.tar.gz
+mv autoconf-2.69 src
 cd src 
 ./configure --prefix="$ISSM_DIR/externalpackages/autotools/install" 
 make  
@@ -21,9 +21,9 @@
 #install automake
 echo " === INSTALLING AUTOMAKE =="
 rm -rf src
-$ISSM_DIR/scripts/DownloadExternalPackage.py 'http://issm.jpl.nasa.gov/files/externalpackages/automake-1.11.3.tar.gz' 'automake-1.11.3.tar.gz'
-tar -zxvf  automake-1.11.3.tar.gz
-mv automake-1.11.3 src
+$ISSM_DIR/scripts/DownloadExternalPackage.py 'http://issm.jpl.nasa.gov/files/externalpackages/automake-1.14.tar.gz' 'automake-1.14.tar.gz'
+tar -zxvf  automake-1.14.tar.gz
+mv automake-1.14 src
 cd src 
 ./configure --prefix="$ISSM_DIR/externalpackages/autotools/install" 
 make  
@@ -43,4 +43,11 @@
 make install
 cd ..
 
+# This patch takes care of removing options passed to the linker that casuse 
+# the build to fail, as well as changing some flags to match up to Microsoft
+# compilers.
 patch ./install/share/aclocal/libtool.m4 < ./patches/libtool.m4.patch
+
+# Small change to Automake in order to get the right flags for Microsoft's
+# compiler.
+patch ./install/bin/automake < ./patches/automake.patch

Modified: issm/trunk/externalpackages/autotools/patches/libtool.m4.patch
===================================================================
--- issm/trunk/externalpackages/autotools/patches/libtool.m4.patch	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/externalpackages/autotools/patches/libtool.m4.patch	2016-04-13 04:32:01 UTC (rev 20500)
@@ -1,11 +1,29 @@
---- m4/libtool.m4	2013-06-19 22:19:27.313488900 -0700
-+++ m4/libtool.m4.bak	2013-06-18 18:45:55.766285300 -0700
+--- ./install/share/aclocal/libtool.m4	2015-09-25 15:51:40.870862200 -0700
++++ /home/daeden/tmp/libtool.m4	2015-09-25 15:42:15.385935100 -0700
+@@ -2382,7 +2382,7 @@
+     # Native MSVC
+     libname_spec='$name'
+     soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
+-    library_names_spec='${libname}.dll.lib'
++    library_names_spec='${libname}${shrext_cmds}'
+ 
+     case $build_os in
+     mingw*)
+@@ -3142,7 +3142,7 @@
+ case $host_os in
+   cygwin* | mingw* | pw32* | cegcc*)
+     if test "$GCC" != yes; then
+-      reload_cmds=false
++      reload_cmds='lib /OUT:$output$reload_objs'
+     fi
+     ;;
+   darwin*)
 @@ -4752,7 +4752,7 @@
        _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname']
  
        if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then
 -        _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
-+        _LT_TAGVAR(archive_cmds, $1)='$CC /LD $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib '
++        _LT_TAGVAR(archive_cmds, $1)='$CC /LD $libobjs $deplibs $compiler_flags /OUT:$output_objdir/$soname '
  	# If the export-symbols file already is a .def file (1st line
  	# is EXPORTS), use it as is; otherwise, prepend...
  	_LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
@@ -14,16 +32,34 @@
  	  cat $export_symbols >> $output_objdir/$soname.def;
  	fi~
 -	$CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
-+	$CC /LD $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib '
++	$CC /LD $output_objdir/$soname.def $libobjs $deplibs $compiler_flags /OUT:$output_objdir/$soname '
        else
  	_LT_TAGVAR(ld_shlibs, $1)=no
        fi
+@@ -5136,7 +5136,7 @@
+ 	  else
+ 	    sed -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp;
+ 	  fi~
+-	  $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~
++	  $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs~
+ 	  linknames='
+ 	# The linker will not automatically build a static lib if we build a DLL.
+ 	# _LT_TAGVAR(old_archive_from_new_cmds, $1)='true'
+@@ -6135,7 +6135,7 @@
+ 	    else
+ 	      $SED -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp;
+ 	    fi~
+-	    $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~
++	    $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs~
+ 	    linknames='
+ 	  # The linker will not automatically build a static lib if we build a DLL.
+ 	  # _LT_TAGVAR(old_archive_from_new_cmds, $1)='true'
 @@ -6168,7 +6168,7 @@
  	  _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
  
  	  if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then
 -	    _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
-+	    _LT_TAGVAR(archive_cmds, $1)='$CC /LD -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib '
++	    _LT_TAGVAR(archive_cmds, $1)='$CC /LD -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags /OUT:$output_objdir/$soname '
  	    # If the export-symbols file already is a .def file (1st line
  	    # is EXPORTS), use it as is; otherwise, prepend...
  	    _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
@@ -32,7 +68,7 @@
  	      cat $export_symbols >> $output_objdir/$soname.def;
  	    fi~
 -	    $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
-+	    $CC /LD -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib '
++	    $CC /LD -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags /OUT:$output_objdir/$soname '
  	  else
  	    _LT_TAGVAR(ld_shlibs, $1)=no
  	  fi

Modified: issm/trunk/externalpackages/boost/install-1.49-linux.sh
===================================================================
--- issm/trunk/externalpackages/boost/install-1.49-linux.sh	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/externalpackages/boost/install-1.49-linux.sh	2016-04-13 04:32:01 UTC (rev 20500)
@@ -24,7 +24,7 @@
 cd src 
 ./bootstrap.sh \
 	--prefix="$ISSM_DIR/externalpackages/boost/install" \
-	--with-python=python3.2 \
+	--with-python=python2.7 \
 	--with-python-root="$ISSM_DIR/externalpackages/python/install" 
 
 #Compile boost

Modified: issm/trunk/externalpackages/cmake/install.sh
===================================================================
--- issm/trunk/externalpackages/cmake/install.sh	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/externalpackages/cmake/install.sh	2016-04-13 04:32:01 UTC (rev 20500)
@@ -1,19 +1,20 @@
 #!/bin/bash
 set -eu 
+VER="3.3.1"
 
 #Some cleanup
-rm -rf install cmake-2.8.11.2
+rm -rf install cmake-$VER
 mkdir install
 
 #Download from ISSM server
-$ISSM_DIR/scripts/DownloadExternalPackage.py 'http://issm.jpl.nasa.gov/files/externalpackages/cmake-2.8.11.2.tar.gz' 'cmake-2.8.11.2.tar.gz'
+$ISSM_DIR/scripts/DownloadExternalPackage.py "http://issm.jpl.nasa.gov/files/externalpackages/cmake-$VER.tar.gz" "cmake-$VER.tar.gz"
 
 #Untar 
-tar -zxvf  cmake-2.8.11.2.tar.gz
+tar -zxvf  cmake-$VER.tar.gz
 
 #Move cmake into install directory
-mv cmake-2.8.11.2/* install
-rm -rf cmake-2.8.11.2
+mv cmake-$VER/* install
+rm -rf cmake-$VER
 
 #Compile cmake
 cd install 

Modified: issm/trunk/externalpackages/dakota/configs/5.3.1/CMakeLists.txt.pfe.patch
===================================================================
--- issm/trunk/externalpackages/dakota/configs/5.3.1/CMakeLists.txt.pfe.patch	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/externalpackages/dakota/configs/5.3.1/CMakeLists.txt.pfe.patch	2016-04-13 04:32:01 UTC (rev 20500)
@@ -2,5 +2,5 @@
 < # TODO: Can't this be integrated into the following logic?
 ---
 > # TODO: Can't this be integrated into the following logic?
-> set(BLAS_LIBS "-L/nasa/intel/mkl/10.0.011/lib/em64t/ -lmkl -lmkl_lapack -liomp5 -lpthread")
-> set(LAPACK_LIBS "-L/nasa/intel/mkl/10.0.011/lib/em64t/ -lmkl -lmkl_lapack -liomp5 -lpthread")
+> set(BLAS_LIBS "-L/nasa/intel/Compiler/2015.0.090/composer_xe_2015.0.090/mkl/lib/intel64/ -lmkl_intel_lp64 -lmkl_sequential -lmkl_core -lpthread -lm")
+> set(LAPACK_LIBS "-L/nasa/intel/Compiler/2015.0.090/composer_xe_2015.0.090/mkl/lib/intel64/ -lmkl_intel_lp64 -lmkl_sequential -lmkl_core -lpthread -lm")

Modified: issm/trunk/externalpackages/dakota/install-5.3.1-linux64.sh
===================================================================
--- issm/trunk/externalpackages/dakota/install-5.3.1-linux64.sh	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/externalpackages/dakota/install-5.3.1-linux64.sh	2016-04-13 04:32:01 UTC (rev 20500)
@@ -24,6 +24,7 @@
 cp $DAK_SRC/cmake/BuildDakotaTemplate.cmake $DAK_SRC/cmake/BuildDakotaCustom.cmake
 patch $DAK_SRC/cmake/BuildDakotaCustom.cmake configs/5.3.1/BuildDakotaCustom.cmake.patch
 patch $DAK_SRC/cmake/DakotaDev.cmake configs/5.3.1/DakotaDev.cmake.patch
+#patch $DAK_SRC/CMakeLists.txt configs/5.3.1/CMakeLists.txt.patch
 
 #Apply patches
 patch src/src/ParallelLibrary.cpp configs/5.3.1/ParallelLibrary.cpp.patch

Modified: issm/trunk/externalpackages/dakota/install-5.3.1-pleiades.sh
===================================================================
--- issm/trunk/externalpackages/dakota/install-5.3.1-pleiades.sh	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/externalpackages/dakota/install-5.3.1-pleiades.sh	2016-04-13 04:32:01 UTC (rev 20500)
@@ -22,7 +22,7 @@
 export DAK_SRC=$ISSM_DIR/externalpackages/dakota/src
 export DAK_BUILD=$ISSM_DIR/externalpackages/dakota/build
 cp $DAK_SRC/cmake/BuildDakotaTemplate.cmake $DAK_SRC/cmake/BuildDakotaCustom.cmake
-patch $DAK_SRC/cmake/BuildDakotaCustom.cmake configs/5.3.1/BuildDakotaCustom.cmake.patch
+patch $DAK_SRC/cmake/BuildDakotaCustom.cmake configs/5.3.1/BuildDakotaCustom.cmake.pfe.patch
 patch $DAK_SRC/cmake/DakotaDev.cmake configs/5.3.1/DakotaDev.cmake.patch
 patch $DAK_SRC/CMakeLists.txt configs/5.3.1/CMakeLists.txt.pfe.patch
 

Modified: issm/trunk/externalpackages/esmf/install.sh
===================================================================
--- issm/trunk/externalpackages/esmf/install.sh	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/externalpackages/esmf/install.sh	2016-04-13 04:32:01 UTC (rev 20500)
@@ -2,22 +2,22 @@
 set -eu
 
 export ESMF_DIR=$ISSM_DIR/externalpackages/esmf/esmf
+export ESMF_INSTALL_PREFIX=$ISSM_DIR/externalpackages/esmf/install
 export ESMF_COMPILER=gfortran
 export ESMF_COMM=mpich2
 
 #Some cleanup
-rm -rf esmf_5_2_0rp2
+rm -rf esmf_6_3_0rp1
 rm -rf esmf
 
 #Download from ISSM server
-$ISSM_DIR/scripts/DownloadExternalPackage.py 'http://issm.jpl.nasa.gov/files/externalpackages/esmf_5_2_0rp2_src.tar.gz' 'esmf_5_2_0rp2_src.tar.gz'
+$ISSM_DIR/scripts/DownloadExternalPackage.py 'http://issm.jpl.nasa.gov/files/externalpackages/esmf_6_3_0rp1_src.tar.gz' 'esmf_6_3_0rp1_src.tar.gz'
 $ISSM_DIR/scripts/DownloadExternalPackage.py 'http://issm.jpl.nasa.gov/files/externalpackages/docs/ESMF_refdoc.pdf' 'ESMF_refdoc.pdf'
 $ISSM_DIR/scripts/DownloadExternalPackage.py 'http://issm.jpl.nasa.gov/files/externalpackages/docs/ESMF_usrdoc.pdf' 'ESMF_usrdoc.pdf'
 
 #Untar 
-tar -zxvf  esmf_5_2_0rp2_src.tar.gz
+tar -zxvf  esmf_6_3_0rp1_src.tar.gz
 
-
 #Configure esmf
 cd esmf
 
@@ -29,10 +29,3 @@
 	make -j $1
 	make -j $1 install
 fi
-
-cd esmf
-if [ $# -eq 0 ]; then
-	make all_tests
-else
-	make -j $1 all_tests
-fi


Property changes on: issm/trunk/externalpackages/fti
___________________________________________________________________
Added: svn:ignore
   + install
*.tgz
*.gz


Modified: issm/trunk/externalpackages/gdal/install-1.10-linux64.sh
===================================================================
--- issm/trunk/externalpackages/gdal/install-1.10-linux64.sh	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/externalpackages/gdal/install-1.10-linux64.sh	2016-04-13 04:32:01 UTC (rev 20500)
@@ -19,6 +19,9 @@
 mv gdal-1.10.0/* src
 rm -rf gdal-1.10.0
 
+export CFLAGS=-D_HAVE_STRNDUP
+export CXXFLAGS=-D_HAVE_STRNDUP
+
 #Configure gdal
 cd src
 ./configure \


Property changes on: issm/trunk/externalpackages/gmsh
___________________________________________________________________
Added: svn:ignore
   + MacOS
install
src


Modified: issm/trunk/externalpackages/gmsh/install.sh
===================================================================
--- issm/trunk/externalpackages/gmsh/install.sh	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/externalpackages/gmsh/install.sh	2016-04-13 04:32:01 UTC (rev 20500)
@@ -6,7 +6,7 @@
 mkdir install
 
 #Download latest version
-svn --username gmsh --password gmsh co https://geuz.org/svn/gmsh/trunk src
+svn co --username gmsh --password gmsh https://geuz.org/svn/gmsh/trunk src
 
 #Configure
 cd install

Modified: issm/trunk/externalpackages/gshhg/install.sh
===================================================================
--- issm/trunk/externalpackages/gshhg/install.sh	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/externalpackages/gshhg/install.sh	2016-04-13 04:32:01 UTC (rev 20500)
@@ -1,16 +1,16 @@
 #!/bin/bash
 set -eu
 
-rm -rf gssh-gmt-2.3.3.tar.gz  src install
+rm -rf gssh-gmt-2.3.4.tar.gz  src install
 
 #get gssh database from noaa's website:  http://www.ngdc.noaa.gov/mgg/shorelines/gshhs.html
-curl http://www.ngdc.noaa.gov/mgg/shorelines/data/gshhg/latest/gshhg-gmt-2.3.3.tar.gz > gshhg-gmt-2.3.3.tar.gz
+#curl http://www.ngdc.noaa.gov/mgg/shorelines/data/gshhg/latest/gshhg-gmt-2.3.4.tar.gz > gshhg-gmt-2.3.4.tar.gz
 
 #Download from ISSM server
-#$ISSM_DIR/scripts/DownloadExternalPackage.py 'http://issm.jpl.nasa.gov/files/externalpackages/gshhg-gmt-2.3.3.tar.gz' 'gshhg-gmt-2.3.3.tar.gz'
+$ISSM_DIR/scripts/DownloadExternalPackage.py 'http://issm.jpl.nasa.gov/files/externalpackages/gshhg-gmt-2.3.4.tar.gz' 'gshhg-gmt-2.3.4.tar.gz'
 
 #untar: 
-tar -zxvf gshhg-gmt-2.3.3.tar.gz 
+tar -zxvf gshhg-gmt-2.3.4.tar.gz 
 
 #move: 
-mv gshhg-gmt-2.3.3 install
+mv gshhg-gmt-2.3.4 install

Modified: issm/trunk/externalpackages/mercurial/install.sh
===================================================================
--- issm/trunk/externalpackages/mercurial/install.sh	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/externalpackages/mercurial/install.sh	2016-04-13 04:32:01 UTC (rev 20500)
@@ -18,7 +18,6 @@
 #Apply patches
 cd install 
 #patch Lib/Makefile ../lib_Makefile.patch
-exit
 
 #Compile mercurial
-make
+make local

Modified: issm/trunk/externalpackages/numpy/install-macosx-snowleopard.sh
===================================================================
--- issm/trunk/externalpackages/numpy/install-macosx-snowleopard.sh	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/externalpackages/numpy/install-macosx-snowleopard.sh	2016-04-13 04:32:01 UTC (rev 20500)
@@ -3,15 +3,23 @@
 
 rm -rf install
 
-# On OSX 10.6, gfortran gets installed in /usr/local/gfortran 
-export CC="/usr/local/gfortran/bin/gcc"
-export CXX="/usr/local/gfortran/bin/g++"
+export F77="/usr/local/gfortran/bin/x86_64-apple-darwin10-gfortran"
+export CC="/usr/bin/gcc"
+export CXX="/usr/bin/g++"
+export FFLAGS=-ff2c
 
+#clean up
+rm -rf numpy
+rm -rf numpy-1.7.0b2
+
 #download numpy first
-git clone https://github.com/numpy/numpy.git
+#export GIT_SSL_NO_VERIFY=true 
+#git clone https://github.com/numpy/numpy.git
+$ISSM_DIR/scripts/DownloadExternalPackage.py 'http://issm.jpl.nasa.gov/files/externalpackages/numpy-1.7.0b2.tar.gz' 'numpy-1.7.0b2.tar.gz'
 
 #install numpy
-cd numpy
+tar -zxvf numpy-1.7.0b2.tar.gz
+cd numpy-1.7.0b2
 python setup.py build
 python setup.py install
 cd ..

Modified: issm/trunk/externalpackages/petsc/install-3.5-win7.sh
===================================================================
--- issm/trunk/externalpackages/petsc/install-3.5-win7.sh	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/externalpackages/petsc/install-3.5-win7.sh	2016-04-13 04:32:01 UTC (rev 20500)
@@ -6,7 +6,7 @@
 mkdir install src
 
 #Download from ISSM server
-$ISSM_DIR/scripts/DownloadExternalPackage.py 'http://issm.jpl.nasa.gov/files/externalpackages/petsc-lite-3.5.3.tar.gz' 'petsc-3.5.3.tar.gz'
+#$ISSM_DIR/scripts/DownloadExternalPackage.py 'http://issm.jpl.nasa.gov/files/externalpackages/petsc-lite-3.5.3.tar.gz' 'petsc-3.5.3.tar.gz'
 
 #Untar and move petsc to install directory
 tar -zxvf  petsc-3.5.3.tar.gz

Modified: issm/trunk/externalpackages/python/install-2.7.3-macosx-snowleopard.sh
===================================================================
--- issm/trunk/externalpackages/python/install-2.7.3-macosx-snowleopard.sh	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/externalpackages/python/install-2.7.3-macosx-snowleopard.sh	2016-04-13 04:32:01 UTC (rev 20500)
@@ -21,7 +21,8 @@
 cd src 
 # --enable-framework needs to have the form "$SOME_PATH/Library/Frameworks" to avoid installing components in /Applications directory
 # --prefix is recognized as $SOME_PATH as long as this form is taken, so it's not necessary to include
-./configure --enable-framework="$ISSM_DIR/externalpackages/python/install/Library/Frameworks" 
+./configure --enable-framework="$ISSM_DIR/externalpackages/python/install/Library/Frameworks" \
+	LDFLAGS="-L/usr/local/gfortran/lib/gcc/x86_64-apple-darwin10/4.6.2/ -lgfortran "
 
 #make
 if [ $# -eq 0 ]; then

Modified: issm/trunk/externalpackages/scipy/install-macosx-snowleopard.sh
===================================================================
--- issm/trunk/externalpackages/scipy/install-macosx-snowleopard.sh	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/externalpackages/scipy/install-macosx-snowleopard.sh	2016-04-13 04:32:01 UTC (rev 20500)
@@ -2,8 +2,10 @@
 set -eu
 
 # On OSX 10.6, fgortran gets installed in /usr/local/gfortran 
-export CC="/usr/local/gfortran/bin/gcc"
-export CXX="/usr/local/gfortran/bin/g++"
+#export PATH="/usr/local/gfortran/bin/:$PATH"
+export F77="/usr/local/gfortran/bin/x86_64-apple-darwin10-gfortran"
+export CC="/usr/bin/gcc"
+export CXX="/usr/bin/g++"
 
 #download scipy
 git clone https://github.com/scipy/scipy.git


Property changes on: issm/trunk/externalpackages/triangle
___________________________________________________________________
Modified: svn:ignore
   - android-install
macosx64-install
*.zip
*.gz
*.zip
*.a
*.so
*.o
*.la
*.cmake
*.cache
*.exe
*.in
*.log
*.deps
*.metadata
install
src
CMakeCache.txt
Makefile
CMakeFiles

   + install-javascript
android-install
macosx64-install
*.zip
*.gz
*.zip
*.a
*.so
*.o
*.la
*.cmake
*.cache
*.exe
*.in
*.log
*.deps
*.metadata
install
src
CMakeCache.txt
Makefile
CMakeFiles


Modified: issm/trunk/externalpackages/triangle/install.sh
===================================================================
--- issm/trunk/externalpackages/triangle/install.sh	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/externalpackages/triangle/install.sh	2016-04-13 04:32:01 UTC (rev 20500)
@@ -18,14 +18,15 @@
 mv ./*.c ./src
 mv ./*.h ./src
 
-cp ../configs/triangle-libtool.tar.gz ./
-tar -xvf ./triangle-libtool.tar.gz
+cp ./../configs/libtool/configure.ac ./
+cp ./../configs/libtool/Makefile.am ./
+cp ./../configs/libtool/src/Makefile.am ./src/
 
 autoreconf -ivf
-./configure --prefix="${ISSM_DIR}/externalpackages/triangle/install" --disable-executables
+./configure --prefix="${HOME}/externalpackages/triangle/install" --disable-executables
 
 make 
 make install
 
 #Patch triangle.h
-patch ${ISSM_DIR}/externalpackages/triangle/install/include/triangle.h ${ISSM_DIR}/externalpackages/triangle/triangle.h.patch
+patch ${HOME}/externalpackages/triangle/install/include/triangle.h ${HOME}/externalpackages/triangle/triangle.h.patch

Modified: issm/trunk/externalpackages/valgrind/install-macosx64.sh
===================================================================
--- issm/trunk/externalpackages/valgrind/install-macosx64.sh	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/externalpackages/valgrind/install-macosx64.sh	2016-04-13 04:32:01 UTC (rev 20500)
@@ -2,21 +2,14 @@
 set -eu
 
 #Some cleanup
-rm -rf install valgrind-3.10.0
-mkdir install
+rm -rf install
 
-#Download from ISSM server
-$ISSM_DIR/scripts/DownloadExternalPackage.py 'http://issm.jpl.nasa.gov/files/externalpackages/valgrind-3.10.0.tar.bz2' 'valgrind-3.10.0.tar.bz2'
+#Download development version, the current release never supports the latest OS X releases
+svn co svn://svn.valgrind.org/valgrind/trunk install
 
-#Untar 
-tar -jxvf  valgrind-3.10.0.tar.bz2
-
-#Move valgrind into install directory
-mv valgrind-3.10.0/* install
-rm -rf valgrind-3.10.0
-
 #configure
 cd install
+./autogen.sh
 ./configure  --prefix="$ISSM_DIR/externalpackages/valgrind/install" --enable-only64bit
 
 #Compile valgrind

Modified: issm/trunk/externalpackages/vim/addons/vim/syntax/c.vim
===================================================================
--- issm/trunk/externalpackages/vim/addons/vim/syntax/c.vim	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/externalpackages/vim/addons/vim/syntax/c.vim	2016-04-13 04:32:01 UTC (rev 20500)
@@ -416,11 +416,13 @@
 syn keyword cType Contour
 syn keyword cType Contours
 syn keyword cType ControlInput
+syn keyword cType Covertree
 syn keyword cType DataSetParam
 syn keyword cType DatasetInput
 syn keyword cType Definition
 syn keyword cType DependentObject
 syn keyword cType DofIndexing
+syn keyword cType DoubleArrayInput
 syn keyword cType DoubleInput
 syn keyword cType DoubleMatArrayParam
 syn keyword cType DoubleMatParam
@@ -456,16 +458,21 @@
 syn keyword cType IntParam
 syn keyword cType IntVecParam
 syn keyword cType IoModel
+syn keyword cType IssmDirectApplicInterface
+syn keyword cType IssmParallelDirectApplicInterface
 syn keyword cType Load
 syn keyword cType Loads
+syn keyword cType Masscon
+syn keyword cType Massconaxpby
 syn keyword cType Massfluxatgate
 syn keyword cType Material
 syn keyword cType Materials
 syn keyword cType Matice
 syn keyword cType Matpar
 syn keyword cType MatrixParam
-syn keyword cType Matseaice
 syn keyword cType Misfit
+syn keyword cType Moulin
+syn keyword cType Neumannflux
 syn keyword cType Node
 syn keyword cType Nodes
 syn keyword cType Numericalflux
@@ -535,6 +542,7 @@
 syn keyword cType HydrologyDCEfficientAnalysis
 syn keyword cType HydrologyDCInefficientAnalysis
 syn keyword cType HydrologyShreveAnalysis
+syn keyword cType HydrologySommersAnalysis
 syn keyword cType L2ProjectionBaseAnalysis
 syn keyword cType L2ProjectionEPLAnalysis
 syn keyword cType LevelsetAnalysis
@@ -542,9 +550,8 @@
 syn keyword cType MasstransportAnalysis
 syn keyword cType MeltingAnalysis
 syn keyword cType MeshdeformationAnalysis
-syn keyword cType SeaiceAnalysis
-syn keyword cType SmoothedSurfaceSlopeXAnalysis
-syn keyword cType SmoothedSurfaceSlopeYAnalysis
+syn keyword cType SmbAnalysis
+syn keyword cType SmoothAnalysis
 syn keyword cType StressbalanceAnalysis
 syn keyword cType StressbalanceSIAAnalysis
 syn keyword cType StressbalanceVerticalAnalysis
@@ -552,6 +559,7 @@
 syn keyword cType UzawaPressureAnalysis
 "ISSM's objects end
 "ISSM's Enums begin
+syn keyword cConstant FemModelEnum
 syn keyword cConstant AutodiffIsautodiffEnum
 syn keyword cConstant AutodiffNumDependentsEnum
 syn keyword cConstant AutodiffNumDependentObjectsEnum
@@ -588,8 +596,12 @@
 syn keyword cConstant BasalforcingsDeepwaterMeltingRateEnum
 syn keyword cConstant BasalforcingsDeepwaterElevationEnum
 syn keyword cConstant BasalforcingsUpperwaterElevationEnum
+syn keyword cConstant BasalforcingsMeltrateFactorEnum
+syn keyword cConstant BasalforcingsThresholdThicknessEnum
+syn keyword cConstant BasalforcingsUpperdepthMeltEnum
 syn keyword cConstant FloatingMeltRateEnum
 syn keyword cConstant LinearFloatingMeltRateEnum
+syn keyword cConstant MismipFloatingMeltRateEnum
 syn keyword cConstant BedEnum
 syn keyword cConstant BaseEnum
 syn keyword cConstant ConstantsGEnum
@@ -630,12 +642,19 @@
 syn keyword cConstant FlowequationFeHOEnum
 syn keyword cConstant FlowequationFeFSEnum
 syn keyword cConstant FlowequationVertexEquationEnum
+syn keyword cConstant FrictionAsEnum
 syn keyword cConstant FrictionCoefficientEnum
+syn keyword cConstant FrictionCoefficientcoulombEnum
 syn keyword cConstant FrictionPEnum
 syn keyword cConstant FrictionQEnum
 syn keyword cConstant FrictionMEnum
 syn keyword cConstant FrictionCEnum
 syn keyword cConstant FrictionLawEnum
+syn keyword cConstant FrictionGammaEnum
+syn keyword cConstant FrictionFEnum
+syn keyword cConstant FrictionWaterLayerEnum
+syn keyword cConstant FrictionEffectivePressureEnum
+syn keyword cConstant FrictionCouplingEnum
 syn keyword cConstant GeometryHydrostaticRatioEnum
 syn keyword cConstant HydrologyModelEnum
 syn keyword cConstant HydrologyshreveEnum
@@ -650,6 +669,7 @@
 syn keyword cConstant EplHeadOldEnum
 syn keyword cConstant EplHeadSlopeXEnum
 syn keyword cConstant EplHeadSlopeYEnum
+syn keyword cConstant EplZigZagCounterEnum
 syn keyword cConstant HydrologydcMaxIterEnum
 syn keyword cConstant HydrologydcRelTolEnum
 syn keyword cConstant HydrologydcSpcsedimentHeadEnum
@@ -664,9 +684,11 @@
 syn keyword cConstant HydrologydcEplCompressibilityEnum
 syn keyword cConstant HydrologydcEplPorosityEnum
 syn keyword cConstant HydrologydcEplInitialThicknessEnum
+syn keyword cConstant HydrologydcEplColapseThicknessEnum
 syn keyword cConstant HydrologydcEplMaxThicknessEnum
 syn keyword cConstant HydrologydcEplThicknessEnum
 syn keyword cConstant HydrologydcEplThicknessOldEnum
+syn keyword cConstant HydrologydcEplThickCompEnum
 syn keyword cConstant HydrologydcEplConductivityEnum
 syn keyword cConstant HydrologydcIsefficientlayerEnum
 syn keyword cConstant HydrologydcSedimentlimitFlagEnum
@@ -675,13 +697,26 @@
 syn keyword cConstant HydrologydcLeakageFactorEnum
 syn keyword cConstant HydrologydcPenaltyFactorEnum
 syn keyword cConstant HydrologydcPenaltyLockEnum
+syn keyword cConstant HydrologydcEplflipLockEnum
 syn keyword cConstant HydrologydcBasalMoulinInputEnum
 syn keyword cConstant HydrologyLayerEnum
 syn keyword cConstant HydrologySedimentEnum
 syn keyword cConstant HydrologyEfficientEnum
 syn keyword cConstant HydrologySedimentKmaxEnum
+syn keyword cConstant HydrologysommersEnum
+syn keyword cConstant HydrologyHeadEnum
+syn keyword cConstant HydrologyGapHeightEnum
+syn keyword cConstant HydrologyBumpSpacingEnum
+syn keyword cConstant HydrologyBumpHeightEnum
+syn keyword cConstant HydrologyEnglacialInputEnum
+syn keyword cConstant HydrologyMoulinInputEnum
+syn keyword cConstant HydrologyReynoldsEnum
+syn keyword cConstant HydrologyNeumannfluxEnum
+syn keyword cConstant HydrologySpcheadEnum
+syn keyword cConstant HydrologyConductivityEnum
 syn keyword cConstant IndependentObjectEnum
 syn keyword cConstant InversionControlParametersEnum
+syn keyword cConstant InversionControlScalingFactorsEnum
 syn keyword cConstant InversionCostFunctionThresholdEnum
 syn keyword cConstant InversionCostFunctionsCoefficientsEnum
 syn keyword cConstant InversionCostFunctionsEnum
@@ -706,6 +741,7 @@
 syn keyword cConstant InversionNumCostFunctionsEnum
 syn keyword cConstant InversionStepThresholdEnum
 syn keyword cConstant InversionThicknessObsEnum
+syn keyword cConstant InversionSurfaceObsEnum
 syn keyword cConstant InversionVxObsEnum
 syn keyword cConstant InversionVyObsEnum
 syn keyword cConstant InversionVzObsEnum
@@ -731,17 +767,36 @@
 syn keyword cConstant DamageElementinterpEnum
 syn keyword cConstant DamageHealingEnum
 syn keyword cConstant DamageStressThresholdEnum
+syn keyword cConstant DamageKappaEnum
 syn keyword cConstant DamageStabilizationEnum
-syn keyword cConstant DamagePenaltyThresholdEnum
-syn keyword cConstant DamagePenaltyLockEnum
-syn keyword cConstant DamagePenaltyFactorEnum
 syn keyword cConstant DamageMaxiterEnum
 syn keyword cConstant DamageSpcdamageEnum
 syn keyword cConstant DamageMaxDamageEnum
 syn keyword cConstant DamageEquivStressEnum
 syn keyword cConstant DamageEvolutionNumRequestedOutputsEnum
 syn keyword cConstant DamageEvolutionRequestedOutputsEnum
+syn keyword cConstant DamageEnum
 syn keyword cConstant NewDamageEnum
+syn keyword cConstant StressIntensityFactorEnum
+syn keyword cConstant CalvingLawEnum
+syn keyword cConstant CalvingCalvingrateEnum
+syn keyword cConstant CalvingMeltingrateEnum
+syn keyword cConstant CalvingLevermannEnum
+syn keyword cConstant CalvingPiEnum
+syn keyword cConstant CalvingDevEnum
+syn keyword cConstant DefaultCalvingEnum
+syn keyword cConstant CalvingRequestedOutputsEnum
+syn keyword cConstant CalvinglevermannCoeffEnum
+syn keyword cConstant CalvinglevermannMeltingrateEnum
+syn keyword cConstant CalvingpiCoeffEnum
+syn keyword cConstant CalvingpiMeltingrateEnum
+syn keyword cConstant CalvingratexEnum
+syn keyword cConstant CalvingrateyEnum
+syn keyword cConstant CalvingratexAverageEnum
+syn keyword cConstant CalvingrateyAverageEnum
+syn keyword cConstant StrainRateparallelEnum
+syn keyword cConstant StrainRateperpendicularEnum
+syn keyword cConstant StrainRateeffectiveEnum
 syn keyword cConstant MaterialsRhoIceEnum
 syn keyword cConstant MaterialsRhoSeawaterEnum
 syn keyword cConstant MaterialsRhoFreshwaterEnum
@@ -770,6 +825,7 @@
 syn keyword cConstant MeshYEnum
 syn keyword cConstant MeshZEnum
 syn keyword cConstant MeshElementtypeEnum
+syn keyword cConstant MeshSegmentsEnum
 syn keyword cConstant DomainTypeEnum
 syn keyword cConstant DomainDimensionEnum
 syn keyword cConstant Domain2DhorizontalEnum
@@ -781,7 +837,6 @@
 syn keyword cConstant MasstransportMinThicknessEnum
 syn keyword cConstant MasstransportPenaltyFactorEnum
 syn keyword cConstant MasstransportSpcthicknessEnum
-syn keyword cConstant MasstransportCalvingrateEnum
 syn keyword cConstant MasstransportStabilizationEnum
 syn keyword cConstant MasstransportVertexPairingEnum
 syn keyword cConstant MasstransportNumRequestedOutputsEnum
@@ -801,12 +856,12 @@
 syn keyword cConstant SettingsIoGatherEnum
 syn keyword cConstant SettingsLowmemEnum
 syn keyword cConstant SettingsOutputFrequencyEnum
+syn keyword cConstant SettingsRecordingFrequencyEnum
 syn keyword cConstant SettingsWaitonlockEnum
 syn keyword cConstant DebugProfilingEnum
 syn keyword cConstant ProfilingCurrentMemEnum
 syn keyword cConstant ProfilingCurrentFlopsEnum
 syn keyword cConstant ProfilingSolutionTimeEnum
-syn keyword cConstant MaxIterationConvergenceFlagEnum
 syn keyword cConstant SteadystateMaxiterEnum
 syn keyword cConstant SteadystateNumRequestedOutputsEnum
 syn keyword cConstant SteadystateReltolEnum
@@ -814,6 +869,7 @@
 syn keyword cConstant SurfaceEnum
 syn keyword cConstant ThermalIsenthalpyEnum
 syn keyword cConstant ThermalIsdynamicbasalspcEnum
+syn keyword cConstant ThermalReltolEnum
 syn keyword cConstant ThermalMaxiterEnum
 syn keyword cConstant ThermalPenaltyFactorEnum
 syn keyword cConstant ThermalPenaltyLockEnum
@@ -831,6 +887,7 @@
 syn keyword cConstant TimesteppingTimeAdaptEnum
 syn keyword cConstant TimesteppingTimeStepEnum
 syn keyword cConstant TimesteppingInterpForcingsEnum
+syn keyword cConstant TransientIssmbEnum
 syn keyword cConstant TransientIsstressbalanceEnum
 syn keyword cConstant TransientIsgroundinglineEnum
 syn keyword cConstant TransientIsmasstransportEnum
@@ -838,6 +895,7 @@
 syn keyword cConstant TransientIsgiaEnum
 syn keyword cConstant TransientIsdamageevolutionEnum
 syn keyword cConstant TransientIshydrologyEnum
+syn keyword cConstant TransientIscalvingEnum
 syn keyword cConstant TransientNumRequestedOutputsEnum
 syn keyword cConstant TransientRequestedOutputsEnum
 syn keyword cConstant PotentialEnum
@@ -845,35 +903,104 @@
 syn keyword cConstant BalancethicknessApparentMassbalanceEnum
 syn keyword cConstant Balancethickness2MisfitEnum
 syn keyword cConstant BalancethicknessDiffusionCoefficientEnum
-syn keyword cConstant SurfaceforcingsEnum
-syn keyword cConstant SMBEnum
-syn keyword cConstant SurfaceforcingsMassBalanceEnum
+syn keyword cConstant BalancethicknessCmuEnum
+syn keyword cConstant BalancethicknessOmegaEnum
+syn keyword cConstant BalancethicknessD0Enum
+syn keyword cConstant SmbEnum
+syn keyword cConstant SmbAnalysisEnum
+syn keyword cConstant SmbSolutionEnum
+syn keyword cConstant SmbNumRequestedOutputsEnum
+syn keyword cConstant SmbRequestedOutputsEnum
+syn keyword cConstant SmbIsInitializedEnum
+syn keyword cConstant SMBforcingEnum
+syn keyword cConstant SmbMassBalanceEnum
+syn keyword cConstant SMBgembEnum
+syn keyword cConstant SmbInitDensityScalingEnum
+syn keyword cConstant SmbTaEnum
+syn keyword cConstant SmbVEnum
+syn keyword cConstant SmbDswrfEnum
+syn keyword cConstant SmbDlwrfEnum
+syn keyword cConstant SmbPEnum
+syn keyword cConstant SmbSwfEnum
+syn keyword cConstant SmbEAirEnum
+syn keyword cConstant SmbPAirEnum
+syn keyword cConstant SmbTmeanEnum
+syn keyword cConstant SmbCEnum
+syn keyword cConstant SmbTzEnum
+syn keyword cConstant SmbVzEnum
+syn keyword cConstant SmbDtEnum
+syn keyword cConstant SmbDzEnum
+syn keyword cConstant SmbAIdxEnum
+syn keyword cConstant SmbSwIdxEnum
+syn keyword cConstant SmbDenIdxEnum
+syn keyword cConstant SmbZTopEnum
+syn keyword cConstant SmbDzTopEnum
+syn keyword cConstant SmbDzMinEnum
+syn keyword cConstant SmbZYEnum
+syn keyword cConstant SmbZMaxEnum
+syn keyword cConstant SmbZMinEnum
+syn keyword cConstant SmbOutputFreqEnum
+syn keyword cConstant SmbASnowEnum
+syn keyword cConstant SmbAIceEnum
+syn keyword cConstant SmbCldFracEnum
+syn keyword cConstant SmbT0wetEnum
+syn keyword cConstant SmbT0dryEnum
+syn keyword cConstant SmbKEnum
+syn keyword cConstant SmbDEnum
+syn keyword cConstant SmbReEnum
+syn keyword cConstant SmbGdnEnum
+syn keyword cConstant SmbGspEnum
+syn keyword cConstant SmbECEnum
+syn keyword cConstant SmbCondensationEnum
+syn keyword cConstant SmbWEnum
+syn keyword cConstant SmbAEnum
+syn keyword cConstant SmbTEnum
+syn keyword cConstant SmbIsgraingrowthEnum
+syn keyword cConstant SmbIsalbedoEnum
+syn keyword cConstant SmbIsshortwaveEnum
+syn keyword cConstant SmbIsthermalEnum
+syn keyword cConstant SmbIsaccumulationEnum
+syn keyword cConstant SmbIsmeltEnum
+syn keyword cConstant SmbIsdensificationEnum
+syn keyword cConstant SmbIsturbulentfluxEnum
 syn keyword cConstant SMBpddEnum
-syn keyword cConstant SurfaceforcingsDelta18oEnum
-syn keyword cConstant SurfaceforcingsDelta18oSurfaceEnum
-syn keyword cConstant SurfaceforcingsIsdelta18oEnum
-syn keyword cConstant SurfaceforcingsPrecipitationsPresentdayEnum
-syn keyword cConstant SurfaceforcingsTemperaturesPresentdayEnum
-syn keyword cConstant SurfaceforcingsTemperaturesLgmEnum
-syn keyword cConstant SurfaceforcingsPrecipitationEnum
-syn keyword cConstant SurfaceforcingsDesfacEnum
-syn keyword cConstant SurfaceforcingsS0pEnum
+syn keyword cConstant SmbDelta18oEnum
+syn keyword cConstant SmbDelta18oSurfaceEnum
+syn keyword cConstant SmbIsdelta18oEnum
+syn keyword cConstant SmbIsmungsmEnum
+syn keyword cConstant SmbIsd18opdEnum
+syn keyword cConstant SmbPrecipitationsPresentdayEnum
+syn keyword cConstant SmbPrecipitationsLgmEnum
+syn keyword cConstant SmbTemperaturesPresentdayEnum
+syn keyword cConstant SmbTemperaturesLgmEnum
+syn keyword cConstant SmbPrecipitationEnum
+syn keyword cConstant SmbDesfacEnum
+syn keyword cConstant SmbS0pEnum
+syn keyword cConstant SmbS0tEnum
+syn keyword cConstant SmbRlapsEnum
+syn keyword cConstant SmbRlapslgmEnum
+syn keyword cConstant SmbPfacEnum
+syn keyword cConstant SmbTdiffEnum
+syn keyword cConstant SmbSealevEnum
+syn keyword cConstant SMBd18opddEnum
+syn keyword cConstant SmbDpermilEnum
 syn keyword cConstant SMBgradientsEnum
-syn keyword cConstant SurfaceforcingsMonthlytemperaturesEnum
-syn keyword cConstant SurfaceforcingsHrefEnum
-syn keyword cConstant SurfaceforcingsSmbrefEnum
-syn keyword cConstant SurfaceforcingsBPosEnum
-syn keyword cConstant SurfaceforcingsBNegEnum
+syn keyword cConstant SmbMonthlytemperaturesEnum
+syn keyword cConstant SmbHrefEnum
+syn keyword cConstant SmbSmbrefEnum
+syn keyword cConstant SmbBPosEnum
+syn keyword cConstant SmbBNegEnum
 syn keyword cConstant SMBhenningEnum
 syn keyword cConstant SMBcomponentsEnum
-syn keyword cConstant SurfaceforcingsAccumulationEnum
-syn keyword cConstant SurfaceforcingsEvaporationEnum
-syn keyword cConstant SurfaceforcingsRunoffEnum
+syn keyword cConstant SmbAccumulationEnum
+syn keyword cConstant SmbEvaporationEnum
+syn keyword cConstant SmbRunoffEnum
 syn keyword cConstant SMBmeltcomponentsEnum
-syn keyword cConstant SurfaceforcingsMeltEnum
-syn keyword cConstant SurfaceforcingsRefreezeEnum
-syn keyword cConstant SurfaceforcingsIspddEnum
-syn keyword cConstant SurfaceforcingsIssmbgradientsEnum
+syn keyword cConstant SmbMeltEnum
+syn keyword cConstant SmbRefreezeEnum
+syn keyword cConstant SMBgcmEnum
+syn keyword cConstant SmbIspddEnum
+syn keyword cConstant SmbIssmbgradientsEnum
 syn keyword cConstant SolutionTypeEnum
 syn keyword cConstant AnalysisTypeEnum
 syn keyword cConstant ConfigurationTypeEnum
@@ -905,6 +1032,7 @@
 syn keyword cConstant HydrologyShreveAnalysisEnum
 syn keyword cConstant HydrologyDCInefficientAnalysisEnum
 syn keyword cConstant HydrologyDCEfficientAnalysisEnum
+syn keyword cConstant HydrologySommersAnalysisEnum
 syn keyword cConstant HydrologySolutionEnum
 syn keyword cConstant MeltingAnalysisEnum
 syn keyword cConstant MasstransportAnalysisEnum
@@ -917,19 +1045,17 @@
 syn keyword cConstant DepthAverageAnalysisEnum
 syn keyword cConstant SteadystateSolutionEnum
 syn keyword cConstant SurfaceSlopeSolutionEnum
-syn keyword cConstant SmoothedSurfaceSlopeXAnalysisEnum
-syn keyword cConstant SmoothedSurfaceSlopeYAnalysisEnum
+syn keyword cConstant SmoothAnalysisEnum
 syn keyword cConstant ThermalAnalysisEnum
 syn keyword cConstant ThermalSolutionEnum
 syn keyword cConstant TransientSolutionEnum
 syn keyword cConstant UzawaPressureAnalysisEnum
 syn keyword cConstant GiaSolutionEnum
 syn keyword cConstant GiaAnalysisEnum
-syn keyword cConstant SeaiceSolutionEnum
-syn keyword cConstant SeaiceAnalysisEnum
 syn keyword cConstant MeshdeformationSolutionEnum
 syn keyword cConstant MeshdeformationAnalysisEnum
 syn keyword cConstant LevelsetAnalysisEnum
+syn keyword cConstant LevelsetStabilizationEnum
 syn keyword cConstant ExtrapolationAnalysisEnum
 syn keyword cConstant LsfReinitializationAnalysisEnum
 syn keyword cConstant ApproximationEnum
@@ -944,6 +1070,7 @@
 syn keyword cConstant FSApproximationEnum
 syn keyword cConstant FSvelocityEnum
 syn keyword cConstant FSpressureEnum
+syn keyword cConstant DataSetEnum
 syn keyword cConstant ConstraintsEnum
 syn keyword cConstant LoadsEnum
 syn keyword cConstant MaterialsEnum
@@ -960,12 +1087,15 @@
 syn keyword cConstant ControlInputEnum
 syn keyword cConstant DatasetInputEnum
 syn keyword cConstant DoubleInputEnum
+syn keyword cConstant DoubleArrayInputEnum
 syn keyword cConstant DataSetParamEnum
 syn keyword cConstant DoubleMatArrayParamEnum
 syn keyword cConstant DoubleMatParamEnum
 syn keyword cConstant DoubleParamEnum
 syn keyword cConstant DoubleVecParamEnum
 syn keyword cConstant ElementEnum
+syn keyword cConstant ElementHookEnum
+syn keyword cConstant HookEnum
 syn keyword cConstant ExternalResultEnum
 syn keyword cConstant FileParamEnum
 syn keyword cConstant InputEnum
@@ -973,6 +1103,8 @@
 syn keyword cConstant InputToExtrudeEnum
 syn keyword cConstant InputToL2ProjectEnum
 syn keyword cConstant InputToDepthaverageEnum
+syn keyword cConstant InputToSmoothEnum
+syn keyword cConstant SmoothThicknessMultiplierEnum
 syn keyword cConstant IntParamEnum
 syn keyword cConstant IntVecParamEnum
 syn keyword cConstant TransientParamEnum
@@ -982,11 +1114,24 @@
 syn keyword cConstant NodeEnum
 syn keyword cConstant NumericalfluxEnum
 syn keyword cConstant NumericalfluxTypeEnum
+syn keyword cConstant NeumannfluxEnum
 syn keyword cConstant ParamEnum
+syn keyword cConstant MoulinEnum
 syn keyword cConstant PengridEnum
 syn keyword cConstant PenpairEnum
 syn keyword cConstant ProfilerEnum
 syn keyword cConstant MatrixParamEnum
+syn keyword cConstant MassconEnum
+syn keyword cConstant MassconNameEnum
+syn keyword cConstant MassconDefinitionenumEnum
+syn keyword cConstant MassconLevelsetEnum
+syn keyword cConstant MassconaxpbyEnum
+syn keyword cConstant MassconaxpbyNameEnum
+syn keyword cConstant MassconaxpbyDefinitionenumEnum
+syn keyword cConstant MassconaxpbyNamexEnum
+syn keyword cConstant MassconaxpbyNameyEnum
+syn keyword cConstant MassconaxpbyAlphaEnum
+syn keyword cConstant MassconaxpbyBetaEnum
 syn keyword cConstant NodeSIdEnum
 syn keyword cConstant VectorParamEnum
 syn keyword cConstant RiftfrontEnum
@@ -1047,7 +1192,9 @@
 syn keyword cConstant SurfaceSlopeYEnum
 syn keyword cConstant TemperatureEnum
 syn keyword cConstant TemperaturePicardEnum
+syn keyword cConstant TemperaturePDDEnum
 syn keyword cConstant ThicknessAbsMisfitEnum
+syn keyword cConstant SurfaceAbsMisfitEnum
 syn keyword cConstant VelEnum
 syn keyword cConstant VelocityEnum
 syn keyword cConstant VxAverageEnum
@@ -1071,6 +1218,7 @@
 syn keyword cConstant ThicknessAcrossGradientEnum
 syn keyword cConstant IntMatParamEnum
 syn keyword cConstant RheologyBbarAbsGradientEnum
+syn keyword cConstant RheologyBAbsGradientEnum
 syn keyword cConstant DragCoefficientAbsGradientEnum
 syn keyword cConstant TransientInputEnum
 syn keyword cConstant WaterfractionEnum
@@ -1079,6 +1227,8 @@
 syn keyword cConstant ViscousHeatingEnum
 syn keyword cConstant HydrologyWaterVxEnum
 syn keyword cConstant HydrologyWaterVyEnum
+syn keyword cConstant DrivingStressXEnum
+syn keyword cConstant DrivingStressYEnum
 syn keyword cConstant SigmaNNEnum
 syn keyword cConstant StressTensorEnum
 syn keyword cConstant StressTensorxxEnum
@@ -1103,10 +1253,12 @@
 syn keyword cConstant StrainRateyzEnum
 syn keyword cConstant StrainRatezzEnum
 syn keyword cConstant DivergenceEnum
+syn keyword cConstant MaxDivergenceEnum
 syn keyword cConstant GiaCrossSectionShapeEnum
 syn keyword cConstant GiadWdtEnum
 syn keyword cConstant GiaWEnum
 syn keyword cConstant P0Enum
+syn keyword cConstant P0ArrayEnum
 syn keyword cConstant P1Enum
 syn keyword cConstant P1DGEnum
 syn keyword cConstant P1bubbleEnum
@@ -1139,19 +1291,126 @@
 syn keyword cConstant TimeEnum
 syn keyword cConstant WaterColumnOldEnum
 syn keyword cConstant OutputdefinitionEnum
+syn keyword cConstant Outputdefinition1Enum
+syn keyword cConstant Outputdefinition2Enum
+syn keyword cConstant Outputdefinition3Enum
+syn keyword cConstant Outputdefinition4Enum
+syn keyword cConstant Outputdefinition5Enum
+syn keyword cConstant Outputdefinition6Enum
+syn keyword cConstant Outputdefinition7Enum
+syn keyword cConstant Outputdefinition8Enum
+syn keyword cConstant Outputdefinition9Enum
+syn keyword cConstant Outputdefinition10Enum
+syn keyword cConstant Outputdefinition11Enum
+syn keyword cConstant Outputdefinition12Enum
+syn keyword cConstant Outputdefinition13Enum
+syn keyword cConstant Outputdefinition14Enum
+syn keyword cConstant Outputdefinition15Enum
+syn keyword cConstant Outputdefinition16Enum
+syn keyword cConstant Outputdefinition17Enum
+syn keyword cConstant Outputdefinition18Enum
+syn keyword cConstant Outputdefinition19Enum
+syn keyword cConstant Outputdefinition20Enum
+syn keyword cConstant Outputdefinition21Enum
+syn keyword cConstant Outputdefinition22Enum
+syn keyword cConstant Outputdefinition23Enum
+syn keyword cConstant Outputdefinition24Enum
+syn keyword cConstant Outputdefinition25Enum
+syn keyword cConstant Outputdefinition26Enum
+syn keyword cConstant Outputdefinition27Enum
+syn keyword cConstant Outputdefinition28Enum
+syn keyword cConstant Outputdefinition29Enum
+syn keyword cConstant Outputdefinition30Enum
+syn keyword cConstant Outputdefinition31Enum
+syn keyword cConstant Outputdefinition32Enum
+syn keyword cConstant Outputdefinition33Enum
+syn keyword cConstant Outputdefinition34Enum
+syn keyword cConstant Outputdefinition35Enum
+syn keyword cConstant Outputdefinition36Enum
+syn keyword cConstant Outputdefinition37Enum
+syn keyword cConstant Outputdefinition38Enum
+syn keyword cConstant Outputdefinition39Enum
+syn keyword cConstant Outputdefinition40Enum
+syn keyword cConstant Outputdefinition41Enum
+syn keyword cConstant Outputdefinition42Enum
+syn keyword cConstant Outputdefinition43Enum
+syn keyword cConstant Outputdefinition44Enum
+syn keyword cConstant Outputdefinition45Enum
+syn keyword cConstant Outputdefinition46Enum
+syn keyword cConstant Outputdefinition47Enum
+syn keyword cConstant Outputdefinition48Enum
+syn keyword cConstant Outputdefinition49Enum
+syn keyword cConstant Outputdefinition50Enum
+syn keyword cConstant Outputdefinition51Enum
+syn keyword cConstant Outputdefinition52Enum
+syn keyword cConstant Outputdefinition53Enum
+syn keyword cConstant Outputdefinition54Enum
+syn keyword cConstant Outputdefinition55Enum
+syn keyword cConstant Outputdefinition56Enum
+syn keyword cConstant Outputdefinition57Enum
+syn keyword cConstant Outputdefinition58Enum
+syn keyword cConstant Outputdefinition59Enum
+syn keyword cConstant Outputdefinition60Enum
+syn keyword cConstant Outputdefinition61Enum
+syn keyword cConstant Outputdefinition62Enum
+syn keyword cConstant Outputdefinition63Enum
+syn keyword cConstant Outputdefinition64Enum
+syn keyword cConstant Outputdefinition65Enum
+syn keyword cConstant Outputdefinition66Enum
+syn keyword cConstant Outputdefinition67Enum
+syn keyword cConstant Outputdefinition68Enum
+syn keyword cConstant Outputdefinition69Enum
+syn keyword cConstant Outputdefinition70Enum
+syn keyword cConstant Outputdefinition71Enum
+syn keyword cConstant Outputdefinition72Enum
+syn keyword cConstant Outputdefinition73Enum
+syn keyword cConstant Outputdefinition74Enum
+syn keyword cConstant Outputdefinition75Enum
+syn keyword cConstant Outputdefinition76Enum
+syn keyword cConstant Outputdefinition77Enum
+syn keyword cConstant Outputdefinition78Enum
+syn keyword cConstant Outputdefinition79Enum
+syn keyword cConstant Outputdefinition80Enum
+syn keyword cConstant Outputdefinition81Enum
+syn keyword cConstant Outputdefinition82Enum
+syn keyword cConstant Outputdefinition83Enum
+syn keyword cConstant Outputdefinition84Enum
+syn keyword cConstant Outputdefinition85Enum
+syn keyword cConstant Outputdefinition86Enum
+syn keyword cConstant Outputdefinition87Enum
+syn keyword cConstant Outputdefinition88Enum
+syn keyword cConstant Outputdefinition89Enum
+syn keyword cConstant Outputdefinition90Enum
+syn keyword cConstant Outputdefinition91Enum
+syn keyword cConstant Outputdefinition92Enum
+syn keyword cConstant Outputdefinition93Enum
+syn keyword cConstant Outputdefinition94Enum
+syn keyword cConstant Outputdefinition95Enum
+syn keyword cConstant Outputdefinition96Enum
+syn keyword cConstant Outputdefinition97Enum
+syn keyword cConstant Outputdefinition98Enum
+syn keyword cConstant Outputdefinition99Enum
+syn keyword cConstant Outputdefinition100Enum
 syn keyword cConstant OutputdefinitionListEnum
 syn keyword cConstant MassfluxatgateEnum
 syn keyword cConstant MassfluxatgateNameEnum
+syn keyword cConstant MassfluxatgateDefinitionenumEnum
 syn keyword cConstant MassfluxatgateSegmentsEnum
 syn keyword cConstant MisfitNameEnum
+syn keyword cConstant MisfitDefinitionenumEnum
 syn keyword cConstant MisfitModelEnumEnum
 syn keyword cConstant MisfitObservationEnum
 syn keyword cConstant MisfitObservationEnumEnum
+syn keyword cConstant MisfitLocalEnum
 syn keyword cConstant MisfitTimeinterpolationEnum
 syn keyword cConstant MisfitWeightsEnum
 syn keyword cConstant MisfitWeightsEnumEnum
 syn keyword cConstant SurfaceObservationEnum
 syn keyword cConstant WeightsSurfaceObservationEnum
+syn keyword cConstant VxObsEnum
+syn keyword cConstant WeightsVxObsEnum
+syn keyword cConstant VyObsEnum
+syn keyword cConstant WeightsVyObsEnum
 syn keyword cConstant MinVelEnum
 syn keyword cConstant MaxVelEnum
 syn keyword cConstant MinVxEnum
@@ -1163,6 +1422,8 @@
 syn keyword cConstant MinVzEnum
 syn keyword cConstant MaxVzEnum
 syn keyword cConstant MaxAbsVzEnum
+syn keyword cConstant GroundedAreaEnum
+syn keyword cConstant IceMassEnum
 syn keyword cConstant IceVolumeEnum
 syn keyword cConstant IceVolumeAboveFloatationEnum
 syn keyword cConstant TotalSmbEnum
@@ -1179,6 +1440,7 @@
 syn keyword cConstant SubelementMigrationEnum
 syn keyword cConstant SubelementMigration2Enum
 syn keyword cConstant ContactEnum
+syn keyword cConstant GroundingOnlyEnum
 syn keyword cConstant MaskGroundediceLevelsetEnum
 syn keyword cConstant GaussSegEnum
 syn keyword cConstant GaussTriaEnum
@@ -1201,8 +1463,12 @@
 syn keyword cConstant NodalEnum
 syn keyword cConstant OldGradientEnum
 syn keyword cConstant OutputFilePointerEnum
+syn keyword cConstant ToolkitsFileNameEnum
+syn keyword cConstant RootPathEnum
 syn keyword cConstant OutputFileNameEnum
+syn keyword cConstant InputFileNameEnum
 syn keyword cConstant LockFileNameEnum
+syn keyword cConstant RestartFileNameEnum
 syn keyword cConstant ToolkitsOptionsAnalysesEnum
 syn keyword cConstant ToolkitsOptionsStringsEnum
 syn keyword cConstant QmuErrNameEnum
@@ -1234,43 +1500,12 @@
 syn keyword cConstant ArrheniusEnum
 syn keyword cConstant LliboutryDuvalEnum
 syn keyword cConstant TransientIslevelsetEnum
+syn keyword cConstant SpcLevelsetEnum
 syn keyword cConstant ExtrapolationVariableEnum
 syn keyword cConstant IceMaskNodeActivationEnum
 syn keyword cConstant LevelsetfunctionSlopeXEnum
 syn keyword cConstant LevelsetfunctionSlopeYEnum
 syn keyword cConstant LevelsetfunctionPicardEnum
-syn keyword cConstant SeaiceatmEnum
-syn keyword cConstant SeaiceoceanEnum
-syn keyword cConstant SeaiceThicknessEnum
-syn keyword cConstant SeaiceConcentrationEnum
-syn keyword cConstant SeaiceSpcvxEnum
-syn keyword cConstant SeaiceSpcvyEnum
-syn keyword cConstant SeaiceCoriolisFactorEnum
-syn keyword cConstant BasalforcingsRhoOceanEnum
-syn keyword cConstant BasalforcingsOceanCoefEnum
-syn keyword cConstant BasalforcingsOceanLinDragCoefEnum
-syn keyword cConstant BasalforcingsOceanQuadDragCoefEnum
-syn keyword cConstant BasalforcingsOceanTurningAngleEnum
-syn keyword cConstant BasalforcingsOceanSshEnum
-syn keyword cConstant BasalforcingsOceanVxEnum
-syn keyword cConstant BasalforcingsOceanVyEnum
-syn keyword cConstant SurfaceforcingsRhoAirEnum
-syn keyword cConstant SurfaceforcingsAirCoefEnum
-syn keyword cConstant SurfaceforcingsAirLinDragCoefEnum
-syn keyword cConstant SurfaceforcingsAirQuadDragCoefEnum
-syn keyword cConstant SurfaceforcingsWindVxEnum
-syn keyword cConstant SurfaceforcingsWindVyEnum
-syn keyword cConstant MatseaiceEnum
-syn keyword cConstant MaterialsPoissonEnum
-syn keyword cConstant MaterialsYoungModulusEnum
-syn keyword cConstant MaterialsDamageEnum
-syn keyword cConstant MaterialsRidgingExponentEnum
-syn keyword cConstant MaterialsCohesionEnum
-syn keyword cConstant MaterialsInternalFrictionCoefEnum
-syn keyword cConstant MaterialsCompressionCoefEnum
-syn keyword cConstant MaterialsTractionCoefEnum
-syn keyword cConstant VxStarEnum
-syn keyword cConstant VyStarEnum
 "ISSM's Enums end
 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 

Modified: issm/trunk/externalpackages/windows/windows_environment.sh
===================================================================
--- issm/trunk/externalpackages/windows/windows_environment.sh	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/externalpackages/windows/windows_environment.sh	2016-04-13 04:32:01 UTC (rev 20500)
@@ -10,7 +10,7 @@
 # 4: intel compiler on WinXP
 
 #Determine OS version using uname: 
-version=`uname -s | grep 64`
+version=`uname -m | grep x86_64`
 if [[ $version == "" ]];then
 	compiler=1
 else
@@ -24,9 +24,9 @@
 #source corresponding environment variables: 
 
 if [[ "$compiler" == "1" ]]; then 
-	source $config_dir/sdk7.1.win7-32.sh
+	source $config_dir/sdk10.0-win32.sh
 elif [[ "$compiler" == "2" ]]; then 
-	source $config_dir/sdk7.1.win7-64.sh
+	source $config_dir/sdk10.0-win64.sh
 elif [[ "$compiler" == "3" ]]; then 
 	source $config_dir/intel-win7.sh
 else 

Modified: issm/trunk/jenkins/jenkins.sh
===================================================================
--- issm/trunk/jenkins/jenkins.sh	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/jenkins/jenkins.sh	2016-04-13 04:32:01 UTC (rev 20500)
@@ -2,6 +2,11 @@
 #This bash script calls the nightlyrun.m matlab file to run our nightly test decks. 
 #It then processes the results and sends an email to the Ice developpers.
 
+echo "Cleaning up execution directory"
+rm -rf $ISSM_DIR/execution/*
+rm -rf $ISSM_DIR/nightlylog
+mkdir  $ISSM_DIR/nightlylog
+
 #Get configuration
 #Source config file{{{
 if [ $# -ne 1 ];
@@ -19,136 +24,165 @@
 #}}}
 #Get Operating system (OS) name{{{
 OS=$(uname -s)
-if [[ $OS == "CYGWIN_NT-6.1-WOW64" ]]; then 
-	OS="win7";
+if [[ $OS == CYGWIN* ]]; then 
+	OS="win";
 fi
 #}}}
 
-#Installation ISSM
-#create matlab's installation sript {{{
-cat << END > $ISSM_DIR/externalpackages/matlab/install.sh
-#!/bin/bash
-rm -rf install
-ln -s $MATLAB_PATH install
-END
-#}}}
-#install/copy/none external packages    (ISSM_EXTERNALPACKAGES){{{
-if [ "$ISSM_EXTERNALPACKAGES" == "install" ]
+#Install ISSM
+#Determinig Installation type depending on svn changes{{{
+echo "======================================================";
+echo "             Determining Installation type            "
+echo "======================================================";
+if [ -a $ISSM_DIR/svn_revision_old ]
 then
-	
-	cd $ISSM_DIR/externalpackages
+	SVN_PREVIOUS=$(cat $ISSM_DIR/svn_revision_old)
+	SVN_CURRENT=$SVN_REVISION_1
+	echo "Previous revision number: $SVN_PREVIOUS"
+	echo "Current  revision number: $SVN_CURRENT"
 
-	#number of packages: 
-	NUMPACKAGES=$(($(echo $EXTERNALPACKAGES | wc -w )/2))
+	#Get changes from jenkins itself (svn requires credentials)
+	rm -rf changes
+	wget http://ross.ics.uci.edu:8080/job/$JOB_NAME/$BUILD_NUMBER/changes > /dev/null 2>&1
 
-	for ((i=1;i<=$NUMPACKAGES;i++))
-	do
-		NUM1=$((2*$i-1))
-		NUM2=$((2*$i))
-		PACKAGENAME=$(echo $EXTERNALPACKAGES | cut -d " " -f $NUM1-$NUM1)
-		PACKAGEINST=$(echo $EXTERNALPACKAGES | cut -d " " -f $NUM2-$NUM2)
+	#Process html page and get the list of files that has changed (tricky...)
+	cat changes | grep 'alt="The file was modified"' |sed -e 's/alt="The file was modified"/\
+		/g' | sed -e 's/.*<\/a><\/td><td>\(.*\)<\/td><\/tr>.*/\1/' | grep -v '"The file was modified"' > $ISSM_DIR/TEMP
 
-		cd $PACKAGENAME
+	#Print list of files
+	echo "   "
+	echo "List of updated files"
+	cat $ISSM_DIR/TEMP
+	echo "   "
 
-		#tricky part here. We do not want to reinstall this package if it's already installed
-		#and the svn file which does the install has not be modified! To keep track of 
-		#this, we check the current svn version against the "last changed" revision number.  If they 
-		#are the same, we reinstall the package. 
-		current_version=`svnversion`
-		last_changed_version=`svn info $PACKAGEINST | grep "Last Changed Rev" | awk '{printf("%s\n",$4);}'`
+	#Do we need to reinstall externalpackages?
+	echo "Determining installation type"
+	if [ ! -z "$(cat $ISSM_DIR/TEMP | grep externalpackages)" ] ; then
+		echo "  -- checking for changed externalpackages... yes";
+		ISSM_EXTERNALPACKAGES="install"
+	else
+		echo "  -- checking for changed externalpackages... no";
+		ISSM_EXTERNALPACKAGES="none"
+	fi
 
-		if [[ $current_version == $last_changed_version ]]; then 
-			#go ahead and reinstall. 
-			echo "For $PACKAGENAME: svn current_version  is $current_version and last changed version is $last_changed_version"
-			echo "Triggering new install of $PACKAGENAME"
-			install_test=1
-		else
-			#ok, we want to skip, unless the package is not installed: 
-			if [ -d install ]; then 
-				#could be empty, signaling a failed previous install: 
-				if [ "$(ls -A install)" ];then
-					echo "For $PACKAGENAME: svn current_version  is $current_version and last changed version is $last_changed_version"
-					echo "and install directory exists, so skipping install of $PACKAGENAME"
-					install_test=0;
-				else
-					echo "For $PACKAGENAME: svn current_version  is $current_version and last changed version is $last_changed_version"
-					echo "and install directory exists, however, it is empty, so triggering install of $PACKAGENAME"
-					install_test=1;
-				fi
-			else
-				echo "For $PACKAGENAME: svn current_version  is $current_version and last changed version is $last_changed_version"
-				echo "However, install directory does not exist, so triggering install of $PACKAGENAME"
-				install_test=1;
-			fi
-		fi
+	#Do we need to reconfigure
+	if [ ! -z "$(cat $ISSM_DIR/TEMP | grep -e "Makefile.am" -e "m4" )" ] || [ "$ISSM_EXTERNALPACKAGES" == "yes" ] ; then
+		echo "  -- checking for reconfiguration... yes";
+		ISSM_RECONFIGURE="yes"
+	else
+		echo "  -- checking for reconfiguration... no";
+		ISSM_RECONFIGURE="no"
+	fi
 
-		if [[ $install_test == 1 ]]; then 
+	#Do we need to recompile
+	if [ ! -z "$(cat $ISSM_DIR/TEMP | grep -e "\.cpp" -e "\.h" )" ] || [ "$ISSM_RECONFIGURE" == "yes" ] ; then
+		echo "  -- checking for recompilation... yes";
+		ISSM_COMPILATION="yes"
+	else
+		echo "  -- checking for recompilation... no";
+		ISSM_COMPILATION="no"
+	fi
+
+else
+	echo "Previous revision not found, this must be a fresh install"
+	echo "  -- checking for changed externalpackages... yes";
+	echo "  -- checking for reconfiguration... yes";
+	echo "  -- checking for recompilation... yes";
+	ISSM_EXTERNALPACKAGES="install"
+	ISSM_RECONFIGURE="yes"
+	ISSM_COMPILATION="yes"
+fi
+echo " "
+echo "Recording current svn version: $SVN_REVISION_1"
+echo $SVN_REVISION_1 > $ISSM_DIR/svn_revision_old
+#}}}
+#install/none external packages    (ISSM_EXTERNALPACKAGES){{{
+
+#Jenkins xml files for individual packages
+EXTERNAL_TEST_FILE="$ISSM_DIR/nightlylog/results/external.xml"
+mkdir -p $ISSM_DIR/nightlylog/results
+echo "<testsuite tests=\"$NUMPACKAGES\">" > $EXTERNAL_TEST_FILE
+
+#number of packages: 
+NUMPACKAGES=$(($(echo $EXTERNALPACKAGES | wc -w )/2))
+for ((i=1;i<=$NUMPACKAGES;i++))
+do
+	NUM1=$((2*$i-1))
+	NUM2=$((2*$i))
+	PACKAGENAME=$(echo $EXTERNALPACKAGES | cut -d " " -f $NUM1-$NUM1)
+	PACKAGEINST=$(echo $EXTERNALPACKAGES | cut -d " " -f $NUM2-$NUM2)
+
+	cd $ISSM_DIR/externalpackages/$PACKAGENAME
+
+	#install if requested or if install does not exist
+	if [ "$ISSM_EXTERNALPACKAGES" == "install" ] || [ ! -d install ] || [ ! "$(ls -A install)" ];
+	then
+		echo "======================================================";
+		echo "       Installing $PACKAGENAME                        ";
+		echo "======================================================";
+		./$PACKAGEINST |  tee compil.log
+		if [ $? -ne 0 ]; then
 			echo "======================================================";
-			echo "       Installing $PACKAGENAME                        ";
+			echo "    ERROR: installation of $PACKAGENAME failed        ";
 			echo "======================================================";
-			./$PACKAGEINST |  tee compil.log
-			if [ $? -ne 0 ]; then
-				echo "======================================================";
-				echo "    ERROR: installation of $PACKAGENAME failed        ";
-				echo "======================================================";
-				#erase install directory, so that next time, we still try and compile this!
-				rm -rf install
-			fi
-			source $ISSM_DIR/etc/environment.sh
+			#erase install directory, so that next time, we still try and compile this!
+			rm -rf install
+			echo "<testcase classname=\"externalpackages\" name=\"$PACKAGENAME\">" >> $EXTERNAL_TEST_FILE
+			echo '<failure message="failure">External packages did not install right. Check it.</failure>' >> $EXTERNAL_TEST_FILE
+			echo '</testcase>' >> $EXTERNAL_TEST_FILE
 		else
-			echo "======================================================";
-			echo "       Skipping install of $PACKAGENAME                        ";
-			echo "======================================================";
-			source $ISSM_DIR/etc/environment.sh #for good measure :)
+			echo "<testcase classname=\"externalpackages\" name=\"$PACKAGENAME\"/>" >> $EXTERNAL_TEST_FILE
 		fi
-		cd ..
-	done
+		source $ISSM_DIR/etc/environment.sh
 
-elif [ "$ISSM_EXTERNALPACKAGES" == "copy" ]
+		#If external package is rebuilt, we also need to recompile
+		ISSM_COMPILATION = "yes"
+	else
+		echo "======================================================";
+		echo "       Skipping $PACKAGENAME                          ";
+		echo "======================================================";
+	fi
+done
+echo '</testsuite>' >> $EXTERNAL_TEST_FILE
+
+source $ISSM_DIR/etc/environment.sh
+
+if [ "$OS" == "win" ]
 then
-	cd $ISSM_DIR
-	rm -rf externalpackages
-	cp -Rf $EXTERNALPACKAGESDIR ./
-elif [ "$ISSM_EXTERNALPACKAGES" == "link" ]
-then
-	cd $ISSM_DIR
-	rm -rf externalpackages
-	ln -s  $EXTERNALPACKAGESDIR  .
-elif [ "$ISSM_EXTERNALPACKAGES" == "none" ]
-then
-	echo "Skipping external packages installation"
-else
-	echo "ISSM_EXTERNALPACKAGES supported values are: install, copy and none. Exiting..." >&2 # Error message to stderr.
-	exit 1
+	echo " == WINDOWS ENVIRONMENT DETECTED =="
+	source $ISSM_DIR/externalpackages/windows/windows_environment.sh
 fi
-source $ISSM_DIR/etc/environment.sh
 #}}}
 #ISSM compilation yes/no                (ISSM_COMPILATION) {{{
 if [ "$ISSM_COMPILATION" == "yes" ]
 then
 	cd $ISSM_DIR
-	make uninstall
-	make clean
-	make distclean
-	./scripts/automakererun.sh
-	cat > configure.sh << EOF
-./configure $ISSM_CONFIG
-EOF
-	chmod 700 configure.sh
-	./configure.sh
+	if [ "$ISSM_RECONFIGURE" == "yes" ]
+	then
+		echo "======================================================";
+		echo "             Cleaning up and reconfiguring            "
+		echo "======================================================";
+		make uninstall
+		make distclean
+		./scripts/automakererun.sh
+		eval "./configure $ISSM_CONFIG"
+	fi
 
 	#4: compile and install ISSM
-	if [ $NUMCPUS_INSTALL -gt 1 ]
-	then
+	echo "======================================================";
+	echo "                    Compiling ISSM                    "
+	echo "======================================================";
+	if [ $NUMCPUS_INSTALL -gt 1 ]; then
 		echo "Making with " $NUMCPUS_INSTALL " cpus"
-		make -j $NUMCPUS_INSTALL install
+		make -j $NUMCPUS_INSTALL
 	else
-		make install
+		make
 	fi
 	if [ $? -ne 0 ]; then 
 		echo "ISSM_COMPILATION failed!"
 		exit 1
 	fi
+	make install
 elif [ "$ISSM_COMPILATION" == "no" ]
 then
 	echo "Skipping ISSM compilation"
@@ -157,10 +191,6 @@
 	exit 1
 fi
 #}}}
-echo "Cleaning up execution directory"
-rm -rf $ISSM_DIR/execution/*
-rm -rf $ISSM_DIR/nightlylog
-mkdir  $ISSM_DIR/nightlylog
 
 #matlab tests
 if [ $MATLAB_TEST -eq 1 ]; then
@@ -191,13 +221,21 @@
 	exit
 EOF
 	cd $ISSM_DIR/test/NightlyRun
-	$MATLAB_PATH/bin/matlab -nojvm -nosplash -r "addpath $ISSM_DIR/src/m/dev; devpath; addpath $ISSM_DIR/nightlylog/; matlab_run$i" -logfile $ISSM_DIR/nightlylog/matlab_log$i.log &
+	if [ "$OS" = "win" ]; then
+		$MATLAB_PATH/bin/matlab -nojvm -nosplash -r "addpath $ISSM_DIR_WIN/src/m/dev; devpath; addpath $ISSM_DIR_WIN/nightlylog/; matlab_run$i" -logfile $ISSM_DIR_WIN/nightlylog/matlab_log$i.log &
+	else
+		$MATLAB_PATH/bin/matlab -nojvm -nosplash -r "addpath $ISSM_DIR/src/m/dev; devpath; addpath $ISSM_DIR/nightlylog/; matlab_run$i" -logfile $ISSM_DIR/nightlylog/matlab_log$i.log &
+	fi
 done
 
 #wait until matlab closes
-if [ "$OS" = "win7" ]; then
+if [ "$OS" = "win" ]; then
+	sleep 5;
 	echo "Waiting for matlab on windows"
 	pid=$(ps aux -W | grep MATLAB | awk '{printf("%s\n","MATLAB");}')
+	echo '-----------------------------'
+	echo "pid: $pid"
+	echo '-----------------------------'
 	while [ -n "$pid" ]
 	do
 		pid=$(ps aux -W | grep MATLAB | awk '{printf("%s\n","MATLAB");}')
@@ -210,7 +248,19 @@
 
 #concatenate reports
 cd $ISSM_DIR/nightlylog/
+echo 'CHECKING NIGHTLYLOG DIRECTORY'
+echo '-----------------------------'
+ls -la
+echo '-----------------------------'
+
 rm matlab_log.log
+
+for job in `jobs -p`
+do
+echo "Waiting on: $job"
+    wait $job
+done
+
 for (( i=1;i<=$NUMCPUS_RUN;i++ ))
 do
 	cat matlab_log$i.log >> matlab_log.log
@@ -226,22 +276,38 @@
 #Launch all tests on different cpus {{{
 PYTHON_START_TIME=$(timer);
 export PYTHONSTARTUP=$ISSM_DIR/src/m/dev/devpath.py
+export PYTHONUNBUFFERED=1 #we don't want python to buffer otherwise issm.exe output is not captured
 for (( i=1;i<=$NUMCPUS_RUN;i++ ))
 do
 	cd $ISSM_DIR/test/NightlyRun
-	./runme.py --output=nightly --rank=$i --numprocs=$NUMCPUS_RUN $PYTHON_NROPTIONS 2>&1 > $ISSM_DIR/nightlylog/python_log$i.log &
+	echo "--------------Running Python test for Rank $i---------------------"
+	./runme.py --output=nightly --rank=$i --numprocs=$NUMCPUS_RUN $PYTHON_NROPTIONS &> $ISSM_DIR/nightlylog/python_log$i.log &
+	echo "--------------Running Python test for Rank $i---------------------"
 done
 
-#concatenate reports
+# concatenate reports
 cd $ISSM_DIR/nightlylog/
 rm python_log.log
+
+for job in `jobs -p`
+do
+echo "Waiting on: $job"
+    wait $job
+done
+
 for (( i=1;i<=$NUMCPUS_RUN;i++ ))
 do
+	echo "This is the concatenation phase for rank: python_log$i.log"
 	cat python_log$i.log >> python_log.log
 done
 #}}}
 fi
 
+# This test will allow us to check on the status of the examples.
+if [ $EXAMPLES_TEST -eq 1]; then
+	cd $ISSM_DIR/examples
+fi
+
 #process logs to be junit compatible
 #{{{
 cd $ISSM_DIR/nightlylog/

Modified: issm/trunk/jenkins/windows
===================================================================
--- issm/trunk/jenkins/windows	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/jenkins/windows	2016-04-13 04:32:01 UTC (rev 20500)
@@ -3,73 +3,55 @@
 # 1: ISSM general configuration #
 #-------------------------------#
 
+#MATLAB path
+MATLAB_PATH="/cygdrive/c/Programs/MATLAB/R2015a/"
+
 #ISSM CONFIGURATION 
 ISSM_CONFIG='--prefix=$ISSM_DIR \
+	--with-vendor=MSVC-Win64  \
+	--with-cxxoptflags='' \
    --disable-static \
 	--enable-standalone-libraries \
+	--with-fortran=no  \
 	--without-Gia \
-	--with-vendor=intel-win7-64  \
-	--with-matlab-dir=""$ISSM_DIR/externalpackages/matlab/install"" \
+	--without-kriging \
+	--without-kml \
+	--with-matlab-dir=$MATLAB_PATH \
 	--with-triangle-dir="$ISSM_DIR/externalpackages/triangle/install" \
 	--with-petsc-dir="$ISSM_DIR/externalpackages/petsc/install" \
+	--with-metis-dir=$ISSM_DIR/externalpackages/metis/install \
 	--with-blas-lapack-dir=$ISSM_DIR/externalpackages/petsc/install/lib/  \
 	--with-mpi-libdir="$ISSM_DIR/externalpackages/petsc/install/lib" \
 	--with-mpi-libflags="-Wl,libpetsc.lib" \
-	--with-mpi-include="$ISSM_DIR/externalpackages/petsc/install/include/mpiuni" \
+	--with-mpi-include="$ISSM_DIR/externalpackages/petsc/install/include/petsc/mpiuni" \
+	--enable-development \
 	--enable-debugging '
 
-#MATLAB path
-MATLAB_PATH="C:/MATLAB/R2013a/"
-
 #PYTHON and MATLAB testing
 MATLAB_TEST=1
 PYTHON_TEST=0
 
-#execution path used for parallel runs
-EXECUTION_PATH=$ISSM_DIR/execution
-
-#repo:
-REPOSITORY="https://issm.ess.uci.edu/svn/issm/issm/trunk-jpl"
-
 #-----------------------------------#
 # 3: External packages installation #
 #-----------------------------------#
 
-#ISSM_EXTERNALPACKAGES can have 3 values:
-# - "install" install all external packages listed below
-# - "copy"    copy existing directories (EXTERNALPACKAGESDIR)
-# - "none"    leave external packages as is
-#             ->skip to section 4
-ISSM_EXTERNALPACKAGES="install"
-EXTERNALPACKAGESDIR=$ISSM_DIR/externalpackages
-
 #List of external pakages to be installed and their installation scripts
-EXTERNALPACKAGES="cccl        install-win7.sh
-						cmake       install.sh                
-						petsc       install-3.5-win7.sh
+EXTERNALPACKAGES="autotools   install-win.sh
+						petsc       install-3.6-win10.sh
+						metis       install-4.0-win7.sh
 						triangle    install-win7.sh        
-						matlab      install.sh
 						shell2junit install.sh"
 
-#---------------------#
-# 4: ISSM Compilation #
-#---------------------#
+#-----------------#
+# 4: test options #
+#-----------------#
 
-#ISSM_COMPILATION can have 2 values:
-# - "yes" compile ISSM
-# - "no"  do not compile ISSM
-ISSM_COMPILATION="yes"
-
-#------------------------#
-# 5: Nightly run options #
-#------------------------#
-
 #number of cpus used in ISSM installation and compilation (one is usually
 #safer as some packages are very sensitive to parallel compilation)
-NUMCPUS_INSTALL=8
+NUMCPUS_INSTALL=6
 
 #number of cpus used in the nightly runs.
-NUMCPUS_RUN=1
+NUMCPUS_RUN=2
 
 #Nightly run options. The matlab routine runme.m will be called
 #as follows: runme($MATLAB_NROPTIONS). The options must be understandable
@@ -77,5 +59,5 @@
 #ex: "'id',[101 102 103]"
 
 #In Windows, we don't yet have MUMPS, can't do full stokes, so exclude all FS runs. Also exclude all runs with Dakota. And exclude higher order runs that have penalties. And 800+ tests because we don't want to have --with-development since we do the binaries with this version
-MATLAB_NROPTIONS="'exclude',[104, 124, 204, 211, 215, 220, 221, 285, 290, 308, 322, 404, 421, 422, 503, 507, 510, 511, 701, 702, 703, 218, 234, 235, 412, 413, 414, 417, 418, 420, 205, 274, 331, 405, 409, 455, 612, 514, 435, 280,801,802,803,804,805,291]"
+MATLAB_NROPTIONS="'exclude',[104, 124, 204, 211, 215, 220, 221, 285, 290, 308, 322, 404, 421, 422, 503, 507, 510, 511, 513, 701, 702, 703, 218, 234, 235, 412, 413, 414, 417, 418, 420, 205, 274, 331, 405, 409, 455, 612, 514, 435, 280,801,802,803,804,805,291,340,341]"
 PYTHON_NROPTIONS=""

Modified: issm/trunk/m4/analyses.m4
===================================================================
--- issm/trunk/m4/analyses.m4	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/m4/analyses.m4	2016-04-13 04:32:01 UTC (rev 20500)
@@ -9,467 +9,915 @@
 AC_DEFUN([AX_ANALYSES_SELECTION],
 [
 
+dnl with-Smb{{{
+
+AC_ARG_WITH([Smb],
+
+	AS_HELP_STRING([--with-Smb = YES], [compile with Smb capabilities (default is yes)]),
+
+	[SMB=$withval],[SMB=yes])
+
+AC_MSG_CHECKING(for Smb capability compilation)
+
+
+HAVE_SMB=no 
+
+if test "x$SMB" = "xyes"; then
+
+	HAVE_SMB=yes
+
+	AC_DEFINE([_HAVE_SMB_],[1],[with Smb capability])
+
+fi
+
+AM_CONDITIONAL([SMB], [test x$HAVE_SMB = xyes])
+
+AC_MSG_RESULT($HAVE_SMB)
+
+dnl }}}
 dnl with-AdjointBalancethickness{{{
+
 AC_ARG_WITH([AdjointBalancethickness],
+
 	AS_HELP_STRING([--with-AdjointBalancethickness = YES], [compile with AdjointBalancethickness capabilities (default is yes)]),
+
 	[ADJOINTBALANCETHICKNESS=$withval],[ADJOINTBALANCETHICKNESS=yes])
+
 AC_MSG_CHECKING(for AdjointBalancethickness capability compilation)
 
+
 HAVE_ADJOINTBALANCETHICKNESS=no 
+
 if test "x$ADJOINTBALANCETHICKNESS" = "xyes"; then
+
 	HAVE_ADJOINTBALANCETHICKNESS=yes
-	AC_DEFINE([_HAVE_ADJOINTBALANCETHICKNESS_],[1],[with AdjointBalancethicknesscapability])
+
+	AC_DEFINE([_HAVE_ADJOINTBALANCETHICKNESS_],[1],[with AdjointBalancethickness capability])
+
 fi
+
 AM_CONDITIONAL([ADJOINTBALANCETHICKNESS], [test x$HAVE_ADJOINTBALANCETHICKNESS = xyes])
+
 AC_MSG_RESULT($HAVE_ADJOINTBALANCETHICKNESS)
+
 dnl }}}
 dnl with-AdjointBalancethickness2{{{
+
 AC_ARG_WITH([AdjointBalancethickness2],
+
 	AS_HELP_STRING([--with-AdjointBalancethickness2 = YES], [compile with AdjointBalancethickness2 capabilities (default is yes)]),
+
 	[ADJOINTBALANCETHICKNESS2=$withval],[ADJOINTBALANCETHICKNESS2=yes])
+
 AC_MSG_CHECKING(for AdjointBalancethickness2 capability compilation)
 
+
 HAVE_ADJOINTBALANCETHICKNESS2=no 
+
 if test "x$ADJOINTBALANCETHICKNESS2" = "xyes"; then
+
 	HAVE_ADJOINTBALANCETHICKNESS2=yes
-	AC_DEFINE([_HAVE_ADJOINTBALANCETHICKNESS2_],[1],[with AdjointBalancethickness2capability])
+
+	AC_DEFINE([_HAVE_ADJOINTBALANCETHICKNESS2_],[1],[with AdjointBalancethickness2 capability])
+
 fi
+
 AM_CONDITIONAL([ADJOINTBALANCETHICKNESS2], [test x$HAVE_ADJOINTBALANCETHICKNESS2 = xyes])
+
 AC_MSG_RESULT($HAVE_ADJOINTBALANCETHICKNESS2)
+
 dnl }}}
 dnl with-AdjointHoriz{{{
+
 AC_ARG_WITH([AdjointHoriz],
+
 	AS_HELP_STRING([--with-AdjointHoriz = YES], [compile with AdjointHoriz capabilities (default is yes)]),
+
 	[ADJOINTHORIZ=$withval],[ADJOINTHORIZ=yes])
+
 AC_MSG_CHECKING(for AdjointHoriz capability compilation)
 
+
 HAVE_ADJOINTHORIZ=no 
+
 if test "x$ADJOINTHORIZ" = "xyes"; then
+
 	HAVE_ADJOINTHORIZ=yes
-	AC_DEFINE([_HAVE_ADJOINTHORIZ_],[1],[with AdjointHorizcapability])
+
+	AC_DEFINE([_HAVE_ADJOINTHORIZ_],[1],[with AdjointHoriz capability])
+
 fi
+
 AM_CONDITIONAL([ADJOINTHORIZ], [test x$HAVE_ADJOINTHORIZ = xyes])
+
 AC_MSG_RESULT($HAVE_ADJOINTHORIZ)
+
 dnl }}}
 dnl with-Balancethickness{{{
+
 AC_ARG_WITH([Balancethickness],
+
 	AS_HELP_STRING([--with-Balancethickness = YES], [compile with Balancethickness capabilities (default is yes)]),
+
 	[BALANCETHICKNESS=$withval],[BALANCETHICKNESS=yes])
+
 AC_MSG_CHECKING(for Balancethickness capability compilation)
 
+
 HAVE_BALANCETHICKNESS=no 
+
 if test "x$BALANCETHICKNESS" = "xyes"; then
+
 	HAVE_BALANCETHICKNESS=yes
-	AC_DEFINE([_HAVE_BALANCETHICKNESS_],[1],[with Balancethicknesscapability])
+
+	AC_DEFINE([_HAVE_BALANCETHICKNESS_],[1],[with Balancethickness capability])
+
 fi
+
 AM_CONDITIONAL([BALANCETHICKNESS], [test x$HAVE_BALANCETHICKNESS = xyes])
+
 AC_MSG_RESULT($HAVE_BALANCETHICKNESS)
+
 dnl }}}
 dnl with-Balancethickness2{{{
+
 AC_ARG_WITH([Balancethickness2],
+
 	AS_HELP_STRING([--with-Balancethickness2 = YES], [compile with Balancethickness2 capabilities (default is yes)]),
+
 	[BALANCETHICKNESS2=$withval],[BALANCETHICKNESS2=yes])
+
 AC_MSG_CHECKING(for Balancethickness2 capability compilation)
 
+
 HAVE_BALANCETHICKNESS2=no 
+
 if test "x$BALANCETHICKNESS2" = "xyes"; then
+
 	HAVE_BALANCETHICKNESS2=yes
-	AC_DEFINE([_HAVE_BALANCETHICKNESS2_],[1],[with Balancethickness2capability])
+
+	AC_DEFINE([_HAVE_BALANCETHICKNESS2_],[1],[with Balancethickness2 capability])
+
 fi
+
 AM_CONDITIONAL([BALANCETHICKNESS2], [test x$HAVE_BALANCETHICKNESS2 = xyes])
+
 AC_MSG_RESULT($HAVE_BALANCETHICKNESS2)
+
 dnl }}}
 dnl with-BalancethicknessSoft{{{
+
 AC_ARG_WITH([BalancethicknessSoft],
+
 	AS_HELP_STRING([--with-BalancethicknessSoft = YES], [compile with BalancethicknessSoft capabilities (default is yes)]),
+
 	[BALANCETHICKNESSSOFT=$withval],[BALANCETHICKNESSSOFT=yes])
+
 AC_MSG_CHECKING(for BalancethicknessSoft capability compilation)
 
+
 HAVE_BALANCETHICKNESSSOFT=no 
+
 if test "x$BALANCETHICKNESSSOFT" = "xyes"; then
+
 	HAVE_BALANCETHICKNESSSOFT=yes
-	AC_DEFINE([_HAVE_BALANCETHICKNESSSOFT_],[1],[with BalancethicknessSoftcapability])
+
+	AC_DEFINE([_HAVE_BALANCETHICKNESSSOFT_],[1],[with BalancethicknessSoft capability])
+
 fi
+
 AM_CONDITIONAL([BALANCETHICKNESSSOFT], [test x$HAVE_BALANCETHICKNESSSOFT = xyes])
+
 AC_MSG_RESULT($HAVE_BALANCETHICKNESSSOFT)
+
 dnl }}}
 dnl with-Balancevelocity{{{
+
 AC_ARG_WITH([Balancevelocity],
+
 	AS_HELP_STRING([--with-Balancevelocity = YES], [compile with Balancevelocity capabilities (default is yes)]),
+
 	[BALANCEVELOCITY=$withval],[BALANCEVELOCITY=yes])
+
 AC_MSG_CHECKING(for Balancevelocity capability compilation)
 
+
 HAVE_BALANCEVELOCITY=no 
+
 if test "x$BALANCEVELOCITY" = "xyes"; then
+
 	HAVE_BALANCEVELOCITY=yes
-	AC_DEFINE([_HAVE_BALANCEVELOCITY_],[1],[with Balancevelocitycapability])
+
+	AC_DEFINE([_HAVE_BALANCEVELOCITY_],[1],[with Balancevelocity capability])
+
 fi
+
 AM_CONDITIONAL([BALANCEVELOCITY], [test x$HAVE_BALANCEVELOCITY = xyes])
+
 AC_MSG_RESULT($HAVE_BALANCEVELOCITY)
+
 dnl }}}
 dnl with-L2ProjectionEPL{{{
+
 AC_ARG_WITH([L2ProjectionEPL],
+
 	AS_HELP_STRING([--with-L2ProjectionEPL = YES], [compile with L2ProjectionEPL capabilities (default is yes)]),
+
 	[L2PROJECTIONEPL=$withval],[L2PROJECTIONEPL=yes])
+
 AC_MSG_CHECKING(for L2ProjectionEPL capability compilation)
 
+
 HAVE_L2PROJECTIONEPL=no 
+
 if test "x$L2PROJECTIONEPL" = "xyes"; then
+
 	HAVE_L2PROJECTIONEPL=yes
-	AC_DEFINE([_HAVE_L2PROJECTIONEPL_],[1],[with L2ProjectionEPLcapability])
+
+	AC_DEFINE([_HAVE_L2PROJECTIONEPL_],[1],[with L2ProjectionEPL capability])
+
 fi
+
 AM_CONDITIONAL([L2PROJECTIONEPL], [test x$HAVE_L2PROJECTIONEPL = xyes])
+
 AC_MSG_RESULT($HAVE_L2PROJECTIONEPL)
+
 dnl }}}
 dnl with-L2ProjectionBase{{{
+
 AC_ARG_WITH([L2ProjectionBase],
+
 	AS_HELP_STRING([--with-L2ProjectionBase = YES], [compile with L2ProjectionBase capabilities (default is yes)]),
+
 	[L2PROJECTIONBASE=$withval],[L2PROJECTIONBASE=yes])
+
 AC_MSG_CHECKING(for L2ProjectionBase capability compilation)
 
+
 HAVE_L2PROJECTIONBASE=no 
+
 if test "x$L2PROJECTIONBASE" = "xyes"; then
+
 	HAVE_L2PROJECTIONBASE=yes
-	AC_DEFINE([_HAVE_L2PROJECTIONBASE_],[1],[with L2ProjectionBasecapability])
+
+	AC_DEFINE([_HAVE_L2PROJECTIONBASE_],[1],[with L2ProjectionBase capability])
+
 fi
+
 AM_CONDITIONAL([L2PROJECTIONBASE], [test x$HAVE_L2PROJECTIONBASE = xyes])
+
 AC_MSG_RESULT($HAVE_L2PROJECTIONBASE)
+
 dnl }}}
 dnl with-DamageEvolution{{{
+
 AC_ARG_WITH([DamageEvolution],
+
 	AS_HELP_STRING([--with-DamageEvolution = YES], [compile with DamageEvolution capabilities (default is yes)]),
+
 	[DAMAGEEVOLUTION=$withval],[DAMAGEEVOLUTION=yes])
+
 AC_MSG_CHECKING(for DamageEvolution capability compilation)
 
+
 HAVE_DAMAGEEVOLUTION=no 
+
 if test "x$DAMAGEEVOLUTION" = "xyes"; then
+
 	HAVE_DAMAGEEVOLUTION=yes
-	AC_DEFINE([_HAVE_DAMAGEEVOLUTION_],[1],[with DamageEvolutioncapability])
+
+	AC_DEFINE([_HAVE_DAMAGEEVOLUTION_],[1],[with DamageEvolution capability])
+
 fi
+
 AM_CONDITIONAL([DAMAGEEVOLUTION], [test x$HAVE_DAMAGEEVOLUTION = xyes])
+
 AC_MSG_RESULT($HAVE_DAMAGEEVOLUTION)
+
 dnl }}}
 dnl with-Stressbalance{{{
+
 AC_ARG_WITH([Stressbalance],
+
 	AS_HELP_STRING([--with-Stressbalance = YES], [compile with Stressbalance capabilities (default is yes)]),
+
 	[STRESSBALANCE=$withval],[STRESSBALANCE=yes])
+
 AC_MSG_CHECKING(for Stressbalance capability compilation)
 
+
 HAVE_STRESSBALANCE=no 
+
 if test "x$STRESSBALANCE" = "xyes"; then
+
 	HAVE_STRESSBALANCE=yes
-	AC_DEFINE([_HAVE_STRESSBALANCE_],[1],[with Stressbalancecapability])
+
+	AC_DEFINE([_HAVE_STRESSBALANCE_],[1],[with Stressbalance capability])
+
 fi
+
 AM_CONDITIONAL([STRESSBALANCE], [test x$HAVE_STRESSBALANCE = xyes])
+
 AC_MSG_RESULT($HAVE_STRESSBALANCE)
+
 dnl }}}
 dnl with-StressbalanceSIA{{{
+
 AC_ARG_WITH([StressbalanceSIA],
+
 	AS_HELP_STRING([--with-StressbalanceSIA = YES], [compile with StressbalanceSIA capabilities (default is yes)]),
+
 	[STRESSBALANCESIA=$withval],[STRESSBALANCESIA=yes])
+
 AC_MSG_CHECKING(for StressbalanceSIA capability compilation)
 
+
 HAVE_STRESSBALANCESIA=no 
+
 if test "x$STRESSBALANCESIA" = "xyes"; then
+
 	HAVE_STRESSBALANCESIA=yes
-	AC_DEFINE([_HAVE_STRESSBALANCESIA_],[1],[with StressbalanceSIAcapability])
+
+	AC_DEFINE([_HAVE_STRESSBALANCESIA_],[1],[with StressbalanceSIA capability])
+
 fi
+
 AM_CONDITIONAL([STRESSBALANCESIA], [test x$HAVE_STRESSBALANCESIA = xyes])
+
 AC_MSG_RESULT($HAVE_STRESSBALANCESIA)
+
 dnl }}}
 dnl with-StressbalanceVertical{{{
+
 AC_ARG_WITH([StressbalanceVertical],
+
 	AS_HELP_STRING([--with-StressbalanceVertical = YES], [compile with StressbalanceVertical capabilities (default is yes)]),
+
 	[STRESSBALANCEVERTICAL=$withval],[STRESSBALANCEVERTICAL=yes])
+
 AC_MSG_CHECKING(for StressbalanceVertical capability compilation)
 
+
 HAVE_STRESSBALANCEVERTICAL=no 
+
 if test "x$STRESSBALANCEVERTICAL" = "xyes"; then
+
 	HAVE_STRESSBALANCEVERTICAL=yes
-	AC_DEFINE([_HAVE_STRESSBALANCEVERTICAL_],[1],[with StressbalanceVerticalcapability])
+
+	AC_DEFINE([_HAVE_STRESSBALANCEVERTICAL_],[1],[with StressbalanceVertical capability])
+
 fi
+
 AM_CONDITIONAL([STRESSBALANCEVERTICAL], [test x$HAVE_STRESSBALANCEVERTICAL = xyes])
+
 AC_MSG_RESULT($HAVE_STRESSBALANCEVERTICAL)
+
 dnl }}}
 dnl with-Enthalpy{{{
+
 AC_ARG_WITH([Enthalpy],
+
 	AS_HELP_STRING([--with-Enthalpy = YES], [compile with Enthalpy capabilities (default is yes)]),
+
 	[ENTHALPY=$withval],[ENTHALPY=yes])
+
 AC_MSG_CHECKING(for Enthalpy capability compilation)
 
+
 HAVE_ENTHALPY=no 
+
 if test "x$ENTHALPY" = "xyes"; then
+
 	HAVE_ENTHALPY=yes
-	AC_DEFINE([_HAVE_ENTHALPY_],[1],[with Enthalpycapability])
+
+	AC_DEFINE([_HAVE_ENTHALPY_],[1],[with Enthalpy capability])
+
 fi
+
 AM_CONDITIONAL([ENTHALPY], [test x$HAVE_ENTHALPY = xyes])
+
 AC_MSG_RESULT($HAVE_ENTHALPY)
+
 dnl }}}
 dnl with-HydrologyShreve{{{
+
 AC_ARG_WITH([HydrologyShreve],
+
 	AS_HELP_STRING([--with-HydrologyShreve = YES], [compile with HydrologyShreve capabilities (default is yes)]),
+
 	[HYDROLOGYSHREVE=$withval],[HYDROLOGYSHREVE=yes])
+
 AC_MSG_CHECKING(for HydrologyShreve capability compilation)
 
+
 HAVE_HYDROLOGYSHREVE=no 
+
 if test "x$HYDROLOGYSHREVE" = "xyes"; then
+
 	HAVE_HYDROLOGYSHREVE=yes
-	AC_DEFINE([_HAVE_HYDROLOGYSHREVE_],[1],[with HydrologyShrevecapability])
+
+	AC_DEFINE([_HAVE_HYDROLOGYSHREVE_],[1],[with HydrologyShreve capability])
+
 fi
+
 AM_CONDITIONAL([HYDROLOGYSHREVE], [test x$HAVE_HYDROLOGYSHREVE = xyes])
+
 AC_MSG_RESULT($HAVE_HYDROLOGYSHREVE)
+
 dnl }}}
 dnl with-HydrologyDCInefficient{{{
+
 AC_ARG_WITH([HydrologyDCInefficient],
+
 	AS_HELP_STRING([--with-HydrologyDCInefficient = YES], [compile with HydrologyDCInefficient capabilities (default is yes)]),
+
 	[HYDROLOGYDCINEFFICIENT=$withval],[HYDROLOGYDCINEFFICIENT=yes])
+
 AC_MSG_CHECKING(for HydrologyDCInefficient capability compilation)
 
+
 HAVE_HYDROLOGYDCINEFFICIENT=no 
+
 if test "x$HYDROLOGYDCINEFFICIENT" = "xyes"; then
+
 	HAVE_HYDROLOGYDCINEFFICIENT=yes
-	AC_DEFINE([_HAVE_HYDROLOGYDCINEFFICIENT_],[1],[with HydrologyDCInefficientcapability])
+
+	AC_DEFINE([_HAVE_HYDROLOGYDCINEFFICIENT_],[1],[with HydrologyDCInefficient capability])
+
 fi
+
 AM_CONDITIONAL([HYDROLOGYDCINEFFICIENT], [test x$HAVE_HYDROLOGYDCINEFFICIENT = xyes])
+
 AC_MSG_RESULT($HAVE_HYDROLOGYDCINEFFICIENT)
+
 dnl }}}
 dnl with-HydrologyDCEfficient{{{
+
 AC_ARG_WITH([HydrologyDCEfficient],
+
 	AS_HELP_STRING([--with-HydrologyDCEfficient = YES], [compile with HydrologyDCEfficient capabilities (default is yes)]),
+
 	[HYDROLOGYDCEFFICIENT=$withval],[HYDROLOGYDCEFFICIENT=yes])
+
 AC_MSG_CHECKING(for HydrologyDCEfficient capability compilation)
 
+
 HAVE_HYDROLOGYDCEFFICIENT=no 
+
 if test "x$HYDROLOGYDCEFFICIENT" = "xyes"; then
+
 	HAVE_HYDROLOGYDCEFFICIENT=yes
-	AC_DEFINE([_HAVE_HYDROLOGYDCEFFICIENT_],[1],[with HydrologyDCEfficientcapability])
+
+	AC_DEFINE([_HAVE_HYDROLOGYDCEFFICIENT_],[1],[with HydrologyDCEfficient capability])
+
 fi
+
 AM_CONDITIONAL([HYDROLOGYDCEFFICIENT], [test x$HAVE_HYDROLOGYDCEFFICIENT = xyes])
+
 AC_MSG_RESULT($HAVE_HYDROLOGYDCEFFICIENT)
+
 dnl }}}
+dnl with-HydrologySommers{{{
+
+AC_ARG_WITH([HydrologySommers],
+
+	AS_HELP_STRING([--with-HydrologySommers = YES], [compile with HydrologySommers capabilities (default is yes)]),
+
+	[HYDROLOGYSOMMERS=$withval],[HYDROLOGYSOMMERS=yes])
+
+AC_MSG_CHECKING(for HydrologySommers capability compilation)
+
+
+HAVE_HYDROLOGYSOMMERS=no 
+
+if test "x$HYDROLOGYSOMMERS" = "xyes"; then
+
+	HAVE_HYDROLOGYSOMMERS=yes
+
+	AC_DEFINE([_HAVE_HYDROLOGYSOMMERS_],[1],[with HydrologySommers capability])
+
+fi
+
+AM_CONDITIONAL([HYDROLOGYSOMMERS], [test x$HAVE_HYDROLOGYSOMMERS = xyes])
+
+AC_MSG_RESULT($HAVE_HYDROLOGYSOMMERS)
+
+dnl }}}
 dnl with-Melting{{{
+
 AC_ARG_WITH([Melting],
+
 	AS_HELP_STRING([--with-Melting = YES], [compile with Melting capabilities (default is yes)]),
+
 	[MELTING=$withval],[MELTING=yes])
+
 AC_MSG_CHECKING(for Melting capability compilation)
 
+
 HAVE_MELTING=no 
+
 if test "x$MELTING" = "xyes"; then
+
 	HAVE_MELTING=yes
-	AC_DEFINE([_HAVE_MELTING_],[1],[with Meltingcapability])
+
+	AC_DEFINE([_HAVE_MELTING_],[1],[with Melting capability])
+
 fi
+
 AM_CONDITIONAL([MELTING], [test x$HAVE_MELTING = xyes])
+
 AC_MSG_RESULT($HAVE_MELTING)
+
 dnl }}}
 dnl with-Masstransport{{{
+
 AC_ARG_WITH([Masstransport],
+
 	AS_HELP_STRING([--with-Masstransport = YES], [compile with Masstransport capabilities (default is yes)]),
+
 	[MASSTRANSPORT=$withval],[MASSTRANSPORT=yes])
+
 AC_MSG_CHECKING(for Masstransport capability compilation)
 
+
 HAVE_MASSTRANSPORT=no 
+
 if test "x$MASSTRANSPORT" = "xyes"; then
+
 	HAVE_MASSTRANSPORT=yes
-	AC_DEFINE([_HAVE_MASSTRANSPORT_],[1],[with Masstransportcapability])
+
+	AC_DEFINE([_HAVE_MASSTRANSPORT_],[1],[with Masstransport capability])
+
 fi
+
 AM_CONDITIONAL([MASSTRANSPORT], [test x$HAVE_MASSTRANSPORT = xyes])
+
 AC_MSG_RESULT($HAVE_MASSTRANSPORT)
+
 dnl }}}
 dnl with-FreeSurfaceBase{{{
+
 AC_ARG_WITH([FreeSurfaceBase],
+
 	AS_HELP_STRING([--with-FreeSurfaceBase = YES], [compile with FreeSurfaceBase capabilities (default is yes)]),
+
 	[FREESURFACEBASE=$withval],[FREESURFACEBASE=yes])
+
 AC_MSG_CHECKING(for FreeSurfaceBase capability compilation)
 
+
 HAVE_FREESURFACEBASE=no 
+
 if test "x$FREESURFACEBASE" = "xyes"; then
+
 	HAVE_FREESURFACEBASE=yes
-	AC_DEFINE([_HAVE_FREESURFACEBASE_],[1],[with FreeSurfaceBasecapability])
+
+	AC_DEFINE([_HAVE_FREESURFACEBASE_],[1],[with FreeSurfaceBase capability])
+
 fi
+
 AM_CONDITIONAL([FREESURFACEBASE], [test x$HAVE_FREESURFACEBASE = xyes])
+
 AC_MSG_RESULT($HAVE_FREESURFACEBASE)
+
 dnl }}}
 dnl with-FreeSurfaceTop{{{
+
 AC_ARG_WITH([FreeSurfaceTop],
+
 	AS_HELP_STRING([--with-FreeSurfaceTop = YES], [compile with FreeSurfaceTop capabilities (default is yes)]),
+
 	[FREESURFACETOP=$withval],[FREESURFACETOP=yes])
+
 AC_MSG_CHECKING(for FreeSurfaceTop capability compilation)
 
+
 HAVE_FREESURFACETOP=no 
+
 if test "x$FREESURFACETOP" = "xyes"; then
+
 	HAVE_FREESURFACETOP=yes
-	AC_DEFINE([_HAVE_FREESURFACETOP_],[1],[with FreeSurfaceTopcapability])
+
+	AC_DEFINE([_HAVE_FREESURFACETOP_],[1],[with FreeSurfaceTop capability])
+
 fi
+
 AM_CONDITIONAL([FREESURFACETOP], [test x$HAVE_FREESURFACETOP = xyes])
+
 AC_MSG_RESULT($HAVE_FREESURFACETOP)
+
 dnl }}}
 dnl with-ExtrudeFromBase{{{
+
 AC_ARG_WITH([ExtrudeFromBase],
+
 	AS_HELP_STRING([--with-ExtrudeFromBase = YES], [compile with ExtrudeFromBase capabilities (default is yes)]),
+
 	[EXTRUDEFROMBASE=$withval],[EXTRUDEFROMBASE=yes])
+
 AC_MSG_CHECKING(for ExtrudeFromBase capability compilation)
 
+
 HAVE_EXTRUDEFROMBASE=no 
+
 if test "x$EXTRUDEFROMBASE" = "xyes"; then
+
 	HAVE_EXTRUDEFROMBASE=yes
-	AC_DEFINE([_HAVE_EXTRUDEFROMBASE_],[1],[with ExtrudeFromBasecapability])
+
+	AC_DEFINE([_HAVE_EXTRUDEFROMBASE_],[1],[with ExtrudeFromBase capability])
+
 fi
+
 AM_CONDITIONAL([EXTRUDEFROMBASE], [test x$HAVE_EXTRUDEFROMBASE = xyes])
+
 AC_MSG_RESULT($HAVE_EXTRUDEFROMBASE)
+
 dnl }}}
 dnl with-ExtrudeFromTop{{{
+
 AC_ARG_WITH([ExtrudeFromTop],
+
 	AS_HELP_STRING([--with-ExtrudeFromTop = YES], [compile with ExtrudeFromTop capabilities (default is yes)]),
+
 	[EXTRUDEFROMTOP=$withval],[EXTRUDEFROMTOP=yes])
+
 AC_MSG_CHECKING(for ExtrudeFromTop capability compilation)
 
+
 HAVE_EXTRUDEFROMTOP=no 
+
 if test "x$EXTRUDEFROMTOP" = "xyes"; then
+
 	HAVE_EXTRUDEFROMTOP=yes
-	AC_DEFINE([_HAVE_EXTRUDEFROMTOP_],[1],[with ExtrudeFromTopcapability])
+
+	AC_DEFINE([_HAVE_EXTRUDEFROMTOP_],[1],[with ExtrudeFromTop capability])
+
 fi
+
 AM_CONDITIONAL([EXTRUDEFROMTOP], [test x$HAVE_EXTRUDEFROMTOP = xyes])
+
 AC_MSG_RESULT($HAVE_EXTRUDEFROMTOP)
+
 dnl }}}
 dnl with-DepthAverage{{{
+
 AC_ARG_WITH([DepthAverage],
+
 	AS_HELP_STRING([--with-DepthAverage = YES], [compile with DepthAverage capabilities (default is yes)]),
+
 	[DEPTHAVERAGE=$withval],[DEPTHAVERAGE=yes])
+
 AC_MSG_CHECKING(for DepthAverage capability compilation)
 
+
 HAVE_DEPTHAVERAGE=no 
+
 if test "x$DEPTHAVERAGE" = "xyes"; then
+
 	HAVE_DEPTHAVERAGE=yes
-	AC_DEFINE([_HAVE_DEPTHAVERAGE_],[1],[with DepthAveragecapability])
+
+	AC_DEFINE([_HAVE_DEPTHAVERAGE_],[1],[with DepthAverage capability])
+
 fi
+
 AM_CONDITIONAL([DEPTHAVERAGE], [test x$HAVE_DEPTHAVERAGE = xyes])
+
 AC_MSG_RESULT($HAVE_DEPTHAVERAGE)
+
 dnl }}}
 dnl with-Smooth{{{
+
 AC_ARG_WITH([Smooth],
+
 	AS_HELP_STRING([--with-Smooth = YES], [compile with Smooth capabilities (default is yes)]),
+
 	[SMOOTH=$withval],[SMOOTH=yes])
+
 AC_MSG_CHECKING(for Smooth capability compilation)
 
+
 HAVE_SMOOTH=no 
+
 if test "x$SMOOTH" = "xyes"; then
+
 	HAVE_SMOOTH=yes
-	AC_DEFINE([_HAVE_SMOOTH_],[1],[with Smoothcapability])
+
+	AC_DEFINE([_HAVE_SMOOTH_],[1],[with Smooth capability])
+
 fi
+
 AM_CONDITIONAL([SMOOTH], [test x$HAVE_SMOOTH = xyes])
+
 AC_MSG_RESULT($HAVE_SMOOTH)
+
 dnl }}}
 dnl with-Thermal{{{
+
 AC_ARG_WITH([Thermal],
+
 	AS_HELP_STRING([--with-Thermal = YES], [compile with Thermal capabilities (default is yes)]),
+
 	[THERMAL=$withval],[THERMAL=yes])
+
 AC_MSG_CHECKING(for Thermal capability compilation)
 
+
 HAVE_THERMAL=no 
+
 if test "x$THERMAL" = "xyes"; then
+
 	HAVE_THERMAL=yes
-	AC_DEFINE([_HAVE_THERMAL_],[1],[with Thermalcapability])
+
+	AC_DEFINE([_HAVE_THERMAL_],[1],[with Thermal capability])
+
 fi
+
 AM_CONDITIONAL([THERMAL], [test x$HAVE_THERMAL = xyes])
+
 AC_MSG_RESULT($HAVE_THERMAL)
+
 dnl }}}
 dnl with-UzawaPressure{{{
+
 AC_ARG_WITH([UzawaPressure],
+
 	AS_HELP_STRING([--with-UzawaPressure = YES], [compile with UzawaPressure capabilities (default is yes)]),
+
 	[UZAWAPRESSURE=$withval],[UZAWAPRESSURE=yes])
+
 AC_MSG_CHECKING(for UzawaPressure capability compilation)
 
+
 HAVE_UZAWAPRESSURE=no 
+
 if test "x$UZAWAPRESSURE" = "xyes"; then
+
 	HAVE_UZAWAPRESSURE=yes
-	AC_DEFINE([_HAVE_UZAWAPRESSURE_],[1],[with UzawaPressurecapability])
+
+	AC_DEFINE([_HAVE_UZAWAPRESSURE_],[1],[with UzawaPressure capability])
+
 fi
+
 AM_CONDITIONAL([UZAWAPRESSURE], [test x$HAVE_UZAWAPRESSURE = xyes])
+
 AC_MSG_RESULT($HAVE_UZAWAPRESSURE)
+
 dnl }}}
 dnl with-Gia{{{
+
 AC_ARG_WITH([Gia],
+
 	AS_HELP_STRING([--with-Gia = YES], [compile with Gia capabilities (default is yes)]),
+
 	[GIA=$withval],[GIA=yes])
+
 AC_MSG_CHECKING(for Gia capability compilation)
 
+
 HAVE_GIA=no 
+
 if test "x$GIA" = "xyes"; then
+
 	HAVE_GIA=yes
-	AC_DEFINE([_HAVE_GIA_],[1],[with Giacapability])
+
+	AC_DEFINE([_HAVE_GIA_],[1],[with Gia capability])
+
 fi
+
 AM_CONDITIONAL([GIA], [test x$HAVE_GIA = xyes])
+
 AC_MSG_RESULT($HAVE_GIA)
-dnl }}}
-dnl with-Seaice{{{
-AC_ARG_WITH([Seaice],
-	AS_HELP_STRING([--with-Seaice = YES], [compile with Seaice capabilities (default is yes)]),
-	[SEAICE=$withval],[SEAICE=yes])
-AC_MSG_CHECKING(for Seaice capability compilation)
 
-HAVE_SEAICE=no 
-if test "x$SEAICE" = "xyes"; then
-	HAVE_SEAICE=yes
-	AC_DEFINE([_HAVE_SEAICE_],[1],[with Seaicecapability])
-fi
-AM_CONDITIONAL([SEAICE], [test x$HAVE_SEAICE = xyes])
-AC_MSG_RESULT($HAVE_SEAICE)
 dnl }}}
 dnl with-Meshdeformation{{{
+
 AC_ARG_WITH([Meshdeformation],
+
 	AS_HELP_STRING([--with-Meshdeformation = YES], [compile with Meshdeformation capabilities (default is yes)]),
+
 	[MESHDEFORMATION=$withval],[MESHDEFORMATION=yes])
+
 AC_MSG_CHECKING(for Meshdeformation capability compilation)
 
+
 HAVE_MESHDEFORMATION=no 
+
 if test "x$MESHDEFORMATION" = "xyes"; then
+
 	HAVE_MESHDEFORMATION=yes
-	AC_DEFINE([_HAVE_MESHDEFORMATION_],[1],[with Meshdeformationcapability])
+
+	AC_DEFINE([_HAVE_MESHDEFORMATION_],[1],[with Meshdeformation capability])
+
 fi
+
 AM_CONDITIONAL([MESHDEFORMATION], [test x$HAVE_MESHDEFORMATION = xyes])
+
 AC_MSG_RESULT($HAVE_MESHDEFORMATION)
+
 dnl }}}
 dnl with-Levelset{{{
+
 AC_ARG_WITH([Levelset],
+
 	AS_HELP_STRING([--with-Levelset = YES], [compile with Levelset capabilities (default is yes)]),
+
 	[LEVELSET=$withval],[LEVELSET=yes])
+
 AC_MSG_CHECKING(for Levelset capability compilation)
 
+
 HAVE_LEVELSET=no 
+
 if test "x$LEVELSET" = "xyes"; then
+
 	HAVE_LEVELSET=yes
-	AC_DEFINE([_HAVE_LEVELSET_],[1],[with Levelsetcapability])
+
+	AC_DEFINE([_HAVE_LEVELSET_],[1],[with Levelset capability])
+
 fi
+
 AM_CONDITIONAL([LEVELSET], [test x$HAVE_LEVELSET = xyes])
+
 AC_MSG_RESULT($HAVE_LEVELSET)
+
 dnl }}}
 dnl with-Extrapolation{{{
+
 AC_ARG_WITH([Extrapolation],
+
 	AS_HELP_STRING([--with-Extrapolation = YES], [compile with Extrapolation capabilities (default is yes)]),
+
 	[EXTRAPOLATION=$withval],[EXTRAPOLATION=yes])
+
 AC_MSG_CHECKING(for Extrapolation capability compilation)
 
+
 HAVE_EXTRAPOLATION=no 
+
 if test "x$EXTRAPOLATION" = "xyes"; then
+
 	HAVE_EXTRAPOLATION=yes
-	AC_DEFINE([_HAVE_EXTRAPOLATION_],[1],[with Extrapolationcapability])
+
+	AC_DEFINE([_HAVE_EXTRAPOLATION_],[1],[with Extrapolation capability])
+
 fi
+
 AM_CONDITIONAL([EXTRAPOLATION], [test x$HAVE_EXTRAPOLATION = xyes])
+
 AC_MSG_RESULT($HAVE_EXTRAPOLATION)
+
 dnl }}}
 dnl with-LsfReinitialization{{{
+
 AC_ARG_WITH([LsfReinitialization],
+
 	AS_HELP_STRING([--with-LsfReinitialization = YES], [compile with LsfReinitialization capabilities (default is yes)]),
+
 	[LSFREINITIALIZATION=$withval],[LSFREINITIALIZATION=yes])
+
 AC_MSG_CHECKING(for LsfReinitialization capability compilation)
 
+
 HAVE_LSFREINITIALIZATION=no 
+
 if test "x$LSFREINITIALIZATION" = "xyes"; then
+
 	HAVE_LSFREINITIALIZATION=yes
-	AC_DEFINE([_HAVE_LSFREINITIALIZATION_],[1],[with LsfReinitializationcapability])
+
+	AC_DEFINE([_HAVE_LSFREINITIALIZATION_],[1],[with LsfReinitialization capability])
+
 fi
+
 AM_CONDITIONAL([LSFREINITIALIZATION], [test x$HAVE_LSFREINITIALIZATION = xyes])
+
 AC_MSG_RESULT($HAVE_LSFREINITIALIZATION)
+
 dnl }}}
+dnl with-Sealevelrise{{{
 
+AC_ARG_WITH([Sealevelrise],
+
+	AS_HELP_STRING([--with-Sealevelrise = YES], [compile with Sealevelrise capabilities (default is yes)]),
+
+	[SEALEVELRISE=$withval],[SEALEVELRISE=yes])
+
+AC_MSG_CHECKING(for Sealevelrise capability compilation)
+
+
+HAVE_SEALEVELRISE=no 
+
+if test "x$SEALEVELRISE" = "xyes"; then
+
+	HAVE_SEALEVELRISE=yes
+
+	AC_DEFINE([_HAVE_SEALEVELRISE_],[1],[with Sealevelrise capability])
+
+fi
+
+AM_CONDITIONAL([SEALEVELRISE], [test x$HAVE_SEALEVELRISE = xyes])
+
+AC_MSG_RESULT($HAVE_SEALEVELRISE)
+
+dnl }}}
+
 ])

Modified: issm/trunk/m4/issm_options.m4
===================================================================
--- issm/trunk/m4/issm_options.m4	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/m4/issm_options.m4	2016-04-13 04:32:01 UTC (rev 20500)
@@ -172,24 +172,47 @@
 			export CXX=icl
 			export CFLAGS="-DWIN32 -D_INTEL_WIN_"
 			export CXXFLAGS="-DWIN32 -D_INTEL_WIN_"
+			IS_WINDOWS=yes
 		elif  test $VENDOR = intel-win7-32; then
 			export CC=cl
-			export CXX=cccl
+			export CXX=cl
 			export CXXFLAGS="-DWIN32 -D_INTEL_WIN_ -EHsc"
 			export CFLAGS="-DWIN32 -D_INTEL_WIN_ -EHsc"
 			export AR="ar-lib lib"
 			export OS_LDFLAG="-Wl,"
 			export RANLIB=true
+			IS_WINDOWS=yes
 			OSLIBS="-Wl,kernel32.lib -Wl,user32.lib -Wl,gdi32.lib -Wl,winspool.lib -Wl,comdlg32.lib -Wl,advapi32.lib -Wl,shell32.lib -Wl,ole32.lib -Wl,oleaut32.lib -Wl,uuid.lib -Wl,odbc32.lib -Wl,odbccp32.lib"
 		elif  test $VENDOR = intel-win7-64; then
 			export CC=cl
-			export CXX=cccl
+			export CXX=cl
 			export CXXFLAGS="-DWIN32 -D_INTEL_WIN_ -EHsc"
 			export CFLAGS="-DWIN32 -D_INTEL_WIN_ -EHsc"
 			export AR="ar-lib lib"
 			export OS_LDFLAG="-Wl,"
 			export RANLIB=true
+			IS_WINDOWS=yes
 			OSLIBS="-Wl,kernel32.lib -Wl,user32.lib -Wl,gdi32.lib -Wl,winspool.lib -Wl,comdlg32.lib -Wl,advapi32.lib -Wl,shell32.lib -Wl,ole32.lib -Wl,oleaut32.lib -Wl,uuid.lib -Wl,odbc32.lib -Wl,odbccp32.lib"
+		elif  test $VENDOR = MSVC-Win64; then
+			export CC=cl
+			export CXX=cl
+			export CXXFLAGS="-DWIN32 -D_INTEL_WIN_ -D_HAVE_PETSC_MPI_ -EHsc"
+			export CFLAGS="-DWIN32 -D_INTEL_WIN_ -D_HAVE_PETSC_MPI_ -EHsc"
+			export AR="ar-lib lib"
+			export OS_LDFLAG="-Wl,"
+			export RANLIB=true
+			IS_WINDOWS=yes
+			OSLIBS="-Wl,kernel32.lib -Wl,user32.lib -Wl,gdi32.lib -Wl,winspool.lib -Wl,comdlg32.lib -Wl,advapi32.lib -Wl,shell32.lib -Wl,ole32.lib -Wl,oleaut32.lib -Wl,uuid.lib -Wl,odbc32.lib -Wl,odbccp32.lib"
+		elif  test $VENDOR = MSVC-Win64-par; then
+			export CC=cl
+			export CXX=cl
+			export CXXFLAGS="-DWIN32 -D_INTEL_WIN_ -EHsc"
+			export CFLAGS="-DWIN32 -D_INTEL_WIN_ -EHsc"
+			export AR="ar-lib lib"
+			export OS_LDFLAG="-Wl,"
+			export RANLIB=true
+			IS_WINDOWS=yes
+			OSLIBS="-Wl,kernel32.lib -Wl,user32.lib -Wl,gdi32.lib -Wl,winspool.lib -Wl,comdlg32.lib -Wl,advapi32.lib -Wl,shell32.lib -Wl,ole32.lib -Wl,oleaut32.lib -Wl,uuid.lib -Wl,odbc32.lib -Wl,odbccp32.lib"
 		elif test $VENDOR = intel-linux; then
 			export CC=icc
 			export CXX=icpc
@@ -200,6 +223,9 @@
 			export CXX=icpc
 			export CFLAGS=" -D_INTEL_LINUX_"
 			export CXXFLAGS=" -D_INTEL_LINUX_"
+		elif test $VENDOR = intel-lonestar; then
+			export CC=icc
+			export CXX=icpc
 		elif test $VENDOR = intel-discover; then
 			export CC=icc
 			export CXX=icpc
@@ -254,27 +280,31 @@
 	if test "x$HAVE_MATLAB" = "xyes"; then
 
 		AC_DEFINE([_HAVE_MATLAB_],[1],[with matlab in ISSM src])
-  		MATLABINCL="-I$MATLAB_ROOT/extern/include/"
 		
 		dnl 4. get MEXLIB MEXLINK and MEXEXT (experimental) except for windows
 		AC_MSG_CHECKING([matlab's mex compilation flags])
   		case "${host_os}" in
   			*cygwin*) 
   				if  test $VENDOR = intel-win7-32; then
-  					MEXLIB="-Wl,./../../c/libISSMCore.a -Wl,libISSMApi.a -Wl,libISSMMatlab.a -Wl,./../../c/libISSMModules.a -Wl,libmx.lib -Wl,libmex.lib -Wl,libmat.lib ${OSLIBS} -Wl,libf2cblas.lib -Wl,libf2clapack.lib" 
-               MEXLINK="-Wl,/LIBPATH:`cygpath -m ${MATLAB_ROOT}/extern/lib/win32/microsoft` -no-undefined -Wl,/export:mexFunction -Wl,/LD"
+  					MEXLIB="-Wl,libmx.lib -Wl,libmex.lib -Wl,libmat.lib ${OSLIBS} -Wl,libf2cblas.lib -Wl,libf2clapack.lib" 
+               MEXLINK="-Wl,/LIBPATH:`cygpath -m ${MATLAB_ROOT}/extern/lib/win32/microsoft` -Wl,/link -Wl,/EXPORT:mexFunction -Wl,/DLL"
 					MEXEXT=`$MATLAB_ROOT/bin/mexext.bat`
 					MEXEXT=".$MEXEXT"
-  				elif  test l-win7-64; then
-  					MEXLIB="-Wl,./../../c/libISSMCore.a -Wl,libISSMApi.a -Wl,libISSMMatlab.a -Wl,./../../c/libISSMModules.a -Wl,libmx.lib -Wl,libmex.lib -Wl,libmat.lib ${OSLIBS} -Wl,libf2cblas.lib -Wl,libf2clapack.lib" 
-               MEXLINK="-Wl,/LIBPATH:`cygpath -m ${MATLAB_ROOT}/extern/lib/win64/microsoft` -no-undefined -Wl,/export:mexFunction -Wl,/LD" 
+  				elif test $VENDOR = intel-win7-64; then
+  					MEXLIB="-Wl,libmx.lib -Wl,libmex.lib -Wl,libmat.lib ${OSLIBS} -Wl,libf2cblas.lib -Wl,libf2clapack.lib" 
+               MEXLINK="-Wl,/LIBPATH:`cygpath -m ${MATLAB_ROOT}/extern/lib/win64/microsoft` -Wl,/link -Wl,/EXPORT:mexFunction -Wl,/DLL" 
 					MEXEXT=".mexw64"
+  				elif test $VENDOR = MSVC-Win64 || test $VENDOR = MSVC-Win64-par; then
+  					MEXLIB="-Wl,libmx.lib -Wl,libmex.lib -Wl,libmat.lib ${OSLIBS} -Wl,libf2cblas.lib -Wl,libf2clapack.lib" 
+               MEXLINK="-Wl,/link -Wl,/LIBPATH:`cygpath -m ${MATLAB_ROOT}/extern/lib/win64/microsoft` -Wl,/link -Wl,/EXPORT:mexFunction -Wl,/DLL" 
+  					MATLABINCL="-I`cygpath -m $MATLAB_ROOT/extern/include/`"
+					MEXEXT=".mexw64"
   				fi
-
   			;;
 		   *)
+           MATLABINCL="-I$MATLAB_ROOT/extern/include/"
            MEXLINK=$($MATLAB_ROOT/bin/mex -v 2>&1 < /dev/null | grep LDFLAGS     | sed -e "s/         LDFLAGS            = //g")
-           MEXLIB=$( $MATLAB_ROOT/bin/mex -v 2>&1 < /dev/null | grep CXXLIBS     | sed -e "s/         CXXLIBS            = //g")
+			  MEXLIB=$( $MATLAB_ROOT/bin/mex -v 2>&1 < /dev/null | grep CXXLIBS     | sed -e "s/         CXXLIBS            = //g")
 		     MEXEXT=$( $MATLAB_ROOT/bin/mex -v 2>&1 < /dev/null | grep LDEXTENSION | sed -e "s/         LDEXTENSION        = //g")
 				dnl version 2014 and up
 				if test "x$MEXEXT" = "x" ; then
@@ -289,7 +319,8 @@
 				fi
 
 				dnl Make sure mexFunction.map is not in MEXLIB to avoid problems with global variables
-				MEXLINK=$(echo $MEXLINK | sed -e "s/,-expo.*mexFunction\\.map\"//g" | sed -e "s/-[[^ ]]*mexFunction\\.map//g")
+				dnl MEXLINK=$(echo $MEXLINK | sed -e "s/,-expo.*mexFunction\\.map\"//g" | sed -e "s/-[[^ ]]*mexFunction\\.map//g")
+				MEXLINK="" dnl We actually don't need MEXLINK????
 
   			;;
       esac
@@ -298,6 +329,8 @@
 			AC_MSG_ERROR([Couldn't find mex... check your installation of matlab])
 	   fi
 
+		AC_MSG_CHECKING([whether matlab is enabled])
+
 		AC_SUBST([MATLABINCL])
 		MATLABWRAPPEREXT=$MEXEXT
 		AC_SUBST([MATLABWRAPPEREXT])
@@ -305,6 +338,30 @@
 		AC_SUBST([MEXLINK])
 	fi
 	dnl }}}
+	dnl windows {{{
+	AC_MSG_CHECKING([Checking if this is a Win build... ])
+	AM_CONDITIONAL([WINDOWS], [test x$IS_WINDOWS = xyes])
+	AC_MSG_RESULT(done)
+	dnl }}}
+	dnl javascript{{{
+	AC_ARG_WITH([javascript],
+	  AS_HELP_STRING([--with-javascript], [compile javascript wrappers? default is no.]),
+	  [JAVASCRIPT=$withval],[JAVASCRIPT="no"]) 
+
+	dnl Check whether javascript wrappers are desired
+	AC_MSG_CHECKING([for javascript])
+	if test "x$JAVASCRIPT" = "xno" ; then
+		HAVE_JAVASCRIPT=no
+	else
+		HAVE_JAVASCRIPT=yes
+		AC_DEFINE([_HAVE_JAVASCRIPT_],[1],[with javascript])
+	fi
+	AC_MSG_RESULT($HAVE_JAVASCRIPT)
+	AM_CONDITIONAL([JAVASCRIPT],[test x$HAVE_JAVASCRIPT = xyes])
+	JAVASCRIPTWRAPPEREXT=.js
+	AC_SUBST([JAVASCRIPTWRAPPEREXT])
+
+	dnl }}}
 	dnl triangle {{{
 	AC_ARG_WITH([triangle-dir],
 			  AS_HELP_STRING([--with-triangle-dir=DIR], [triangle root directory.]),
@@ -331,13 +388,19 @@
 		TRIANGLEINCL=-I$TRIANGLE_ROOT/
 		case "${host_os}" in
 				*cygwin*)
+				TRIANGLEINCL="/I`cygpath -m $TRIANGLE_ROOT/`"
 				TRIANGLELIB="-Wl,`cygpath -m $TRIANGLE_ROOT/`triangle.lib"
 				;;
 				*linux*)
 				TRIANGLELIB=$TRIANGLE_ROOT/triangle.a
 				;;
 				*darwin*)
-				TRIANGLELIB=$TRIANGLE_ROOT/triangle.a
+				if test "x$HAVE_JAVASCRIPT" = "xyes"; then
+					dnl go to the bit code, not the library.
+					TRIANGLELIB=$TRIANGLE_ROOT/triangle.o 
+				else
+					TRIANGLELIB=$TRIANGLE_ROOT/triangle.a
+				fi
 				;;
 			esac
 		AC_DEFINE([_HAVE_TRIANGLE_],[1],[with Triangle in ISSM src])
@@ -395,37 +458,48 @@
 		DAKOTAINCL=-I$DAKOTA_ROOT/include
 
 		AC_MSG_CHECKING(for dakota version)
-		if test -f "$DAKOTA_ROOT/../src/src/CommandLineHandler.C"; then
-			DAKOTA_VERSION=`cat $DAKOTA_ROOT/../src/src/CommandLineHandler.C | grep 'DAKOTA version' | grep 'release' | grep -v // | sed 's/.*DAKOTA version //' | sed 's/ .*//' `
+		if test -f "$DAKOTA_ROOT/VERSION"; then
+		 DAKOTA_VERSION=`cat $DAKOTA_ROOT/VERSION | grep 'DAKOTA Version' | sed 's/.*DAKOTA Version //' | sed 's/ .*//' `
+		else if test -f "$DAKOTA_ROOT/../src/src/CommandLineHandler.C"; then
+		 DAKOTA_VERSION=`cat $DAKOTA_ROOT/../src/src/CommandLineHandler.C | grep 'DAKOTA version' | grep 'release' | grep -v // | sed 's/.*DAKOTA version //' | sed 's/ .*//' `
 		else if test -f "$DAKOTA_ROOT/../src/src/CommandLineHandler.cpp"; then
-			DAKOTA_VERSION=`cat $DAKOTA_ROOT/../src/src/CommandLineHandler.cpp | grep 'DAKOTA version' | grep 'release' | grep -v // | sed 's/.*DAKOTA version //' | sed 's/ .*//' `
+		 DAKOTA_VERSION=`cat $DAKOTA_ROOT/../src/src/CommandLineHandler.cpp | grep 'DAKOTA version' | grep 'release' | grep -v // | sed 's/.*DAKOTA version //' | sed 's/ .*//' `
 		else
-			AC_MSG_ERROR([Dakota CommandLineHandler.C or CommandLineHandler.cpp file not found to determine DAKOTA_VERSION!]);
+		 AC_MSG_ERROR([Dakota CommandLineHandler.C or CommandLineHandler.cpp file not found to determine DAKOTA_VERSION!]);
 		fi
 		fi
+		fi
 		AC_MSG_RESULT($DAKOTA_VERSION)
 		AC_DEFINE_UNQUOTED([_DAKOTA_VERSION_],"$DAKOTA_VERSION",[Dakota version number])
 
 		DAKOTAFLAGS=""
 		case "${host_os}" in
 			*cygwin*)
-				if      test x$DAKOTA_VERSION = x4.2 || test x$DAKOTA_VERSION = x4.2+; then
-					DAKOTALIB="-L$DAKOTA_ROOT/lib -ldakota -lteuchos -lpecos -lfftw3 -llhs -levidence -lsurfpack -lconmin -lddace -lfsudace -ljega -lcport -lopt -lpsuade -lnewmat -lncsuopt -lgsl -lquadrature -lcoliny -lcolin -lpebbl -lutilib -l3po -lnappspack -lappspack -lconveyor -lshared -lcdd -lamplsolver"
-				else if test x$DAKOTA_VERSION = x5.1 || test x$DAKOTA_VERSION = x5.2; then
+				if test x$DAKOTA_VERSION = x5.1 || test x$DAKOTA_VERSION = x5.2; then
 					DAKOTALIB="-L$DAKOTA_ROOT/lib -L$BOOST_ROOT/lib -ldakota -lteuchos -lpecos -llhs -lsparsegrid -lsurfpack -lconmin -lddace -lfsudace -ljega -lcport -loptpp -lpsuade -lncsuopt -lcolin -linterfaces -lmomh -lscolib -lpebbl -ltinyxml -lutilib -l3po -lhopspack -lnidr -lamplsolver -lboost_signals -lboost_regex -lboost_filesystem"
+				else if test x$DAKOTA_VERSION = x6.1 || test x$DAKOTA_VERSION = x6.2; then
+				   DAKOTAFLAGS="-DDISABLE_DAKOTA_CONFIG_H -DBOOST_MULTI_INDEX_DISABLE_SERIALIZATION -DDAKOTA_PLUGIN -DBOOST_DISABLE_ASSERTS -DDAKOTA_HAVE_BOOST_FS -DHAVE_UNISTD_H -DHAVE_SYSTEM -DHAVE_WORKING_FORK -DHAVE_WORKING_VFORK -DHAVE_SYS_WAIT_H -DHAVE_USLEEP -DDAKOTA_F90 -DDAKOTA_HAVE_MPI -DHAVE_PECOS -DHAVE_SURFPACK -DDAKOTA_COLINY -DDAKOTA_UTILIB -DHAVE_ADAPTIVE_SAMPLING -DHAVE_CONMIN -DDAKOTA_DDACE -DHAVE_FSUDACE -DDAKOTA_HOPS -DHAVE_JEGA -DHAVE_NCSU -DHAVE_NL2SOL -DHAVE_OPTPP -DDAKOTA_OPTPP -DHAVE_PSUADE -DHAVE_AMPL"
+					DAKOTALIB="-L$DAKOTA_ROOT/lib -L$BOOST_ROOT/lib -ldakota_src -ldream -lfsudace -lddace -lnomad -lpecos_src -lscolib -ljega_fe -llhs -lpebbl -lcolin -linterfaces -llhs_mods -lmoga -loptpp -lsoga -lsurfpack -lutilib -lconmin -ldakota_src_fortran -llhs_mod -lncsuopt -lsurfpack_fortran -lteuchos -l3po -lamplsolver -lcport -ldfftpack -leutils -lfsudace -lhopspack -ljega -lnidr -lpecos -lpsuade -ltinyxml -lutilities -lsparsegrid -lboost_serialization -lboost_signals -lboost_regex -lboost_filesystem -lboost_system"
+					AC_DEFINE([DISABLE_DAKOTA_CONFIG_H],[1],[disabling DAKOTA_CONFIG_H])
+					AC_DEFINE([DAKOTA_HAVE_MPI],[1],[enabling parallel MPI])
 				else
 					AC_MSG_ERROR([Dakota version not found or version ($DAKOTA_VERSION) not supported!]);
 				fi
 				fi
 			;;
 			*linux*)
-				if      test x$DAKOTA_VERSION = x4.2 || test x$DAKOTA_VERSION = x4.2+; then
-					DAKOTALIB="-L$DAKOTA_ROOT/lib -ldakota -lteuchos -lpecos -lfftw3 -llhs -levidence -lsurfpack -lconmin -lddace -lfsudace -ljega -lcport -lopt -lpsuade -lnewmat -lncsuopt -lgsl -lquadrature -lcoliny -lcolin -lpebbl -lutilib -l3po -lnappspack -lappspack -lconveyor -lshared -lcdd -lamplsolver"
-				else if test x$DAKOTA_VERSION = x5.1 || test x$DAKOTA_VERSION = x5.2; then
+				if test x$DAKOTA_VERSION = x5.1 || test x$DAKOTA_VERSION = x5.2; then
 					DAKOTALIB="-L$DAKOTA_ROOT/lib -ldakota -lteuchos -lpecos -llhs -lsparsegrid -lsurfpack -lconmin -lddace -lfsudace -ljega -lcport -loptpp -lpsuade -lncsuopt -lcolin -linterfaces -lmomh -lscolib -lpebbl -ltinyxml -lutilib -l3po -lhopspack -lnidr -lamplsolver -lboost_signals -lboost_regex -lboost_filesystem -lboost_system -ldl"
 				else if test x$DAKOTA_VERSION = x5.3 || test x$DAKOTA_VERSION = x5.3.1; then
 					DAKOTAFLAGS="-DDISABLE_DAKOTA_CONFIG_H -DBOOST_MULTI_INDEX_DISABLE_SERIALIZATION -DDAKOTA_PLUGIN -DBOOST_DISABLE_ASSERTS -DDAKOTA_HAVE_BOOST_FS -DHAVE_UNISTD_H -DHAVE_SYSTEM -DHAVE_WORKING_FORK -DHAVE_WORKING_VFORK -DHAVE_SYS_WAIT_H -DHAVE_USLEEP -DDAKOTA_F90 -DDAKOTA_HAVE_MPI -DHAVE_PECOS -DHAVE_SURFPACK -DDAKOTA_COLINY -DDAKOTA_UTILIB -DHAVE_ADAPTIVE_SAMPLING -DHAVE_CONMIN -DDAKOTA_DDACE -DHAVE_FSUDACE -DDAKOTA_HOPS -DHAVE_JEGA -DHAVE_NCSU -DHAVE_NL2SOL -DHAVE_OPTPP -DDAKOTA_OPTPP -DHAVE_PSUADE -DHAVE_AMPL"
 					DAKOTALIB="-L$DAKOTA_ROOT/lib -L$BOOST_ROOT/lib -ldakota_src -lpecos_src -lscolib -ljega_fe -llhs -lpebbl -lcolin -linterfaces -lmods -lmoga -loptpp -lsampling -lsoga -lsurfpack -lutilib -lconmin -ldakota_src_fortran -lmod -lncsuopt -lsurfpack_fortran -lteuchos -l3po -lamplsolver -lanalyzer -lbose -lcport -ldace -ldfftpack -leutils -lfsudace -lhopspack -ljega -lnidr -lpecos -lpsuade -lrandom -ltinyxml -lutilities -lsparsegrid -lboost_signals -lboost_regex -lboost_filesystem -lboost_system"
+					AC_DEFINE([DISABLE_DAKOTA_CONFIG_H],[1],[disabling DAKOTA_CONFIG_H])
+					AC_DEFINE([DAKOTA_HAVE_MPI],[1],[enabling parallel MPI])
+				else if test x$DAKOTA_VERSION = x6.1 || test x$DAKOTA_VERSION = x6.2; then
+				   DAKOTAFLAGS="-DDISABLE_DAKOTA_CONFIG_H -DBOOST_MULTI_INDEX_DISABLE_SERIALIZATION -DDAKOTA_PLUGIN -DBOOST_DISABLE_ASSERTS -DDAKOTA_HAVE_BOOST_FS -DHAVE_UNISTD_H -DHAVE_SYSTEM -DHAVE_WORKING_FORK -DHAVE_WORKING_VFORK -DHAVE_SYS_WAIT_H -DHAVE_USLEEP -DDAKOTA_F90 -DDAKOTA_HAVE_MPI -DHAVE_PECOS -DHAVE_SURFPACK -DDAKOTA_UTILIB -DHAVE_ADAPTIVE_SAMPLING -DHAVE_CONMIN -DDAKOTA_DDACE -DHAVE_FSUDACE -DDAKOTA_HOPS -DHAVE_NCSU -DHAVE_NL2SOL -DHAVE_OPTPP -DDAKOTA_OPTPP -DHAVE_PSUADE -DHAVE_AMPL"
+					DAKOTALIB="-L$DAKOTA_ROOT/lib -L$BOOST_ROOT/lib -ldakota_src -ldream -lfsudace -lddace -lnomad -lpecos_src -llhs -llhs_mods -loptpp -lsurfpack -lconmin -ldakota_src_fortran -llhs_mod -lncsuopt -lsurfpack_fortran -lteuchos -lamplsolver -lcport -ldfftpack -lfsudace -lhopspack -lnidr -lpecos -lpsuade -lsparsegrid -lboost_serialization -lboost_signals -lboost_regex -lboost_filesystem -lboost_system"
+					AC_DEFINE([DISABLE_DAKOTA_CONFIG_H],[1],[disabling DAKOTA_CONFIG_H])
+					AC_DEFINE([DAKOTA_HAVE_MPI],[1],[enabling parallel MPI])
 				else
 					AC_MSG_ERROR([Dakota version not found or version ($DAKOTA_VERSION) not supported!]);
 				fi
@@ -433,20 +507,24 @@
 				fi
 			;;
 			*darwin*)
-				if      test x$DAKOTA_VERSION = x4.2 || test x$DAKOTA_VERSION = x4.2+; then
-					DAKOTALIB="-L$DAKOTA_ROOT/lib -ldakota -lteuchos -lpecos -lfftw3 -llhs -levidence -lsurfpack -lconmin -lddace -lfsudace -ljega -lcport -lopt -lpsuade -lnewmat -lncsuopt -lgsl -lquadrature -lcoliny -lcolin -lpebbl -lutilib -l3po -lnappspack -lappspack -lconveyor -lshared -lcdd -lamplsolver" 
-					dnl DAKOTALIB+= "-lgslcblas -L/usr/lib -lblas -llapack"
-				else if test x$DAKOTA_VERSION = x5.1 || test x$DAKOTA_VERSION = x5.2; then
+				if test x$DAKOTA_VERSION = x5.1 || test x$DAKOTA_VERSION = x5.2; then
 					DAKOTALIB="-L$DAKOTA_ROOT/lib -ldakota -lteuchos -lpecos -llhs -lsparsegrid -lsurfpack -lconmin -lddace -lfsudace -ljega -lcport -loptpp -lpsuade -lncsuopt -lcolin -linterfaces -lmomh -lscolib -lpebbl -ltinyxml -lutilib -l3po -lhopspack -lnidr -lamplsolver -lboost_signals -lboost_regex -lboost_filesystem -lboost_system"
 					dnl DAKOTALIB+= "-lgslcblas -L/usr/lib -lblas -llapack"
 				else if test x$DAKOTA_VERSION = x5.3 || test x$DAKOTA_VERSION = x5.3.1; then
 					DAKOTAFLAGS="-DDISABLE_DAKOTA_CONFIG_H -DBOOST_MULTI_INDEX_DISABLE_SERIALIZATION -DDAKOTA_PLUGIN -DBOOST_DISABLE_ASSERTS -DDAKOTA_HAVE_BOOST_FS -DHAVE_UNISTD_H -DHAVE_SYSTEM -DHAVE_WORKING_FORK -DHAVE_WORKING_VFORK -DHAVE_SYS_WAIT_H -DHAVE_USLEEP -DDAKOTA_F90 -DDAKOTA_HAVE_MPI -DHAVE_PECOS -DHAVE_SURFPACK -DDAKOTA_COLINY -DDAKOTA_UTILIB -DHAVE_ADAPTIVE_SAMPLING -DHAVE_CONMIN -DDAKOTA_DDACE -DHAVE_FSUDACE -DDAKOTA_HOPS -DHAVE_JEGA -DHAVE_NCSU -DHAVE_NL2SOL -DHAVE_OPTPP -DDAKOTA_OPTPP -DHAVE_PSUADE -DHAVE_AMPL"
 					DAKOTALIB="-L$DAKOTA_ROOT/lib -L$BOOST_ROOT/lib -ldakota_src -lpecos_src -lscolib -ljega_fe -llhs -lpebbl -lcolin -linterfaces -lmods -lmoga -loptpp -lsampling -lsoga -lsurfpack -lutilib -lconmin -ldakota_src_fortran -lmod -lncsuopt -lsurfpack_fortran -lteuchos -l3po -lamplsolver -lanalyzer -lbose -lcport -ldace -ldfftpack -leutils -lfsudace -lhopspack -ljega -lnidr -lpecos -lpsuade -lrandom -ltinyxml -lutilities -lsparsegrid -lboost_signals -lboost_regex -lboost_filesystem -lboost_system"
+					AC_DEFINE([DISABLE_DAKOTA_CONFIG_H],[1],[disabling DAKOTA_CONFIG_H])
+					AC_DEFINE([DAKOTA_HAVE_MPI],[1],[enabling parallel MPI])
+				else if test x$DAKOTA_VERSION = x6.1 || test x$DAKOTA_VERSION = x6.2; then
+				   DAKOTAFLAGS="-DDISABLE_DAKOTA_CONFIG_H -DBOOST_MULTI_INDEX_DISABLE_SERIALIZATION -DDAKOTA_PLUGIN -DBOOST_DISABLE_ASSERTS -DDAKOTA_HAVE_BOOST_FS -DHAVE_UNISTD_H -DHAVE_SYSTEM -DHAVE_WORKING_FORK -DHAVE_WORKING_VFORK -DHAVE_SYS_WAIT_H -DHAVE_USLEEP -DDAKOTA_F90 -DDAKOTA_HAVE_MPI -DHAVE_PECOS -DHAVE_SURFPACK -DDAKOTA_UTILIB -DHAVE_ADAPTIVE_SAMPLING -DHAVE_CONMIN -DDAKOTA_DDACE -DHAVE_FSUDACE -DDAKOTA_HOPS -DHAVE_NCSU -DHAVE_NL2SOL -DHAVE_OPTPP -DDAKOTA_OPTPP -DHAVE_PSUADE -DHAVE_AMPL"
+					DAKOTALIB="-L$DAKOTA_ROOT/lib -L$BOOST_ROOT/lib -ldakota_src -ldream -lfsudace -lddace -lnomad -lpecos_src -llhs -llhs_mods -loptpp -lsurfpack -lconmin -ldakota_src_fortran -llhs_mod -lncsuopt -lsurfpack_fortran -lteuchos -lamplsolver -lcport -ldfftpack -lfsudace -lhopspack -lnidr -lpecos -lpsuade -lsparsegrid -lboost_serialization -lboost_signals -lboost_regex -lboost_filesystem -lboost_system"
+					AC_DEFINE([DISABLE_DAKOTA_CONFIG_H],[1],[disabling DAKOTA_CONFIG_H])
+					AC_DEFINE([DAKOTA_HAVE_MPI],[1],[enabling parallel MPI])
 				else
 					AC_MSG_ERROR([Dakota version not found or version ($DAKOTA_VERSION) not supported!]);
 				fi
 				fi
-                                fi
+				fi
 			;;
 		esac
 
@@ -485,6 +563,7 @@
 		AC_SUBST([DAKOTAFLAGS])
 		AC_SUBST([DAKOTALIB])
 	fi
+	AM_CONDITIONAL([ISSM_DAKOTA],[test x$DAKOTA_MAJOR = x6])
 	dnl }}}
 	dnl python{{{
 	AC_ARG_WITH([python-dir],
@@ -507,7 +586,7 @@
 
 	dnl python specifics
 	if test "x$HAVE_PYTHON" = "xyes"; then
-		AC_MSG_CHECKING(for python version)
+		AC_MSG_CHECKING([for python version])
 		dnl Query Python for its version number.  Getting [:3] seems to be the
 		dnl best way to do this; it's what "site.py" does in the standard library.
 		PYTHON_VERSION=$($PYTHON_ROOT/bin/python -c "import sys; print sys.version[[:3]]")
@@ -522,7 +601,18 @@
 			HAVE_PYTHON3="no"
 		fi
 
-		PYTHONINCL=-I$PYTHON_ROOT/include
+		AC_MSG_CHECKING([for python header file Python.h])
+		dnl Python.h mighty be in different locations:
+		if test -f "$PYTHON_ROOT/include/Python.h"; then
+			PYTHONINCL=-I$PYTHON_ROOT/include
+		else if test -f "$PYTHON_ROOT/include/python$PYTHON_VERSION/Python.h"; then
+			PYTHONINCL=-I$PYTHON_ROOT/include/python$PYTHON_VERSION
+		else
+			AC_MSG_ERROR([Python.h not found, locate this file and contact ISSM developers]);
+		fi
+		fi
+		AC_MSG_RESULT(found)
+
 		PYTHONLIB="-L$PYTHON_ROOT/lib -lpython$PYTHON_VERSION"
 		PYTHONEXT=.so
 		case "${host_os}" in
@@ -623,6 +713,33 @@
 		AC_SUBST([SCOTCHLIB])
 	fi
 	dnl }}}
+	dnl esmf{{{
+	AC_ARG_WITH([esmf-dir],
+		AS_HELP_STRING([--with-esmf-dir=DIR], [esmf root directory.]),
+		[ESMF_ROOT=$withval],[ESMF_ROOT="no"]) 
+
+	dnl Check whether esmf is enabled
+	AC_MSG_CHECKING([for esmf])
+	if test "x$ESMF_ROOT" = "xno" ; then
+		HAVE_ESMF=no
+	else
+		HAVE_ESMF=yes
+		if ! test -d "$ESMF_ROOT"; then
+			AC_MSG_ERROR([esmf directory provided ($ESMF_ROOT) does not exist]);
+		fi
+	fi
+	AC_MSG_RESULT($HAVE_ESMF)
+	
+	dnl esmf headers and libraries
+	if test "x$HAVE_ESMF" == "xyes"; then
+		ESMFINCL="-I$ESMF_ROOT/include"
+		ESMFLIB="-L$ESMF_ROOT/lib -lesmf"
+		AC_DEFINE([_HAVE_ESMF_],[1],[with esmf in ISSM src])
+		AC_SUBST([ESMFINCL])
+		AC_SUBST([ESMFLIB])
+	fi
+	AM_CONDITIONAL([ESMF], [test x$HAVE_ESMF = xyes])
+	dnl }}}
 	dnl adolc{{{
 	AC_ARG_WITH([adolc-dir],
 		AS_HELP_STRING([--with-adolc-dir=DIR], [adolc root directory.]),
@@ -650,6 +767,7 @@
 		AC_SUBST([ADOLCLIB])
 	fi
 	AM_CONDITIONAL([ADOLC], [test x$HAVE_ADOLC = xyes])
+        AM_COND_IF(ADOLC,[CXXFLAGS+=" -std=c++11"])
 	dnl }}}
 	dnl adolc-version{{{
 	AC_ARG_WITH([adolc-version],
@@ -839,19 +957,27 @@
 		dnl Processing for windows
 		if  test x$VENDOR = xintel-win7-32; then
 			MPI_LIBDIR=`cygpath -m $MPI_LIBDIR`
-			MPIINCL=`cygpath -m $MPI_INCLUDE`
+			MPI_INCLUDE=`cygpath -m $MPI_INCLUDE`
 		elif test x$VENDOR = xintel-win7-64; then
+			MPI_LIBDIR="/I`cygpath -m $MPI_LIBDIR`"
+			MPI_INCLUDE=`cygpath -m $MPI_INCLUDE`
+		elif test x$VENDOR = xMSVC-Win64 || test x$VENDOR = xMSVC-Win64-par; then
 			MPI_LIBDIR=`cygpath -m $MPI_LIBDIR`
 			MPI_INCLUDE=`cygpath -m $MPI_INCLUDE`
 		fi
 
 		if test -z "$MPI_LIBDIR"; then
-			MPIINCL=-I"$MPI_INCLUDE"
 			MPILIB="$MPI_LIBFLAGS"
 		else
-			MPIINCL=-I"$MPI_INCLUDE"
 			MPILIB="-L$MPI_LIBDIR $MPI_LIBFLAGS"
 		fi
+
+		if  test x$IS_WINDOWS = xyes; then
+			MPIINCL=/I"$MPI_INCLUDE"
+		else 
+			MPIINCL=-I"$MPI_INCLUDE"
+		fi
+
 		AC_DEFINE([_HAVE_MPI_],[1],[with Mpi in ISSM src])
 		AC_DEFINE([HAVE_MPI],[1],[Mpi Flag for Dakota (DO NOT REMOVE)])
 		AC_SUBST([MPIINCL])
@@ -924,8 +1050,8 @@
 				if test $PETSC_MAJOR -lt 3 ; then
 					PETSCLIB=-Wl,/LIBPATH:`cygpath -w $PETSC_ROOT/lib`  -Wl,libpetscksp.lib  -Wl,libpetscdm.lib  -Wl,libpetscmat.lib  -Wl,libpetscvec.lib  -Wl,libpetscsnes.lib  -Wl,libpetscts.lib  -Wl,libmpiuni.lib  -Wl,libpetsc.lib
 				else
-					PETSCLIB="-L$PETSC_ROOT/lib  -Wl,libpetsc.lib"
-					if test $PETSC_MAJOR -gt 3 || test $PETSC_MINOR -ge 3; then PETSCLIB+="  -Wl,libmetis.lib"; fi
+					PETSCLIB="/link -Wl,/LIBPATH:`cygpath -m $PETSC_ROOT/lib`  -Wl,libpetsc.lib"
+					PETSCINCL="/I`cygpath -m $PETSC_ROOT/include`"
 				fi
 				;;
 				*linux*)
@@ -935,6 +1061,9 @@
 					PETSCLIB="-L$PETSC_ROOT/lib -lpetsc -ldl"
 					if test $PETSC_MAJOR -gt 3 || test $PETSC_MINOR -ge 3; then PETSCLIB+=" -lmetis"; fi
 				fi
+				if test "x$host_os_version" = "x3.0.101-0.31.1_1.0502.8394-cray_gem_s" ; then
+					PETSCLIB="-L$PETSC_ROOT/lib -lcraypetsc_gnu_real -lmetis"
+				fi 
 				;;
 				*darwin*)
 				if test $PETSC_MAJOR -lt 3 ; then
@@ -952,7 +1081,7 @@
 	fi
 	dnl }}}
 	dnl metis{{{
-	if test "$HAVE_PETSC" = "yes" && test "x$PETSC_MAJOR" = "x3" && test $PETSC_MINOR -ge 3; then
+	if test "$HAVE_PETSC" = "yes" && test "x$PETSC_MAJOR" = "x3" && test $PETSC_MINOR -ge 3 && test "x$VENDOR" != "xMSVC-Win64" && test "x$VENDOR" != "xMSVC-Win64-par"; then
 		dnl in petsc >=3.3, metis is provided
 		HAVE_METIS="yes"
 		AC_DEFINE([_METIS_VERSION_],[5],[ Metis version number])
@@ -990,7 +1119,8 @@
 				METISINCL=-I"$METIS_ROOT/Lib" 
 				case "${host_os}" in
 					*cygwin*)
-					METISLIB="-L$METIS_ROOT -Wl,libmetis.lib"
+					METISINCL="/I`cygpath -m $METIS_ROOT/Lib`" 
+					METISLIB="-Wl,/link -Wl,/LIBPATH:`cygpath -m $METIS_ROOT` -Wl,libmetis.lib"
 					;;
 					*linux*)
 					METISLIB=-L"$METIS_ROOT/ -lmetis"
@@ -1212,7 +1342,10 @@
 	if test "x$HAVE_BLASLAPACK" == "xyes"; then
 		BLASLAPACKINCL=""
 		if test x$VENDOR = xintel-discover; then
-			BLASLAPACKLIB=-L"$BLASLAPACK_ROOT -lmkl_lapack -lmkl -lguide -lpthread"
+		   dnl works for intel 11
+			dnl BLASLAPACKLIB=-L"$BLASLAPACK_ROOT -lmkl_lapack -lmkl -lguide -lpthread "
+			dnl dnl works for intel 13
+			BLASLAPACKLIB=-L"$BLASLAPACK_ROOT -lmkl_lapack95_lp64 -lmkl_rt " 
 		else
 			dnl: branch on whether we are running on windows or linux.
 			case "${host_os}" in
@@ -1251,13 +1384,18 @@
 	
 	dnl mkl headers and libraries
 	if test "x$HAVE_MKL" == "xyes"; then
+	 dnl look at $ISSM_DIR/externalpackages/petsc/install/lib/petsc/conf/petscvariables BLASLAPACK_LIB
 		MKLINCL=""
 		if test x$VENDOR = xintel-pleiades; then
-			MKLLIB=-L"$MKL_ROOT -lmkl_core -lmkl_blas95_lp64 -lmkl_lapack95_lp64 -liomp5 -lpthread -lmkl_intel_thread -lmkl_intel_sp2dp"
+         MKLLIB="-Wl,-rpath,$MKL_ROOT -L/$MKL_ROOT -lmkl_intel_lp64 -lmkl_sequential -lmkl_core -lpthread -lm"
+		elif test x$VENDOR = xintel-discover; then
+			MKLLIB=-L"$MKL_ROOT -lmkl_intel_lp64 -lmkl_sequential -lmkl_core -L/usr/lib64/ -lpthread -lm"
 		elif test x$VENDOR = xintel-acenet; then
 			MKLLIB=-L"$MKL_ROOT -lmkl_intel_lp64 -lmkl_sequential -lmkl_core -lpthread -lm"
 		elif test x$VENDOR = xintel-gp; then
 			MKLLIB=-L"$MKL_ROOT -lmkl_intel_lp64 -lmkl_sequential -lmkl_core -lpthread -lm"
+		elif test x$VENDOR = xintel-lonestar; then
+			MKLLIB=-L"$MKL_ROOT -lmkl_intel_lp64 -lmkl_sequential -lmkl_core -lpthread -lm"
 		else
 			MKLLIB=-L"$MKL_ROOT -lmkl -lmkl_lapack -lmkl_scalapack_ilp64 -lmkl_blacs_sgimpt_ilp64 -lguide -lpthread"
 		fi
@@ -1845,7 +1983,7 @@
 	dnl bypass standard optimization -g -O2 ? 
 	AC_ARG_WITH([cxxoptflags],
 	  AS_HELP_STRING([--with-cxxoptflags = CXXOPTFLAGS], [optimization using CXX flags, ex: --with-cxxoptflags=-march=opteron -O3]),
-	  [CXXOPTFLAGS=$withval],[CXXOPTFLAGS="-g -O2"]) 
+	  [CXXOPTFLAGS=$withval],[CXXOPTFLAGS="-g -O2 -fPIC"]) 
 	AC_MSG_CHECKING(for c++ optimization flags)
 	AC_SUBST([CXXOPTFLAGS])
 	AC_MSG_RESULT(done)
@@ -1870,7 +2008,7 @@
 		MULTITHREADINGLIB="-lpthread -lrt"
 		;;
 		*darwin*)
-		MULTITHREADINGLIB="-L/usr/lib/ -lpthread"
+		MULTITHREADINGLIB="-lpthread"
 		;;
 		esac
 		AC_DEFINE([_MULTITHREADING_],[1],[with numthreads enabled])

Modified: issm/trunk/packagers/macosx/install.sh
===================================================================
--- issm/trunk/packagers/macosx/install.sh	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/packagers/macosx/install.sh	2016-04-13 04:32:01 UTC (rev 20500)
@@ -28,6 +28,7 @@
                   mpich     install-3.0-macosx64-static.sh
                   cmake     install.sh                
                   petsc     install-3.5-macosx64-static.sh
+						m1qn3     install.sh    
                   triangle  install-macosx64.sh "
 
 # Install Externalpackages
@@ -94,6 +95,12 @@
 # Compile ISSM
 #{{{
 cd $ISSM_DIR
+echo "Uinstalling..."
+make uninstall
+echo "Cleaning..."
+make clean
+echo "Even cleaner..."
+make distclean
 echo "Aureconf..."
 autoreconf -if
 echo "Configuring..."
@@ -105,6 +112,7 @@
 	--with-matlab-dir="/Applications/MATLAB_R2011b.app/" \
 	--with-triangle-dir=$ISSM_DIR/externalpackages/triangle/install \
 	--with-metis-dir=$ISSM_DIR/externalpackages/petsc/install \
+	--with-m1qn3-dir=$ISSM_DIR/externalpackages/m1qn3/install \
 	--with-petsc-dir=$ISSM_DIR/externalpackages/petsc/install  \
 	--with-scalapack-dir=$ISSM_DIR/externalpackages/petsc/install \
 	--with-mumps-dir=$ISSM_DIR/externalpackages/petsc/install \

Modified: issm/trunk/packagers/macosx/package.sh
===================================================================
--- issm/trunk/packagers/macosx/package.sh	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/packagers/macosx/package.sh	2016-04-13 04:32:01 UTC (rev 20500)
@@ -35,4 +35,25 @@
 ls -lah $tarball_name
 
 echo "Shipping binaries to website"
-scp $tarball_name websites.jpl.nasa.gov:/home/larour/files/$tarball_name
+
+# We're using public key authentication method to upload the tarball The
+# following lines check to see if the SSH Agent is running. If not, then it is
+# started and relevant information is forwarded to a script.
+pgrep "ssh-agent" > /dev/null
+if [ $? -ne 0 ]; then
+	echo "SSH Agent is not running. Starting it..."
+	ssh-agent > ~/.ssh/agent.sh
+else
+	echo "SSH Agent is running..."
+fi
+
+source ~/.ssh/agent.sh
+ssh-add ~/.ssh/macosx-bins_richese-to-ross
+
+scp $tarball_name ross.ics.uci.edu:/var/www/html/$tarball_name
+
+if [ $? -ne 0 ]; then
+	echo "The upload failed."
+	echo "Perhaps the SSH Agent was started by some other means."
+	echo "Try killing the agent and running again."
+fi

Modified: issm/trunk/packagers/ubuntu/install.sh
===================================================================
--- issm/trunk/packagers/ubuntu/install.sh	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/packagers/ubuntu/install.sh	2016-04-13 04:32:01 UTC (rev 20500)
@@ -28,6 +28,7 @@
 						mpich     install-3.0-linux64.sh
                   cmake     install.sh                
                   petsc     install-3.5-linux64-static.sh
+						m1qn3     install.sh    
                   triangle  install-linux64.sh "
 
 # Install Externalpackages
@@ -111,6 +112,7 @@
 	--with-blas-lapack-dir=$ISSM_DIR/externalpackages/petsc/install \
 	--with-mpi-include=$ISSM_DIR/externalpackages/mpich/install/include  \
 	--with-mpi-libflags=" -L$ISSM_DIR/externalpackages/mpich/install/lib -lmpich -lmpl " \
+	--with-m1qn3-dir=$ISSM_DIR/externalpackages/m1qn3/install \
 	--with-fortran-lib="-L/usr/lib/gcc/x86_64-linux-gnu/4.6/ -lgfortran" \
 	--enable-debugging \
 	--with-numthreads=4

Modified: issm/trunk/packagers/win7/package64.sh
===================================================================
--- issm/trunk/packagers/win7/package64.sh	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/packagers/win7/package64.sh	2016-04-13 04:32:01 UTC (rev 20500)
@@ -10,6 +10,12 @@
 #get windows style path to files
 export ISSM_DIR_WIN=`cygpath -m "$ISSM_DIR"`
 
+echo "----------------------------------"
+rm $ISSM_DIR/bin/*.m
+find $ISSM_DIR/src/m -name '*.m' | xargs cp -t $ISSM_DIR/bin/
+ls $ISSM_DIR/bin
+echo "----------------------------------"
+
 #build list of files to put into the installer: 
 rm -rf ISSM.aic 
 cat << END > ISSM.aic

Modified: issm/trunk/scripts/BinRead.py
===================================================================
--- issm/trunk/scripts/BinRead.py	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/scripts/BinRead.py	2016-04-13 04:32:01 UTC (rev 20500)
@@ -5,13 +5,10 @@
 import numpy
 import math
 import struct
+import argparse
 
-def BinRead(filin,filout=''):
+def BinRead(filin,filout=''): #{{{
 
-	from MatlabFuncs import *
-	from EnumDefinitions import *
-	from EnumToString import EnumToString
-
 	print "reading binary file."
 	f=open(filin,'rb')
 
@@ -104,25 +101,24 @@
 					print "data[%d,%d] = %f" % (i,j,data[i][j])
 
 		elif code == FormatToCode('MatArray'):
-			fid.seek(reclen-4,1)
+			f.seek(reclen-4,1)
 			print "skipping %d bytes for code %d." % (code, reclen-4)
 
 		elif code == FormatToCode('StringArray'):
-			fid.seek(reclen-4,1)
+			f.seek(reclen-4,1)
 			print "skipping %d bytes for code %d." % (code, reclen-4)
 
 		else:
 			raise TypeError('BinRead error message: data type: %d not supported yet! (%s)' % (code,EnumToString(enum)[0]))
 
 	f.close()
-
+#}}}
 def FormatToCode(format): # {{{
 	"""
 	This routine takes the format string, and hardcodes it into an integer, which 
 	is passed along the record, in order to identify the nature of the dataset being 
 	sent.
 	"""
-	from MatlabFuncs import *
 
 	if   strcmpi(format,'Boolean'):
 		code=1
@@ -148,7 +144,7 @@
 	return code
 # }}}
 
-if __name__ == '__main__':
+if __name__ == '__main__': #{{{
 	if 'PYTHONSTARTUP' in os.environ:
 		PYTHONSTARTUP=os.environ['PYTHONSTARTUP']
 		print 'PYTHONSTARTUP =',PYTHONSTARTUP
@@ -160,10 +156,14 @@
 		else:
 			print "PYTHONSTARTUP file '%s' does not exist." % PYTHONSTARTUP
 
-	import argparse
 	parser = argparse.ArgumentParser(description='BinRead - function to read binary input file.')
 	parser.add_argument('-f','--filin', help='name of binary input file', default='')
+	parser.add_argument('-o','--filout', help='optional name of text output file', default='')
 	args = parser.parse_args()
 
-	BinRead(args.filin)
+	from MatlabFuncs import *
+	from EnumDefinitions import *
+	from EnumToString import EnumToString
 
+	BinRead(args.filin, args.filout)
+#}}}

Modified: issm/trunk/scripts/automakererun.sh
===================================================================
--- issm/trunk/scripts/automakererun.sh	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/scripts/automakererun.sh	2016-04-13 04:32:01 UTC (rev 20500)
@@ -8,4 +8,4 @@
 # If all goes well, then the script will be shortened in the future.
 
 cd $ISSM_DIR
-autoreconf -iv 
+autoreconf -iv

Modified: issm/trunk/scripts/ol.m
===================================================================
--- issm/trunk/scripts/ol.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/scripts/ol.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -7,7 +7,7 @@
 	tline = fgets(fid);
 	if length(tline)>16,
 		if strcmpi(tline(1:16),'if perform(org,'''),
-			disp(sprintf('%i: %s',count,tline(17:end-8)));
+			disp(sprintf('%i: %s',count,tline(17:end-4)));
 			count=count+1;
 		end
 	end


Property changes on: issm/trunk/src
___________________________________________________________________
Modified: svn:mergeinfo
   - /issm/branches/trunk-jpl-damage/src:11427-13118
/issm/trunk-jpl/src:10936-11994,11996-12326,12333-12336,12338-12703,12705-12707,12710-13393,13396-13974,13976-14066,14068-14308,14311-15394,15397-16135,16138-16554,16561,16565-17804,17807-17986,17990-18299,18302-19103
   + /issm/branches/trunk-jpl-damage/src:11427-13118
/issm/trunk-jpl/src:10936-11994,11996-12326,12333-12336,12338-12703,12705-12707,12710-13393,13396-13974,13976-14066,14068-14308,14311-15394,15397-16135,16138-16554,16561,16565-17804,17807-17986,17990-18299,18302-20496

Modified: issm/trunk/src/c/Makefile.am
===================================================================
--- issm/trunk/src/c/Makefile.am	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/Makefile.am	2016-04-13 04:32:01 UTC (rev 20500)
@@ -5,11 +5,17 @@
 EXEEXT=$(ISSMEXT)
 
 #Library declaration {{{
-
+if !WINDOWS
 lib_LTLIBRARIES = libISSMCore.la libISSMOverload.la 
 if WRAPPERS
 lib_LTLIBRARIES += libISSMModules.la
 endif
+else
+noinst_LTLIBRARIES = libISSMCore.la libISSMOverload.la 
+if WRAPPERS
+noinst_LTLIBRARIES += libISSMModules.la
+endif
+endif
 #}}}
 
 #Core sources
@@ -51,6 +57,7 @@
 					./classes/Inputs/BoolInput.cpp\
 					./classes/Inputs/IntInput.cpp\
 					./classes/Inputs/DoubleInput.cpp\
+					./classes/Inputs/DoubleArrayInput.cpp\
 					./classes/Inputs/DatasetInput.cpp\
 					./classes/Materials/Materials.cpp\
 					./classes/Materials/Matice.cpp\
@@ -61,7 +68,9 @@
 					./classes/Loads/Loads.cpp\
 					./classes/Loads/Penpair.cpp\
 					./classes/Loads/Pengrid.cpp\
+					./classes/Loads/Moulin.cpp\
 					./classes/Loads/Numericalflux.cpp\
+					./classes/Loads/Neumannflux.cpp\
 					./classes/matrix/ElementMatrix.cpp\
 					./classes/matrix/ElementVector.cpp\
 					./classes/Params/Parameters.cpp\
@@ -101,6 +110,7 @@
 					./shared/Numerics/cubic.cpp\
 					./shared/Numerics/NewtonSolveDnorm.cpp\
 					./shared/Numerics/extrema.cpp\
+					./shared/Numerics/legendre.cpp\
 					./shared/Numerics/XZvectorsToCoordinateSystem.cpp\
 					./shared/Exceptions/Exceptions.cpp\
 					./shared/Sorting/binary_search.cpp\
@@ -113,6 +123,7 @@
 					./shared/Elements/PddSurfaceMassBalance.cpp\
 					./shared/Elements/ComputeDelta18oTemperaturePrecipitation.cpp\
 					./shared/Elements/ComputeMungsmTemperaturePrecipitation.cpp\
+					./shared/Elements/ComputeD18OTemperaturePrecipitationFromPD.cpp\
 					./shared/Elements/DrainageFunctionWaterfraction.cpp\
 					./shared/String/DescriptorIndex.cpp\
 					./toolkits/issm/IssmToolkitUtils.cpp\
@@ -156,6 +167,7 @@
 					./modules/SetActiveNodesLSMx/SetActiveNodesLSMx.cpp\
 					./modules/InputUpdateFromConstantx/InputUpdateFromConstantx.cpp\
 					./modules/InputUpdateFromSolutionx/InputUpdateFromSolutionx.cpp\
+					./modules/GeothermalFluxx/GeothermalFluxx.cpp\
 					./modules/GetSolutionFromInputsx/GetSolutionFromInputsx.cpp\
 					./modules/GetVectorFromInputsx/GetVectorFromInputsx.cpp\
 					./modules/InputUpdateFromVectorx/InputUpdateFromVectorx.cpp\
@@ -163,6 +175,7 @@
 					./modules/ConfigureObjectsx/ConfigureObjectsx.cpp\
 					./modules/SpcNodesx/SpcNodesx.cpp\
 					./modules/SurfaceMassBalancex/SurfaceMassBalancex.cpp\
+					./modules/SurfaceMassBalancex/Gembx.cpp\
 					./modules/Reducevectorgtofx/Reducevectorgtofx.cpp\
 					./modules/Reduceloadx/Reduceloadx.cpp\
 					./modules/ConstraintsStatex/ConstraintsStatex.cpp\
@@ -198,6 +211,7 @@
 					./cores/extrudefrombase_core.cpp\
 					./cores/extrudefromtop_core.cpp\
 					./cores/thermal_core.cpp\
+					./cores/smb_core.cpp\
 					./solutionsequences/solutionsequence_thermal_nonlinear.cpp\
 					./modules/ControlInputSetGradientx/ControlInputSetGradientx.cpp\
 					./modules/GetVectorFromControlInputsx/GetVectorFromControlInputsx.cpp\
@@ -242,6 +256,7 @@
 					./cores/meshdeformation_core.cpp\
 					./cores/damage_core.cpp\
 					./cores/levelsetfunctionslope_core.cpp\
+					./cores/movingfront_core.cpp\
 					./modules/GroundinglineMigrationx/GroundinglineMigrationx.cpp\
 					./classes/Loads/Riftfront.cpp\
 					./modules/ConstraintsStatex/RiftConstraintsState.cpp\
@@ -252,14 +267,15 @@
 #}}}
 #DAKOTA sources  {{{
 if DAKOTA
-issm_sources +=  ./modules/InputUpdateFromDakotax/InputUpdateFromDakotax.cpp\
+issm_sources +=  ./classes/Dakota/IssmDirectApplicInterface.h\
+					  ./classes/Dakota/IssmParallelDirectApplicInterface.cpp\
+					  ./modules/InputUpdateFromDakotax/InputUpdateFromDakotax.cpp\
 					  ./modules/InputUpdateFromVectorDakotax/InputUpdateFromVectorDakotax.cpp\
 					  ./modules/InputUpdateFromMatrixDakotax/InputUpdateFromMatrixDakotax.cpp\
 					  ./modules/AverageOntoPartitionx/AverageOntoPartitionx.cpp\
 					  ./modules/ModelProcessorx/Dakota/CreateParametersDakota.cpp\
 					  ./modules/ModelProcessorx/Dakota/UpdateElementsAndMaterialsDakota.cpp\
-					  ./cores/dakota_core.cpp\
-					  ./cores/DakotaSpawnCore.cpp
+					  ./cores/dakota_core.cpp
 endif
 #}}}
 #BAMG sources  {{{
@@ -359,6 +375,7 @@
 endif
 if DAMAGEEVOLUTION
 issm_sources += ./analyses/DamageEvolutionAnalysis.cpp
+issm_sources += ./modules/Damagex/Damagex.cpp
 endif
 if STRESSBALANCE
 issm_sources += ./analyses/StressbalanceAnalysis.cpp
@@ -378,6 +395,9 @@
 if HYDROLOGYSHREVE
 issm_sources += ./analyses/HydrologyShreveAnalysis.cpp
 endif
+if HYDROLOGYSOMMERS
+issm_sources += ./analyses/HydrologySommersAnalysis.cpp
+endif
 if HYDROLOGYDCINEFFICIENT
 issm_sources += ./analyses/HydrologyDCInefficientAnalysis.cpp
 endif
@@ -393,6 +413,10 @@
 if MASSTRANSPORT
 issm_sources += ./analyses/MasstransportAnalysis.cpp
 endif
+if SMB
+issm_sources += ./analyses/SmbAnalysis.cpp
+endif
+
 if FREESURFACEBASE
 issm_sources += ./analyses/FreeSurfaceBaseAnalysis.cpp
 endif
@@ -442,11 +466,24 @@
 					./modules/GiaDeflectionCorex/what0.f
 endif
 #}}}
+#Slr sources  {{{
+if SEALEVELRISE
+issm_sources +=  ./cores/sealevelrise_core.cpp\
+				 ./cores/sealevelrise_core_eustatic.cpp\
+				 ./cores/sealevelrise_core_noneustatic.cpp\
+				 ./analyses/SealevelriseAnalysis.cpp
+endif
+#}}}
 #Metis sources  {{{
 if METIS
 issm_sources += ./toolkits/metis/patches/METIS_PartMeshNodalPatch.cpp
 endif
 #}}}
+#Esmf sources  {{{
+if ESMF
+issm_sources += ./main/esmfbinders.cpp
+endif
+#}}}
 
 #Wrapper sources
 #Bamg sources  {{{
@@ -513,6 +550,8 @@
 			./modules/ExpToLevelSetx/ExpToLevelSetx.cpp\
 			./modules/ExpToLevelSetx/ExpToLevelSetxt.cpp\
 			./modules/ContourToNodesx/ContourToNodesx.cpp\
+			./modules/DistanceToMaskBoundaryx/DistanceToMaskBoundaryx.cpp\
+			./modules/DistanceToMaskBoundaryx/DistanceToMaskBoundaryxt.cpp\
 			./modules/NodeConnectivityx/NodeConnectivityx.cpp\
 			./modules/ElementConnectivityx/ElementConnectivityx.cpp\
 			./modules/PropagateFlagsFromConnectivityx/PropagateFlagsFromConnectivityx.cpp
@@ -545,13 +584,17 @@
 endif
 #}}}
 #Library flags and sources {{{
-ALLCXXFLAGS= -fPIC $(CXXFLAGS) $(CXXOPTFLAGS) 
+ALLCXXFLAGS= $(CXXFLAGS) $(CXXOPTFLAGS) 
 
 libISSMCore_la_SOURCES  = $(issm_sources)
 libISSMCore_la_CXXFLAGS = $(ALLCXXFLAGS) $(DAKOTAFLAGS)
 libISSMCore_la_FFLAGS = $(AM_FFLAGS)
 
+if !WINDOWS
+if !STANDALONE_LIBRARIES
 libISSMCore_la_LIBADD = $(PETSCLIB) $(TAOLIB) $(M1QN3LIB) $(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) $(METEOIOLIB) $(SNOWPACKLIB)
+endif
+endif
 
 if WRAPPERS
 libISSMModules_la_SOURCES = $(modules_sources)
@@ -563,12 +606,14 @@
 libISSMModules_la_SOURCES += $(kml_sources)
 endif
 libISSMModules_la_CXXFLAGS = $(ALLCXXFLAGS)
+if !WINDOWS
 if STANDALONE_LIBRARIES
 libISSMModules_la_LIBADD = ./libISSMCore.la
 else
 libISSMModules_la_LIBADD = ./libISSMCore.la $(TRIANGLELIB)
 endif
 endif
+endif
 
 if VERSION
 AM_LDFLAGS =
@@ -585,26 +630,35 @@
 libISSMOverload_la_LDFLAGS = -static
 if WRAPPERS
 libISSMModules_la_LDFLAGS = -static
+else
+libISSMModules_la_LDFLAGS = 
 endif
+else
+libISSMCore_la_LDFLAGS = 
+libISSMOverload_la_LDFLAGS =
 endif
 
 #}}}
 #Overload library, to overload any non-standard symbols. {{{
 libISSMOverload_la_SOURCES = ./shared/String/ApiPrintf.cpp
 
-libISSMOverload_la_CFLAGS  = -fPIC -D_C_ $(COPTFLAGS) $(CFLAGS)
+libISSMOverload_la_CFLAGS  = -D_C_ -fPIC $(COPTFLAGS) $(CFLAGS)
 #}}}
 
 #Executable {{{
 if ANDROID
 if ANDROIDEXE
-bin_PROGRAMS = issm 
+bin_PROGRAMS = issm  issm_slr
 else
 bin_PROGRAMS = 
 endif
 else
-bin_PROGRAMS = issm 
+if JAVASCRIPT
+bin_PROGRAMS =
+else
+bin_PROGRAMS = issm  issm_slr
 endif
+endif
 
 #Standard libraries
 LDADD = ./libISSMCore.la ./libISSMOverload.la
@@ -613,35 +667,51 @@
 endif
 
 #External packages
-LDADD += $(PETSCLIB) $(TAOLIB) $(M1QN3LIB) $(PLAPACKLIB) $(MUMPSLIB) $(SUPERLULIB) $(SPOOLESLIB) $(SCALAPACKLIB) $(BLACSLIB) $(HYPRELIB) $(SPAILIB) $(PROMETHEUSLIB) $(PASTIXLIB) $(MLLIB) $(DAKOTALIB) $(METISLIB) $(CHACOLIB) $(SCOTCHLIB) $(BLASLAPACKLIB) $(MKLLIB) $(MPILIB)  $(MATHLIB) $(GRAPHICSLIB) $(MULTITHREADINGLIB) $(OSLIBS) $(GSLLIB) $(AMPILIB) $(ADOLCLIB) $(MPILIB) $(METEOIOLIB) $(SNOWPACKLIB) $(PROJ4LIB)
+LDADD +=  $(TAOLIB) $(M1QN3LIB) $(PLAPACKLIB) $(MUMPSLIB) $(SUPERLULIB) $(SPOOLESLIB) $(SCALAPACKLIB) $(BLACSLIB) $(PETSCLIB) $(HYPRELIB) $(SPAILIB) $(PROMETHEUSLIB) $(PASTIXLIB) $(MLLIB) $(DAKOTALIB) $(METISLIB) $(CHACOLIB) $(SCOTCHLIB) $(BLASLAPACKLIB) $(MKLLIB) $(MPILIB)  $(MATHLIB) $(GRAPHICSLIB) $(MULTITHREADINGLIB) $(OSLIBS) $(GSLLIB) $(AMPILIB) $(ADOLCLIB) $(MPILIB) $(METEOIOLIB) $(SNOWPACKLIB) $(PROJ4LIB)
 
 if FORTRAN
 LDADD += $(FLIBS) $(FORTRANLIB)
 endif
 
 issm_SOURCES = main/issm.cpp
-issm_CXXFLAGS= -fPIC
+issm_CXXFLAGS= $(CXXFLAGS) $(CXXOPTFLAGS)
 
+issm_slr_SOURCES = main/issm_slr.cpp
+issm_slr_CXXFLAGS= $(CXXFLAGS) $(CXXOPTFLAGS)
+
+
 if KRIGING
 bin_PROGRAMS += kriging
 kriging_SOURCES = main/kriging.cpp
-kriging_CXXFLAGS= -fPIC $(CXXFLAGS) $(CXXOPTFLAGS) $(COPTFLAGS) 
+kriging_CXXFLAGS= $(CXXFLAGS) $(CXXOPTFLAGS) $(COPTFLAGS) 
 endif
+
+if ISSM_DAKOTA
+bin_PROGRAMS += issm_dakota
+issm_dakota_SOURCES = main/issm_dakota.cpp
+issm_dakota_CXXFLAGS= $(CXXFLAGS) $(CXXOPTFLAGS) $(COPTFLAGS) 
+issm_dakota_LDADD= $(LDADD)
+endif
+
 #}}}
 #Automatic differentiation (must be done at the end) {{{
 if ADIC2 
+if !WINDOWS
 lib_LTLIBRARIES += libAD.la libISSMRose.la
+else
+noinst_LTLIBRARIES += libAD.la libISSMRose.la
+endif
 
 #ADIC2 library, for automatic differentiation 
 #libAD_a_SOURCES = ./mini1.ad.c
 libAD_la_SOURCES = 
-libAD_la_CFLAGS = -fPIC -D_C_ $(COPTFLAGS)
+libAD_la_CFLAGS = -D_C_ -fPIC $(COPTFLAGS)
 
 #test rose preprocessing 
 %.r2cpp.cpp : %.cpp
 	testTranslator -rose:o $@ -rose:skipfinalCompileStep -DHAVE_CONFIG_H -D_C_ -I. -I../.. $(INCLUDES) $<
 libISSMRose_la_SOURCES = $(libISSMCore_a_SOURCES:.cpp=.r2cpp.cpp)
-libISSMRose_la_CXXFLAGS= -fPIC -D_C_ $(CXXOPTFLAGS)
+libISSMRose_la_CXXFLAGS= -D_C_ $(CXXOPTFLAGS)
 
 #Automatic differentiation rules: 
 %.ad.c: %.c
@@ -651,6 +721,6 @@
 bin_PROGRAMS +=  issmRose.exe
 issmRose_exe_LDADD = ./libISSMRose.a $(LDADD)
 issmRose_exe_SOURCES = main/issm.cpp
-issmRose_exe_CXXFLAGS= -fPIC $(CXXOPTFLAGS) $(COPTFLAGS) 
+issmRose_exe_CXXFLAGS= $(CXXFLAGS) $(CXXOPTFLAGS) $(COPTFLAGS) 
 LDADD +=  $(ADIC2LIB) 
 endif #}}}

Modified: issm/trunk/src/c/analyses/AdjointBalancethicknessAnalysis.cpp
===================================================================
--- issm/trunk/src/c/analyses/AdjointBalancethicknessAnalysis.cpp	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/analyses/AdjointBalancethicknessAnalysis.cpp	2016-04-13 04:32:01 UTC (rev 20500)
@@ -131,6 +131,11 @@
 					vy  = vy/(vel+1.e-9);
 					for(i=0;i<numnodes;i++) pe->values[i]+= - weight*(dH[0]*(-vy)+dH[1]*vx)*(dbasis[0*numnodes+i]*(-vy)+dbasis[1*numnodes+i]*vx)*Jdet*gauss->weight;
 					break;
+				case ThicknessPositiveEnum:
+					if(thickness<0){
+						for(i=0;i<numnodes;i++) pe->values[i]+= - weight*2*thickness*Jdet*gauss->weight*basis[i];
+					}
+					break;
 				default:
 					_error_("response " << EnumToStringx(responses[resp]) << " not supported yet");
 			}
@@ -180,6 +185,7 @@
 		case ThicknessAbsGradientEnum:    /*Nothing, \partial J/\partial k = 0*/ break;
 		case ThicknessAlongGradientEnum:  /*Nothing, \partial J/\partial k = 0*/ break;
 		case ThicknessAcrossGradientEnum: /*Nothing, \partial J/\partial k = 0*/ break;
+		case ThicknessPositiveEnum:       /*Nothing, \partial J/\partial k = 0*/ break;
 		default: _error_("response " << EnumToStringx(responses[resp]) << " not supported yet");
 	}
 

Modified: issm/trunk/src/c/analyses/AdjointHorizAnalysis.cpp
===================================================================
--- issm/trunk/src/c/analyses/AdjointHorizAnalysis.cpp	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/analyses/AdjointHorizAnalysis.cpp	2016-04-13 04:32:01 UTC (rev 20500)
@@ -2076,6 +2076,7 @@
 
 	/*Intermediaries*/
 	int      domaintype,dim;
+
 	Element* basalelement;
 
 	/*Get basal element*/
@@ -2140,9 +2141,8 @@
 	Input* qinput = basalelement->GetInput(FrictionQEnum);
 	Input* cinput = basalelement->GetInput(FrictionCEnum);
 	Input* Asinput = basalelement->GetInput(FrictionAsEnum);
-	Input* Ninput = basalelement->GetInput(FrictionEffectivePressureEnum);
 	Input* nInput =basalelement->GetInput(MaterialsRheologyNEnum);
-	
+	Input* Ninput = basalelement->GetInput(FrictionEffectivePressureEnum);	
 	/* Start  looping on the number of gaussian points: */
 	Gauss* gauss=basalelement->NewGauss(4);
 	for(int ig=gauss->begin();ig<gauss->end();ig++){

Modified: issm/trunk/src/c/analyses/Analysis.h
===================================================================
--- issm/trunk/src/c/analyses/Analysis.h	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/analyses/Analysis.h	2016-04-13 04:32:01 UTC (rev 20500)
@@ -6,6 +6,14 @@
 #define _ANALYSIS_H_
 
 #include "../toolkits/objects/toolkitobjects.h"
+
+// Looks like AD runs without AMPI are missing commmpi.h
+// Conditionally including the header
+
+#if !defined(_HAVE_MPI_) && !defined(_HAVE_PETSC_MPI_)
+#include "../toolkits/mpi/commops/commops.h"
+#endif
+
 class Parameters;
 class IoModel;
 class Elements;

Modified: issm/trunk/src/c/analyses/Balancethickness2Analysis.cpp
===================================================================
--- issm/trunk/src/c/analyses/Balancethickness2Analysis.cpp	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/analyses/Balancethickness2Analysis.cpp	2016-04-13 04:32:01 UTC (rev 20500)
@@ -32,9 +32,10 @@
 	iomodel->FetchDataToInput(elements,ThicknessEnum);
 	iomodel->FetchDataToInput(elements,SurfaceEnum);
 	iomodel->FetchDataToInput(elements,BaseEnum);
+	iomodel->FetchDataToInput(elements,SealevelEnum,0);
 	iomodel->FetchDataToInput(elements,MaskIceLevelsetEnum);
 	iomodel->FetchDataToInput(elements,BasalforcingsGroundediceMeltingRateEnum);
-	iomodel->FetchDataToInput(elements,SurfaceforcingsMassBalanceEnum);
+	iomodel->FetchDataToInput(elements,SmbMassBalanceEnum);
 	iomodel->FetchDataToInput(elements,BalancethicknessThickeningRateEnum);
 	iomodel->FetchDataToInput(elements,BalancethicknessOmegaEnum);
 
@@ -187,7 +188,7 @@
 
 	/*Retrieve all inputs and parameters*/
 	element->GetVerticesCoordinates(&xyz_list);
-	Input* ms_input   = element->GetInput(SurfaceforcingsMassBalanceEnum);                _assert_(ms_input);
+	Input* ms_input   = element->GetInput(SmbMassBalanceEnum);                _assert_(ms_input);
 	Input* mb_input   = element->GetInput(BasalforcingsGroundediceMeltingRateEnum);       _assert_(mb_input);
 	Input* dhdt_input = element->GetInput(BalancethicknessThickeningRateEnum);            _assert_(dhdt_input);
 

Modified: issm/trunk/src/c/analyses/BalancethicknessAnalysis.cpp
===================================================================
--- issm/trunk/src/c/analyses/BalancethicknessAnalysis.cpp	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/analyses/BalancethicknessAnalysis.cpp	2016-04-13 04:32:01 UTC (rev 20500)
@@ -97,11 +97,12 @@
 	iomodel->FetchDataToInput(elements,ThicknessEnum);
 	iomodel->FetchDataToInput(elements,SurfaceEnum);
 	iomodel->FetchDataToInput(elements,BaseEnum);
+	iomodel->FetchDataToInput(elements,SealevelEnum,0);
 	iomodel->FetchDataToInput(elements,MaskIceLevelsetEnum);
 	iomodel->FetchDataToInput(elements,VxEnum);
 	iomodel->FetchDataToInput(elements,VyEnum);
 	iomodel->FetchDataToInput(elements,BasalforcingsGroundediceMeltingRateEnum);
-	iomodel->FetchDataToInput(elements,SurfaceforcingsMassBalanceEnum);
+	iomodel->FetchDataToInput(elements,SmbMassBalanceEnum);
 	iomodel->FetchDataToInput(elements,BalancethicknessThickeningRateEnum);
 
 	if(iomodel->domaintype!=Domain2DhorizontalEnum){
@@ -354,7 +355,7 @@
 	/*Retrieve all inputs and parameters*/
 	element->GetVerticesCoordinates(&xyz_list);
 	Input* mb_input   = element->GetInput(BasalforcingsGroundediceMeltingRateEnum);       _assert_(mb_input);
-	Input* ms_input   = element->GetInput(SurfaceforcingsMassBalanceEnum);     _assert_(ms_input);
+	Input* ms_input   = element->GetInput(SmbMassBalanceEnum);     _assert_(ms_input);
 	Input* dhdt_input = element->GetInput(BalancethicknessThickeningRateEnum); _assert_(dhdt_input);
 
 	/*Initialize mb_correction to 0, do not forget!:*/
@@ -395,7 +396,7 @@
 	/*Retrieve all inputs and parameters*/
 	element->GetVerticesCoordinates(&xyz_list);
 	Input* mb_input   = element->GetInput(BasalforcingsGroundediceMeltingRateEnum);       _assert_(mb_input);
-	Input* ms_input   = element->GetInput(SurfaceforcingsMassBalanceEnum);     _assert_(ms_input);
+	Input* ms_input   = element->GetInput(SmbMassBalanceEnum);     _assert_(ms_input);
 	Input* dhdt_input = element->GetInput(BalancethicknessThickeningRateEnum); _assert_(dhdt_input);
 
 	/*Initialize mb_correction to 0, do not forget!:*/
@@ -516,7 +517,7 @@
 	Input* weights_input              = element->GetInput(InversionCostFunctionsCoefficientsEnum);  _assert_(weights_input);
 	Input* vx_input                   = element->GetInput(VxEnum);                                  _assert_(vx_input);
 	Input* vy_input                   = element->GetInput(VyEnum);                                  _assert_(vy_input);
-	Input* surface_mass_balance_input = element->GetInput(SurfaceforcingsMassBalanceEnum);          _assert_(surface_mass_balance_input);
+	Input* surface_mass_balance_input = element->GetInput(SmbMassBalanceEnum);          _assert_(surface_mass_balance_input);
 	Input* basal_melting_input        = element->GetInput(BasalforcingsGroundediceMeltingRateEnum); _assert_(basal_melting_input);
 	Input* dhdt_input                 = element->GetInput(BalancethicknessThickeningRateEnum);      _assert_(dhdt_input);
 

Modified: issm/trunk/src/c/analyses/BalancevelocityAnalysis.cpp
===================================================================
--- issm/trunk/src/c/analyses/BalancevelocityAnalysis.cpp	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/analyses/BalancevelocityAnalysis.cpp	2016-04-13 04:32:01 UTC (rev 20500)
@@ -40,11 +40,12 @@
 	iomodel->FetchDataToInput(elements,ThicknessEnum);
 	iomodel->FetchDataToInput(elements,SurfaceEnum);
 	iomodel->FetchDataToInput(elements,BaseEnum);
+	iomodel->FetchDataToInput(elements,SealevelEnum,0);
 	iomodel->FetchDataToInput(elements,MaskIceLevelsetEnum);
 	iomodel->FetchDataToInput(elements,VxEnum);
 	iomodel->FetchDataToInput(elements,VyEnum);
 	iomodel->FetchDataToInput(elements,BasalforcingsGroundediceMeltingRateEnum);
-	iomodel->FetchDataToInput(elements,SurfaceforcingsMassBalanceEnum);
+	iomodel->FetchDataToInput(elements,SmbMassBalanceEnum);
 	iomodel->FetchDataToInput(elements,BalancethicknessThickeningRateEnum);
 
 	if(iomodel->domaintype!=Domain2DhorizontalEnum){
@@ -182,7 +183,7 @@
 
 	/*Retrieve all inputs and parameters*/
 	basalelement->GetVerticesCoordinates(&xyz_list);
-	Input* ms_input   = basalelement->GetInput(SurfaceforcingsMassBalanceEnum);          _assert_(ms_input);
+	Input* ms_input   = basalelement->GetInput(SmbMassBalanceEnum);          _assert_(ms_input);
 	Input* mb_input   = basalelement->GetInput(BasalforcingsGroundediceMeltingRateEnum); _assert_(mb_input);
 	Input* dhdt_input = basalelement->GetInput(BalancethicknessThickeningRateEnum);      _assert_(dhdt_input);
 	Input* H_input    = basalelement->GetInput(ThicknessEnum);                           _assert_(H_input);

Modified: issm/trunk/src/c/analyses/DamageEvolutionAnalysis.cpp
===================================================================
--- issm/trunk/src/c/analyses/DamageEvolutionAnalysis.cpp	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/analyses/DamageEvolutionAnalysis.cpp	2016-04-13 04:32:01 UTC (rev 20500)
@@ -10,8 +10,19 @@
 	int finiteelement;
 	iomodel->Constant(&finiteelement,DamageElementinterpEnum);
 
-	IoModelToConstraintsx(constraints,iomodel,DamageSpcdamageEnum,DamageEvolutionAnalysisEnum,finiteelement);
+	/*Fetch parameters: */
+	int stabilization;
+	iomodel->Constant(&stabilization,DamageStabilizationEnum);
 
+	/*Do not add constraints in DG,  they are weakly imposed*/
+	if(stabilization!=3){
+		IoModelToConstraintsx(constraints,iomodel,DamageSpcdamageEnum,DamageEvolutionAnalysisEnum,finiteelement);
+	}
+
+	/*FCT, constraints are imposed using penalties*/
+	if(stabilization==4){
+		constraints->ActivatePenaltyMethod(DamageEvolutionAnalysisEnum);
+	}
 }/*}}}*/
 void DamageEvolutionAnalysis::CreateLoads(Loads* loads, IoModel* iomodel){/*{{{*/
 
@@ -31,10 +42,10 @@
 void DamageEvolutionAnalysis::UpdateElements(Elements* elements,IoModel* iomodel,int analysis_counter,int analysis_type){/*{{{*/
 
 	int finiteelement;
-	bool   islevelset;
+	bool   ismovingfront;
 
 	iomodel->Constant(&finiteelement,DamageElementinterpEnum);
-	iomodel->Constant(&islevelset,TransientIslevelsetEnum);
+	iomodel->Constant(&ismovingfront,TransientIsmovingfrontEnum);
 
 	/*Update elements: */
 	int counter=0;
@@ -54,10 +65,6 @@
 	iomodel->FetchDataToInput(elements,MaskIceLevelsetEnum);
 	iomodel->FetchDataToInput(elements,PressureEnum);
 
-	if(islevelset){
-		iomodel->FetchDataToInput(elements,IceMaskNodeActivationEnum);
-	}
-
 }/*}}}*/
 void DamageEvolutionAnalysis::UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum){/*{{{*/
 
@@ -68,9 +75,6 @@
 	/*retrieve some parameters: */
 	parameters->AddObject(iomodel->CopyConstantObject(DamageLawEnum));
 	parameters->AddObject(iomodel->CopyConstantObject(DamageStabilizationEnum));
-	parameters->AddObject(iomodel->CopyConstantObject(DamagePenaltyThresholdEnum));
-	parameters->AddObject(iomodel->CopyConstantObject(DamagePenaltyLockEnum));
-	parameters->AddObject(iomodel->CopyConstantObject(DamagePenaltyFactorEnum));
 	parameters->AddObject(iomodel->CopyConstantObject(DamageMaxiterEnum));
 	parameters->AddObject(iomodel->CopyConstantObject(DamageMaxDamageEnum));
 	parameters->AddObject(iomodel->CopyConstantObject(DamageElementinterpEnum));
@@ -84,12 +88,17 @@
 	/*Retrieve law dependent parameters: */
 	int law;
 	iomodel->Constant(&law,DamageLawEnum);
-	if (law>0){
+	if (law==0){
+		parameters->AddObject(iomodel->CopyConstantObject(DamageStressThresholdEnum));
+		parameters->AddObject(iomodel->CopyConstantObject(DamageKappaEnum));
+	}
+	else if (law>0){
 		parameters->AddObject(iomodel->CopyConstantObject(DamageC1Enum));
 		parameters->AddObject(iomodel->CopyConstantObject(DamageC2Enum));
 		parameters->AddObject(iomodel->CopyConstantObject(DamageC3Enum));
 		parameters->AddObject(iomodel->CopyConstantObject(DamageC4Enum));
 		parameters->AddObject(iomodel->CopyConstantObject(DamageStressThresholdEnum));
+		parameters->AddObject(iomodel->CopyConstantObject(DamageKappaEnum));
 		parameters->AddObject(iomodel->CopyConstantObject(DamageHealingEnum));
 		parameters->AddObject(iomodel->CopyConstantObject(DamageEquivStressEnum));
 	}
@@ -100,13 +109,34 @@
 void           DamageEvolutionAnalysis::Core(FemModel* femmodel){/*{{{*/
 	_error_("not implemented");
 }/*}}}*/
+void           DamageEvolutionAnalysis::CreateDamageFInput(Element* element){/*{{{*/
+
+	/*Fetch number of vertices and allocate output*/
+	int numnodes = element->GetNumberOfNodes();
+	IssmDouble* f   = xNew<IssmDouble>(numnodes);
+
+	/*Calculate damage evolution source term: */
+	for (int i=0;i<numnodes;i++){
+
+		/* healing could be handled here */
+
+		/* no source term; damage handled in stress balance */
+		f[i]=0.;
+	}
+
+	/*Add input*/
+	element->AddInput(DamageFEnum,f,element->GetElementType());
+	
+	/*Clean up and return*/
+	xDelete<IssmDouble>(f);
+}/*}}}*/
 void           DamageEvolutionAnalysis::CreateDamageFInputExp(Element* element){/*{{{*/
 
 	/*Intermediaries */
 	IssmDouble epsf,stress_threshold,eps0;
 	IssmDouble damage,B,n,epseff;
 	IssmDouble eps_xx,eps_yy,eps_xy,eps1,eps2,epstmp;
-	int domaintype,damagelaw;
+	int domaintype;
 
 	/*Fetch number of vertices and allocate output*/
 	int numnodes = element->GetNumberOfNodes();
@@ -116,7 +146,6 @@
 	element->FindParam(&epsf,DamageC1Enum);
 	element->FindParam(&stress_threshold,DamageStressThresholdEnum);
 	element->FindParam(&domaintype,DomainTypeEnum);
-	element->FindParam(&damagelaw,DamageLawEnum);
 
 	/*Compute stress tensor: */
 	element->ComputeStrainRate();
@@ -178,7 +207,7 @@
 	IssmDouble s_xx,s_xy,s_xz,s_yy,s_yz,s_zz,s1,s2,s3,stmp;
 	IssmDouble J2s,Chi,Psi,PosPsi,NegPsi;
 	IssmDouble damage,tau_xx,tau_xy,tau_xz,tau_yy,tau_yz,tau_zz,stressMaxPrincipal;
-	int equivstress,domaintype,damagelaw,dim;
+	int equivstress,domaintype,dim;
 
 	/*Fetch number of vertices and allocate output*/
 	int numnodes = element->GetNumberOfNodes();
@@ -191,7 +220,6 @@
 	element->FindParam(&healing,DamageHealingEnum);
 	element->FindParam(&stress_threshold,DamageStressThresholdEnum);
 	element->FindParam(&domaintype,DomainTypeEnum);
-	element->FindParam(&damagelaw,DamageLawEnum);
 
 	/*Get problem dimension*/
 	switch(domaintype){
@@ -267,16 +295,8 @@
 			}
 			Psi=Chi-stress_threshold;
 			NegPsi=max(-Chi,0.); /* healing only for compressive stresses */
-
-			if(damagelaw==1){
-				PosPsi=max(Psi,0.);
-				f[i]= c1*(pow(PosPsi,c2) - healing*pow(NegPsi,c2))*pow((1./(1.-damage)),c3);
-			}
-			else if(damagelaw==2){
-				PosPsi=max(Psi,1.);
-				f[i]= c1*(pow(log10(PosPsi),c2) - healing*pow(NegPsi,c2))*pow((1./(1.-damage)),c3);
-			}
-			else _error_("damage law not supported");
+			PosPsi=max(Psi,0.);
+			f[i]= c1*(pow(PosPsi,c2) - healing*pow(NegPsi,c2))*pow((1./(1.-damage)),c3);
 		}
 		else{
 			if(equivstress==1){/* max principal stress */
@@ -288,15 +308,8 @@
 			}
 			Psi=Chi-stress_threshold;
 			NegPsi=max(-Chi,0.); /* healing only for compressive stresses */
-			if(damagelaw==1){
-				PosPsi=max(Psi,0.);
-				f[i]= c1*(pow(PosPsi,c2) - healing*pow(NegPsi,c2))*pow((1./(1.-damage)),c3);
-			}
-			else if(damagelaw==2){
-				PosPsi=max(Psi,1.);
-				f[i]= c1*(pow(log10(PosPsi),c2) - healing*pow(NegPsi,c2))*pow((1./(1.-damage)),c3);
-			}
-			else _error_("damage law not supported");
+			PosPsi=max(Psi,0.);
+			f[i]= c1*(pow(PosPsi,c2) - healing*pow(NegPsi,c2))*pow((1./(1.-damage)),c3);
 		}
 	}
 	/*Add input*/
@@ -503,13 +516,13 @@
 	element->FindParam(&dt,TimesteppingTimeStepEnum);
 	element->FindParam(&damagelaw,DamageLawEnum);
 	switch(damagelaw){
+		case 0:
+			this->CreateDamageFInput(element);
+			break;
 		case 1:
 			this->CreateDamageFInputPralong(element);
 			break;
 		case 2:
-			this->CreateDamageFInputPralong(element);
-			break;
-		case 3:
 			this->CreateDamageFInputExp(element);
 			break;
 		default:
@@ -605,7 +618,7 @@
 
 }/*}}}*/
 void           DamageEvolutionAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
-	   _error_("not implemented yet");
+	element->GetSolutionFromInputsOneDof(solution,DamageDbarEnum);
 }/*}}}*/
 void           DamageEvolutionAnalysis::GradientJ(Vector<IssmDouble>* gradient,Element* element,int control_type,int control_index){/*{{{*/
 	_error_("Not implemented yet");
@@ -651,11 +664,175 @@
 	xDelete<int>(doflist);
 }/*}}}*/
 void           DamageEvolutionAnalysis::UpdateConstraints(FemModel* femmodel){/*{{{*/
-	/*Default, do nothing*/
-	bool islevelset;
-	femmodel->parameters->FindParam(&islevelset,TransientIslevelsetEnum);
-	if(islevelset){
-		SetActiveNodesLSMx(femmodel);
+	SetActiveNodesLSMx(femmodel);
+}/*}}}*/
+
+/*Flux Correction Transport*/
+ElementMatrix* DamageEvolutionAnalysis::CreateFctKMatrix(Element* element){/*{{{*/
+
+	/* Check if ice in element */
+	if(!element->IsIceInElement()) return NULL;
+
+	/*Intermediaries */
+	IssmDouble Jdet;
+	IssmDouble vx,vy;
+	IssmDouble* xyz_list = NULL;
+
+	/*Fetch number of nodes and dof for this finite element*/
+	int numnodes = element->GetNumberOfNodes();
+	int dim      = 2;
+
+	/*Initialize Element vector and other vectors*/
+	ElementMatrix* Ke     = element->NewElementMatrix();
+	IssmDouble*    B      = xNew<IssmDouble>(dim*numnodes);
+	IssmDouble*    Bprime = xNew<IssmDouble>(dim*numnodes);
+	IssmDouble*    D      = xNewZeroInit<IssmDouble>(dim*dim);
+
+	/*Retrieve all inputs and parameters*/
+	element->GetVerticesCoordinates(&xyz_list);
+	Input* vxaverage_input=element->GetInput(VxEnum); _assert_(vxaverage_input);
+	Input* vyaverage_input=element->GetInput(VyEnum); _assert_(vyaverage_input);
+
+	/* Start  looping on the number of gaussian points: */
+	Gauss* gauss=element->NewGauss(2);
+	for(int ig=gauss->begin();ig<gauss->end();ig++){
+		gauss->GaussPoint(ig);
+
+		element->JacobianDeterminant(&Jdet,xyz_list,gauss);
+		GetB(B,element,dim,xyz_list,gauss);
+		GetBprime(Bprime,element,dim,xyz_list,gauss);
+		vxaverage_input->GetInputValue(&vx,gauss);
+		vyaverage_input->GetInputValue(&vy,gauss);
+
+		D[0*dim+0] = -gauss->weight*vx*Jdet;
+		D[1*dim+1] = -gauss->weight*vy*Jdet;
+
+		TripleMultiply(B,dim,numnodes,1,
+					D,dim,dim,0,
+					Bprime,dim,numnodes,0,
+					&Ke->values[0],1);
+
 	}
-	return;
+
+	/*Clean up and return*/
+	xDelete<IssmDouble>(xyz_list);
+	xDelete<IssmDouble>(B);
+	xDelete<IssmDouble>(Bprime);
+	xDelete<IssmDouble>(D);
+	delete gauss;
+	return Ke;
 }/*}}}*/
+ElementMatrix* DamageEvolutionAnalysis::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);
+	for(int ig=gauss->begin();ig<gauss->end();ig++){
+		gauss->GaussPoint(ig);
+
+		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           DamageEvolutionAnalysis::FctKMatrix(Matrix<IssmDouble>** pKff,Matrix<IssmDouble>** pKfs,FemModel* femmodel){/*{{{*/
+
+	/*Output*/
+	Matrix<IssmDouble>* Kff = NULL;
+	Matrix<IssmDouble>* Kfs = NULL;
+
+	/*Initialize Jacobian Matrix*/
+	AllocateSystemMatricesx(&Kff,&Kfs,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->CreateFctKMatrix(element);
+		if(Ke) Ke->AddToGlobal(Kff,Kfs);
+		delete Ke;
+	}
+	Kff->Assemble();
+	Kfs->Assemble();
+
+	/*Assign output pointer*/
+	*pKff=Kff;
+	if(pKfs){
+		*pKfs=Kfs;
+	}
+	else{
+		delete Kfs;
+	}
+}/*}}}*/
+void           DamageEvolutionAnalysis::LumpedMassMatrix(Vector<IssmDouble>** pMlff,FemModel* femmodel){/*{{{*/
+
+	/*Intermediaries*/
+	int  configuration_type;
+
+	/*Initialize Lumped mass matrix (actually we just save its diagonal)*/
+	femmodel->parameters->FindParam(&configuration_type,ConfigurationTypeEnum);
+	int fsize      = femmodel->nodes->NumberOfDofs(configuration_type,FsetEnum);
+	int flocalsize = femmodel->nodes->NumberOfDofsLocal(configuration_type,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           DamageEvolutionAnalysis::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;
+}/*}}}*/

Modified: issm/trunk/src/c/analyses/DamageEvolutionAnalysis.h
===================================================================
--- issm/trunk/src/c/analyses/DamageEvolutionAnalysis.h	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/analyses/DamageEvolutionAnalysis.h	2016-04-13 04:32:01 UTC (rev 20500)
@@ -21,6 +21,7 @@
 
 		/*Finite element Analysis*/
 		void           Core(FemModel* femmodel);
+		void           CreateDamageFInput(Element* element);
 		void           CreateDamageFInputExp(Element* element);
 		void           CreateDamageFInputPralong(Element* element);
 		ElementVector* CreateDVector(Element* element);
@@ -33,5 +34,12 @@
 		void           GradientJ(Vector<IssmDouble>* gradient,Element* element,int control_type,int control_index);
 		void           InputUpdateFromSolution(IssmDouble* solution,Element* element);
 		void           UpdateConstraints(FemModel* femmodel);
+
+		/*FCT*/
+		ElementMatrix* CreateFctKMatrix(Element* element);
+		ElementMatrix* CreateMassMatrix(Element* element);
+		void           FctKMatrix(Matrix<IssmDouble>** pKff,Matrix<IssmDouble>** pKfs,FemModel* femmodel);
+		void           LumpedMassMatrix(Vector<IssmDouble>** pMLff,FemModel* femmodel);
+		void           MassMatrix(Matrix<IssmDouble>** pMff,FemModel* femmodel);
 };
 #endif

Modified: issm/trunk/src/c/analyses/EnthalpyAnalysis.cpp
===================================================================
--- issm/trunk/src/c/analyses/EnthalpyAnalysis.cpp	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/analyses/EnthalpyAnalysis.cpp	2016-04-13 04:32:01 UTC (rev 20500)
@@ -106,9 +106,10 @@
 }/*}}}*/
 void EnthalpyAnalysis::UpdateElements(Elements* elements,IoModel* iomodel,int analysis_counter,int analysis_type){/*{{{*/
 
-	bool dakota_analysis,islevelset,isenthalpy;
-	int frictionlaw;
-
+	bool dakota_analysis,ismovingfront,isenthalpy;
+	int frictionlaw,basalforcing_model;
+	int FrictionCoupling;
+	
 	/*Now, is the model 3d? otherwise, do nothing: */
 	if(iomodel->domaintype==Domain2DhorizontalEnum)return;
 
@@ -130,11 +131,12 @@
 	}
 
 	iomodel->Constant(&dakota_analysis,QmuIsdakotaEnum);
-	iomodel->Constant(&islevelset,TransientIslevelsetEnum);
+	iomodel->Constant(&ismovingfront,TransientIsmovingfrontEnum);
 	iomodel->Constant(&frictionlaw,FrictionLawEnum);
 
 	iomodel->FetchDataToInput(elements,ThicknessEnum);
 	iomodel->FetchDataToInput(elements,SurfaceEnum);
+	iomodel->FetchDataToInput(elements,SealevelEnum,0);
 	iomodel->FetchDataToInput(elements,BaseEnum);
 	iomodel->FetchDataToInput(elements,MaskIceLevelsetEnum);
 	iomodel->FetchDataToInput(elements,MaskGroundediceLevelsetEnum);
@@ -148,7 +150,6 @@
 	iomodel->FetchDataToInput(elements,TemperatureEnum);
 	iomodel->FetchDataToInput(elements,WaterfractionEnum);
 	iomodel->FetchDataToInput(elements,EnthalpyEnum);
-	iomodel->FetchDataToInput(elements,BasalforcingsGeothermalfluxEnum);
 	iomodel->FetchDataToInput(elements,WatercolumnEnum);
 	iomodel->FetchDataToInput(elements,BasalforcingsGroundediceMeltingRateEnum);
 	iomodel->FetchDataToInput(elements,VxEnum);
@@ -157,10 +158,19 @@
 	InputUpdateFromConstantx(elements,0.,VxMeshEnum);
 	InputUpdateFromConstantx(elements,0.,VyMeshEnum);
 	InputUpdateFromConstantx(elements,0.,VzMeshEnum);
-	if(islevelset){
-		iomodel->FetchDataToInput(elements,IceMaskNodeActivationEnum);
+	if(ismovingfront){
 		iomodel->FetchDataToInput(elements,MeshVertexonbaseEnum); // required for updating active nodes
 	}
+
+	/*Basal forcings variables*/
+	iomodel->Constant(&basalforcing_model,BasalforcingsEnum);
+	switch(basalforcing_model){
+		case MantlePlumeGeothermalFluxEnum:
+			break;
+		default:
+			iomodel->FetchDataToInput(elements,BasalforcingsGeothermalfluxEnum);
+			break;
+	}
 	
 	/*Friction law variables*/
 	switch(frictionlaw){
@@ -174,10 +184,13 @@
 			iomodel->FetchDataToInput(elements,FrictionMEnum);
 			break;
 		case 3:
+			iomodel->Constant(&FrictionCoupling,FrictionCouplingEnum);
 			iomodel->FetchDataToInput(elements,FrictionCEnum);
 			iomodel->FetchDataToInput(elements,FrictionAsEnum);
 			iomodel->FetchDataToInput(elements,FrictionQEnum);
-			iomodel->FetchDataToInput(elements,FrictionEffectivePressureEnum);
+			if (FrictionCoupling==0){
+				iomodel->FetchDataToInput(elements,FrictionEffectivePressureEnum);
+			}
 			break;
 		case 4:
 			iomodel->FetchDataToInput(elements,FrictionCoefficientEnum);
@@ -225,6 +238,7 @@
 	int frictionlaw;
 	iomodel->Constant(&frictionlaw,FrictionLawEnum);
 	if(frictionlaw==4 || frictionlaw==6) parameters->AddObject(iomodel->CopyConstantObject(FrictionGammaEnum));
+	if(frictionlaw==3) parameters->AddObject(iomodel->CopyConstantObject(FrictionCouplingEnum));
 }/*}}}*/
 
 /*Finite Element Analysis*/
@@ -233,8 +247,8 @@
 	/* Check if ice in element */
 	if(!element->IsIceInElement()) return;
 
-	/* Only update Constraints at the base of grounded ice*/
-	if(!(element->IsOnBase()) || element->IsFloating()) return;
+	/* Only update constraints at the base. */
+	if(!(element->IsOnBase())) return;
 
 	/*Intermediary*/
 	bool        isdynamicbasalspc;
@@ -524,7 +538,7 @@
 	IssmDouble kappa=this->EnthalpyDiffusionParameterVolume(element,EnthalpyPicardEnum); _assert_(kappa>=0.);
 
 	/* Start  looping on the number of gaussian points: */
-	Gauss* gauss=element->NewGauss(2);
+	Gauss* gauss=element->NewGauss(4);
 	for(int ig=gauss->begin();ig<gauss->end();ig++){
 		gauss->GaussPoint(ig);
 
@@ -642,7 +656,7 @@
 	IssmDouble  thermal_exchange_vel= element->GetMaterialParameter(MaterialsThermalExchangeVelocityEnum);
 
 	/* Start  looping on the number of gaussian points: */
-	Gauss* gauss=element->NewGaussBase(2);
+	Gauss* gauss=element->NewGaussBase(4);
 	for(int ig=gauss->begin();ig<gauss->end();ig++){
 		gauss->GaussPoint(ig);
 
@@ -731,7 +745,7 @@
 	}
 
 	/* Start  looping on the number of gaussian points: */
-	Gauss* gauss=element->NewGauss(3);
+	Gauss* gauss=element->NewGauss(4);
 	for(int ig=gauss->begin();ig<gauss->end();ig++){
 		gauss->GaussPoint(ig);
 
@@ -805,8 +819,9 @@
 	/* implementation of the basal condition decision chart of Aschwanden 2012, Fig.5 */
 	if(!element->IsOnBase() || element->IsFloating()) return NULL;
 
-	bool isdynamicbasalspc;
+	bool converged, isdynamicbasalspc;
 	int i, state;
+	int enthalpy_enum;
 	IssmDouble  dt,Jdet,scalar;
 	IssmDouble	enthalpy, enthalpyup, pressure, pressureup, watercolumn, meltingrate;
 	IssmDouble	vx,vy,vz;
@@ -824,10 +839,13 @@
 	element->GetVerticesCoordinatesBase(&xyz_list_base);
 	element->FindParam(&dt,TimesteppingTimeStepEnum);
 	element->FindParam(&isdynamicbasalspc,ThermalIsdynamicbasalspcEnum);
+	element->GetInputValue(&converged,ConvergedEnum);
+	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(EnthalpyPicardEnum);					 _assert_(enthalpy_input);
+	Input* enthalpy_input		 = element->GetInput(enthalpy_enum);					 _assert_(enthalpy_input);
 	Input* pressure_input		 = element->GetInput(PressureEnum);							 _assert_(pressure_input);
 	Input* watercolumn_input	 = element->GetInput(WatercolumnEnum);							 _assert_(watercolumn_input);
 	Input* meltingrate_input	 = element->GetInput(BasalforcingsGroundediceMeltingRateEnum);							 _assert_(meltingrate_input);
@@ -838,8 +856,8 @@
 	Friction* friction=new Friction(element,3);
 
 	/* Start  looping on the number of gaussian points: */
-	Gauss* gauss=element->NewGaussBase(2);
-	Gauss* gaussup=element->NewGaussTop(2);
+	Gauss* gauss=element->NewGaussBase(4);
+	Gauss* gaussup=element->NewGaussTop(4);
 	for(int ig=gauss->begin();ig<gauss->end();ig++){
 		gauss->GaussPoint(ig);
 		gaussup->GaussPoint(ig);
@@ -860,8 +878,11 @@
 			state=0;
 
 		switch (state) {
-			case 0:
-				// cold, dry base: apply basal surface forcing
+			case 0: case 1: case 2: case 3:
+				// cold, dry base; cold, wet base; refreezing temperate base; thin temperate base: 
+				// Apply basal surface forcing.
+				// Interpolated values of enthalpy on gauss nodes may indicate cold base, 
+				// although one node might have become temperate. So keep heat flux switched on.
 				geothermalflux_input->GetInputValue(&geothermalflux,gauss);
 				friction->GetAlpha2(&alpha2,gauss);
 				vx_input->GetInputValue(&vx,gauss);
@@ -874,15 +895,6 @@
 				for(i=0;i<numnodes;i++) 
 					pe->values[i]+=scalar*basis[i];
 				break;
-			case 1:
-				// cold, wet base: keep at pressure melting point 
-				break;
-			case 2:
-				// temperate, thin refreezing base: release spc
-				break;
-			case 3:
-				// temperate, thin melting base: set spc
-				break;
 			case 4:
 				// temperate, thick melting base: set grad H*n=0
 				for(i=0;i<numnodes;i++) 
@@ -932,7 +944,7 @@
 	IssmDouble  thermal_exchange_vel= element->GetMaterialParameter(MaterialsThermalExchangeVelocityEnum);
 
 	/* Start  looping on the number of gaussian points: */
-	Gauss* gauss=element->NewGaussBase(2);
+	Gauss* gauss=element->NewGaussBase(4);
 	for(int ig=gauss->begin();ig<gauss->end();ig++){
 		gauss->GaussPoint(ig);
 
@@ -1192,12 +1204,6 @@
 }/*}}}*/
 void           EnthalpyAnalysis::GetBasalConstraints(Vector<IssmDouble>* vec_spc,Element* element){/*{{{*/
 
-	/* Check if ice in element */
-	if(!element->IsIceInElement()) return;
-
-	/* Only update Constraints at the base of grounded ice*/
-	if(!(element->IsOnBase()) || element->IsFloating()) return;
-
 	/*Intermediary*/
 	bool        isdynamicbasalspc;
 	IssmDouble	dt;
@@ -1219,7 +1225,8 @@
 	/* Check if ice in element */
 	if(!element->IsIceInElement()) return;
 
-	/* Only update Constraints at the base of grounded ice*/
+	/* Only update constraints at the base. 
+	 * Floating ice is not affected by basal BC decision chart. */
 	if(!(element->IsOnBase()) || element->IsFloating()) return;
 
 	/*Intermediary*/
@@ -1262,15 +1269,15 @@
 				vec_spc->SetValue(element->nodes[i]->Sid(),1.,INS_VAL);
 				break;
 			case 2:
-				// temperate, thin refreezing base: release spc
-				vec_spc->SetValue(element->nodes[i]->Sid(),0.,INS_VAL);
+				// temperate, thin refreezing base: 
+				vec_spc->SetValue(element->nodes[i]->Sid(),1.,INS_VAL);
 				break;
 			case 3:
 				// temperate, thin melting base: set spc
 				vec_spc->SetValue(element->nodes[i]->Sid(),1.,INS_VAL);
 				break;
 			case 4:
-				// temperate, thick melting base: s
+				// temperate, thick melting base:
 				vec_spc->SetValue(element->nodes[i]->Sid(),1.,INS_VAL);
 				break;
 			default:
@@ -1289,7 +1296,8 @@
 	/* Check if ice in element */
 	if(!element->IsIceInElement()) return;
 
-	/* Only update Constraints at the base of grounded ice*/
+	/* Only update constraints at the base. 
+	 * Floating ice is not affected by basal BC decision chart.*/
 	if(!(element->IsOnBase()) || element->IsFloating()) return;
 
 	/*Intermediary*/
@@ -1575,11 +1583,5 @@
 	xDelete<IssmDouble>(serial_spc);
 }/*}}}*/
 void           EnthalpyAnalysis::UpdateConstraints(FemModel* femmodel){/*{{{*/
-
-	bool islevelset;
-	femmodel->parameters->FindParam(&islevelset,TransientIslevelsetEnum);
-	if(islevelset){
-		SetActiveNodesLSMx(femmodel);
-	}
-	return;
+	SetActiveNodesLSMx(femmodel);
 }/*}}}*/

Modified: issm/trunk/src/c/analyses/EnumToAnalysis.cpp
===================================================================
--- issm/trunk/src/c/analyses/EnumToAnalysis.cpp	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/analyses/EnumToAnalysis.cpp	2016-04-13 04:32:01 UTC (rev 20500)
@@ -13,6 +13,9 @@
 Analysis* EnumToAnalysis(int analysis_enum){
 
 	switch(analysis_enum){
+		#ifdef _HAVE_SMB_
+		case SmbAnalysisEnum : return new SmbAnalysis();
+		#endif
 		#ifdef _HAVE_ADJOINTBALANCETHICKNESS_
 		case AdjointBalancethicknessAnalysisEnum : return new AdjointBalancethicknessAnalysis();
 		#endif
@@ -64,6 +67,9 @@
 		#ifdef _HAVE_HYDROLOGYDCEFFICIENT_
 		case HydrologyDCEfficientAnalysisEnum : return new HydrologyDCEfficientAnalysis();
 		#endif
+		#ifdef _HAVE_HYDROLOGYSOMMERS_
+		case HydrologySommersAnalysisEnum : return new HydrologySommersAnalysis();
+		#endif
 		#ifdef _HAVE_MELTING_
 		case MeltingAnalysisEnum : return new MeltingAnalysis();
 		#endif
@@ -109,6 +115,9 @@
 		#ifdef _HAVE_LSFREINITIALIZATION_
 		case LsfReinitializationAnalysisEnum : return new LsfReinitializationAnalysis();
 		#endif
+		#ifdef _HAVE_SEALEVELRISE_
+		case SealevelriseAnalysisEnum : return new SealevelriseAnalysis();
+		#endif
 		default : _error_("enum provided not supported ("<<EnumToStringx(analysis_enum)<<")");
 	}
 }

Modified: issm/trunk/src/c/analyses/ExtrapolationAnalysis.cpp
===================================================================
--- issm/trunk/src/c/analyses/ExtrapolationAnalysis.cpp	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/analyses/ExtrapolationAnalysis.cpp	2016-04-13 04:32:01 UTC (rev 20500)
@@ -58,7 +58,8 @@
 	/* Intermediaries */
 	bool save_results;
 	int extvar_enum; 
-   femmodel->parameters->FindParam(&extvar_enum, ExtrapolationVariableEnum);
+	femmodel->parameters->FindParam(&save_results,SaveResultsEnum);
+	femmodel->parameters->FindParam(&extvar_enum, ExtrapolationVariableEnum);
 
 	/*activate formulation: */
 	femmodel->SetCurrentConfiguration(ExtrapolationAnalysisEnum);
@@ -66,11 +67,9 @@
 	if(VerboseSolution()) _printf0_("extrapolation of " << EnumToStringx(extvar_enum) << ": call computational core:\n");
 	solutionsequence_linear(femmodel);
 
-	save_results=true;
 	if(save_results){
 		if(VerboseSolution()) _printf0_("   saving results\n");
-		int outputs[2] = {VxEnum,VyEnum};
-		femmodel->RequestedOutputsx(&femmodel->results,&outputs[0],2);
+		femmodel->RequestedOutputsx(&femmodel->results,&extvar_enum,1);
 	}
 }/*}}}*/
 ElementVector* ExtrapolationAnalysis::CreateDVector(Element* element){/*{{{*/
@@ -83,32 +82,38 @@
 }/*}}}*/
 ElementMatrix* ExtrapolationAnalysis::CreateKMatrix(Element* element){/*{{{*/
 
-	if(!element->IsOnBase()) return NULL;
-	Element* basalelement = element->SpawnBasalElement();
-
 	/*Intermediaries */
-	int		   domaintype,dim;
-	int        i,row,col,stabilization;
-	bool	   extrapolatebydiffusion = true;
+	int	dim, domaintype, extrapolationcase;
+	int	i,row,col,stabilization;
+	bool	extrapolatebydiffusion;
 	IssmDouble Jdet,D_scalar,h;
 	IssmDouble norm_dlsf;
 	IssmDouble hx,hy,hz,kappa;
-	IssmDouble* xyz_list = NULL;
+	IssmDouble*	xyz_list = NULL;
+	Element*		workelement=NULL;
 
-	/*Get problem dimension*/
-	basalelement->FindParam(&domaintype,DomainTypeEnum);
+	/*Get problem case*/
+	extrapolationcase=GetExtrapolationCase(element);
+	switch(extrapolationcase){
+		case 0:
+			if(!element->IsOnBase()) return NULL; 
+			workelement = element->SpawnBasalElement(); 
+			break;
+		case 1: case 2: case 3: workelement=element; break;
+	}
+	/* get extrapolation dimension */
+	workelement->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");
+		case Domain2DverticalEnum: dim=1; break;
+		case Domain2DhorizontalEnum: dim=2; break;
+		case Domain3DEnum: dim=3; break;
 	}
 
 	/*Fetch number of nodes and dof for this finite element*/
-	int numnodes = basalelement->GetNumberOfNodes();
+	int numnodes = workelement->GetNumberOfNodes();
 
 	/*Initialize Element vector and other vectors*/
-	ElementMatrix* Ke     = basalelement->NewElementMatrix();
+	ElementMatrix* Ke     = workelement->NewElementMatrix();
 	IssmDouble*    B      = xNew<IssmDouble>(dim*numnodes);
 	IssmDouble*    Bprime = xNew<IssmDouble>(dim*numnodes);
 	IssmDouble*		D	  = xNew<IssmDouble>(dim*dim);
@@ -116,27 +121,27 @@
 	IssmDouble*		normal= xNew<IssmDouble>(dim);
 
 	/*Retrieve all inputs and parameters*/
-	Input* lsf_slopex_input=basalelement->GetInput(LevelsetfunctionSlopeXEnum); _assert_(lsf_slopex_input);
-	Input* lsf_slopey_input=basalelement->GetInput(LevelsetfunctionSlopeYEnum); _assert_(lsf_slopey_input);
-	basalelement->GetVerticesCoordinates(&xyz_list);
-	h = basalelement->CharacteristicLength();
+	Input* lsf_slopex_input=workelement->GetInput(LevelsetfunctionSlopeXEnum); _assert_(lsf_slopex_input);
+	Input* lsf_slopey_input=workelement->GetInput(LevelsetfunctionSlopeYEnum); _assert_(lsf_slopey_input);
+	workelement->GetVerticesCoordinates(&xyz_list);
 
 	/* Start  looping on the number of gaussian points: */
-	Gauss* gauss=basalelement->NewGauss(2);
+	Gauss* gauss=workelement->NewGauss(2);
 	for(int ig=gauss->begin();ig<gauss->end();ig++){/*{{{*/
 		gauss->GaussPoint(ig);
 
-		basalelement->JacobianDeterminant(&Jdet,xyz_list,gauss);
-		GetB(B,basalelement,xyz_list,gauss);
-		GetBprime(Bprime,basalelement,xyz_list,gauss);
+		workelement->JacobianDeterminant(&Jdet,xyz_list,gauss);
+		GetB(B,workelement,xyz_list,gauss,dim);
+		GetBprime(Bprime,workelement,xyz_list,gauss,dim);
 		
 		D_scalar=gauss->weight*Jdet;
 
+		extrapolatebydiffusion=true;
 		if(extrapolatebydiffusion){
 			/* diffuse values outward */
 			for(row=0;row<dim;row++)
 				for(col=0;col<dim;col++)
-					if(row==col)
+					if(row==col && row<2) //extrapolate only in xy-plane
 						D[row*dim+col] = D_scalar;
 					else
 						D[row*dim+col] = 0.;
@@ -150,7 +155,10 @@
 			/* extrapolate values along normal */
 			/* Get normal on ice boundary */
 			lsf_slopex_input->GetInputValue(&dlsf[0],gauss);
-			lsf_slopey_input->GetInputValue(&dlsf[1],gauss);
+			if(dim>1)
+				lsf_slopey_input->GetInputValue(&dlsf[1],gauss);
+			if(dim>2)
+				dlsf[2]=0.;
 			norm_dlsf=0.;
 			for(i=0;i<dim;i++)	norm_dlsf+=dlsf[i]*dlsf[i]; 
 			norm_dlsf=sqrt(norm_dlsf); _assert_(norm_dlsf>0.);
@@ -171,13 +179,14 @@
 						Bprime,dim,numnodes,0,
 						&Ke->values[0],1);
 
-			/* Stabilization *//*{{{*/
+			/* stabilization *//*{{{*/
+			/* do not use streamline upwinding for extrapolation: it yields oscillating results due to diffusion along normal direction, but none across */
 			stabilization=1;
 			if (stabilization==0){/* no stabilization, do nothing*/}
 			else if(stabilization==1){
 				/* Artificial Diffusion */
-				basalelement->ElementSizes(&hx,&hy,&hz);
-				h=sqrt( pow(hx*normal[0],2) + pow(hy*normal[1],2));
+				workelement->ElementSizes(&hx,&hy,&hz);
+				h=sqrt(pow(hx*normal[0],2) + pow(hy*normal[1],2));
 				kappa=h/2.+1.e-14; 
 				for(row=0;row<dim;row++)
 					for(col=0;col<dim;col++)
@@ -190,17 +199,7 @@
 							Bprime,dim,numnodes,0,
 							&Ke->values[0],1);
 			}
-			else if(stabilization==2){
-				/*Streamline upwinding - do not use this for extrapolation: yields oscillating results due to smoothing along normal, not across */
-				for(row=0;row<dim;row++)
-					for(col=0;col<dim;col++)
-						D[row*dim+col]=h/(2.*1.)*normal[row]*normal[col];
-
-				TripleMultiply(Bprime,dim,numnodes,1,
-							D,dim,dim,0,
-							Bprime,dim,numnodes,0,
-							&Ke->values[0],1);
-			}/*}}}*/
+			/*}}}*/
 		}
 	}/*}}}*/
 
@@ -212,31 +211,37 @@
 	xDelete<IssmDouble>(dlsf);
 	xDelete<IssmDouble>(normal);
 	delete gauss;
-	if(domaintype!=Domain2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
+	if(extrapolationcase==0){workelement->DeleteMaterials(); delete workelement;};
 	return Ke;
 
 }/*}}}*/
 ElementVector* ExtrapolationAnalysis::CreatePVector(Element* element){/*{{{*/
 
-	if(!element->IsOnBase()) return NULL;
-	Element* basalelement = element->SpawnBasalElement();
+	/*Intermediaries */
+	Element* workelement=NULL;
 
-	/*Intermediaries */
-	int i, domaintype;
-	
+	/*Get problem dimension*/
+	int extrapolationcase=GetExtrapolationCase(element);
+	switch(extrapolationcase){
+		case 0: 
+			if(!element->IsOnBase()) return NULL; 
+			workelement = element->SpawnBasalElement(); 
+			break;
+		case 1: case 2: case 3: workelement=element; break;
+	}
+
 	/*Fetch number of nodes */
-	int numnodes = basalelement->GetNumberOfNodes();
+	int numnodes = workelement->GetNumberOfNodes();
 
 	/*Initialize Element vector*/
-	ElementVector* pe = basalelement->NewElementVector();
-	for(i=0;i<numnodes;i++) 
+	ElementVector* pe = workelement->NewElementVector();
+	for(int i=0;i<numnodes;i++) 
 		pe->values[i]=0.; 
 
-	basalelement->FindParam(&domaintype,DomainTypeEnum);
-	if(domaintype!=Domain2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
+	if(extrapolationcase==0){workelement->DeleteMaterials(); delete workelement;};
 	return pe;
 }/*}}}*/
-void           ExtrapolationAnalysis::GetB(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/
+void           ExtrapolationAnalysis::GetB(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss, int dim){/*{{{*/
 	/*Compute B  matrix. B=[B1 B2 B3] where Bi is of size 3*NDOF2. 
 	 * For node i, Bi can be expressed in the actual coordinate system
 	 * by: 
@@ -255,15 +260,14 @@
 	element->NodalFunctions(basis,gauss);
 
 	/*Build B: */
-	for(int i=0;i<numnodes;i++){
-		B[numnodes*0+i] = basis[i];
-		B[numnodes*1+i] = basis[i];
-	}
+	for(int i=0;i<numnodes;i++)
+		for(int d=0;d<dim;d++)
+			B[numnodes*d+i] = basis[i];
 
 	/*Clean-up*/
 	xDelete<IssmDouble>(basis);
 }/*}}}*/
-void           ExtrapolationAnalysis::GetBprime(IssmDouble* Bprime,Element* element,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/
+void           ExtrapolationAnalysis::GetBprime(IssmDouble* Bprime,Element* element,IssmDouble* xyz_list,Gauss* gauss, int dim){/*{{{*/
 	/*Compute B'  matrix. B'=[B1' B2' B3'] where Bi' is of size 3*NDOF2. 
 	 * For node i, Bi' can be expressed in the actual coordinate system
 	 * by: 
@@ -278,14 +282,13 @@
 	int numnodes = element->GetNumberOfNodes();
 
 	/*Get nodal functions derivatives*/
-	IssmDouble* dbasis=xNew<IssmDouble>(2*numnodes);
+	IssmDouble* dbasis=xNew<IssmDouble>(dim*numnodes);
 	element->NodalFunctionsDerivatives(dbasis,xyz_list,gauss);
 
 	/*Build B': */
-	for(int i=0;i<numnodes;i++){
-		Bprime[numnodes*0+i] = dbasis[0*numnodes+i];
-		Bprime[numnodes*1+i] = dbasis[1*numnodes+i];
-	}
+	for(int i=0;i<numnodes;i++)
+		for(int d=0;d<dim;d++)
+			Bprime[numnodes*d+i] = dbasis[d*numnodes+i];
 
 	/*Clean-up*/
 	xDelete<IssmDouble>(dbasis);
@@ -299,19 +302,41 @@
 }/*}}}*/
 void           ExtrapolationAnalysis::InputUpdateFromSolution(IssmDouble* solution,Element* element){/*{{{*/
 
-	int domaintype, extrapolationvariable;
-	element->FindParam(&domaintype,DomainTypeEnum);
+	int extrapolationvariable, extrapolationcase;
+	extrapolationcase=GetExtrapolationCase(element);
 	element->FindParam(&extrapolationvariable, ExtrapolationVariableEnum);
-	switch(domaintype){
-		case Domain2DhorizontalEnum:
+	switch(extrapolationcase){
+		case 0:
 			element->InputUpdateFromSolutionOneDof(solution,extrapolationvariable);
 			break;
-		case Domain3DEnum:
+		case 1:
+			element->InputUpdateFromSolutionOneDof(solution,extrapolationvariable);
+			break;
+		case 2:
 			element->InputUpdateFromSolutionOneDofCollapsed(solution,extrapolationvariable);
 			break;
-		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+		case 3:
+			element->InputUpdateFromSolutionOneDof(solution,extrapolationvariable);
+			break;
 	}
 }/*}}}*/
+int				ExtrapolationAnalysis::GetExtrapolationCase(Element* element){/*{{{*/
+
+	/* Get case of extrapolation, depending on domain quality, and extrapolation variable */
+	int domaintype, extrapolationvariable;
+	int extrapolationcase;
+	element->FindParam(&domaintype,DomainTypeEnum);
+	switch(domaintype){
+		case Domain2DverticalEnum: extrapolationcase=0; break;
+		case Domain2DhorizontalEnum: extrapolationcase=1;break;
+		case Domain3DEnum:  
+			element->FindParam(&extrapolationvariable, ExtrapolationVariableEnum);
+			if(extrapolationvariable==ThicknessEnum) extrapolationcase=2; // scalar fields that are constant along z-axis
+			else extrapolationcase=3; // scalar fields that vary along z-axis
+			break;
+	}
+	return extrapolationcase;
+}/*}}}*/
 void           ExtrapolationAnalysis::SetConstraintsOnIce(Element* element){/*{{{*/
 
 	int numnodes=element->GetNumberOfNodes();	

Modified: issm/trunk/src/c/analyses/ExtrapolationAnalysis.h
===================================================================
--- issm/trunk/src/c/analyses/ExtrapolationAnalysis.h	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/analyses/ExtrapolationAnalysis.h	2016-04-13 04:32:01 UTC (rev 20500)
@@ -25,11 +25,12 @@
 	ElementMatrix* CreateJacobianMatrix(Element* element);
 	ElementMatrix* CreateKMatrix(Element* element);
 	ElementVector* CreatePVector(Element* element);
-	void           GetB(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss);
-	void           GetBprime(IssmDouble* Bprime,Element* element,IssmDouble* xyz_list,Gauss* gauss);
+	void           GetB(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss, int dim);
+	void           GetBprime(IssmDouble* Bprime,Element* element,IssmDouble* xyz_list,Gauss* gauss, int dim);
 	void           GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
 	void           GradientJ(Vector<IssmDouble>* gradient,Element* element,int control_type,int control_index);
 	void           InputUpdateFromSolution(IssmDouble* solution,Element* element);
+	int				GetExtrapolationCase(Element* element);
 	void           SetConstraintsOnIce(Element* element);
 	void           UpdateConstraints(FemModel* femmodel);
 };

Modified: issm/trunk/src/c/analyses/FreeSurfaceBaseAnalysis.cpp
===================================================================
--- issm/trunk/src/c/analyses/FreeSurfaceBaseAnalysis.cpp	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/analyses/FreeSurfaceBaseAnalysis.cpp	2016-04-13 04:32:01 UTC (rev 20500)
@@ -76,6 +76,7 @@
 	}
 
 	iomodel->FetchDataToInput(elements,SurfaceEnum);
+	iomodel->FetchDataToInput(elements,SealevelEnum,0);
 	iomodel->FetchDataToInput(elements,MaskIceLevelsetEnum);
 	iomodel->FetchDataToInput(elements,BasalforcingsGroundediceMeltingRateEnum);
 	iomodel->FetchDataToInput(elements,BasalforcingsFloatingiceMeltingRateEnum);

Modified: issm/trunk/src/c/analyses/FreeSurfaceTopAnalysis.cpp
===================================================================
--- issm/trunk/src/c/analyses/FreeSurfaceTopAnalysis.cpp	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/analyses/FreeSurfaceTopAnalysis.cpp	2016-04-13 04:32:01 UTC (rev 20500)
@@ -66,7 +66,7 @@
 	int finiteelement = P1Enum;
 
 	/*Fetch data needed: */
-	iomodel->Constant(&smb_model,SurfaceforcingsEnum);
+	iomodel->Constant(&smb_model,SmbEnum);
 
 	/*Update elements: */
 	int counter=0;
@@ -79,6 +79,7 @@
 	}
 
 	iomodel->FetchDataToInput(elements,SurfaceEnum);
+	iomodel->FetchDataToInput(elements,SealevelEnum,0);
 	iomodel->FetchDataToInput(elements,MaskIceLevelsetEnum);
 	iomodel->FetchDataToInput(elements,VxEnum);
 	if(iomodel->domaintype!=Domain2DhorizontalEnum){
@@ -89,8 +90,8 @@
 		iomodel->FetchDataToInput(elements,VzEnum);
 	}
 	switch(smb_model){
-		case SMBEnum:
-			iomodel->FetchDataToInput(elements,SurfaceforcingsMassBalanceEnum,0.);
+		case SMBforcingEnum:
+			iomodel->FetchDataToInput(elements,SmbMassBalanceEnum,0.);
 			break;
 		default:
 			/*Nothing for now*/
@@ -273,7 +274,7 @@
 	/*Retrieve all inputs and parameters*/
 	topelement->GetVerticesCoordinates(&xyz_list);
 	topelement->FindParam(&dt,TimesteppingTimeStepEnum);
-	Input* ms_input      = topelement->GetInput(SurfaceforcingsMassBalanceEnum);  _assert_(ms_input);
+	Input* ms_input      = topelement->GetInput(SmbMassBalanceEnum);  _assert_(ms_input);
 	Input* surface_input = topelement->GetInput(SurfaceEnum);                     _assert_(surface_input);
 	Input* vz_input      = NULL;
 	switch(dim){

Modified: issm/trunk/src/c/analyses/GiaAnalysis.cpp
===================================================================
--- issm/trunk/src/c/analyses/GiaAnalysis.cpp	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/analyses/GiaAnalysis.cpp	2016-04-13 04:32:01 UTC (rev 20500)
@@ -32,6 +32,7 @@
 	iomodel->FetchDataToInput(elements,ThicknessEnum);
 	iomodel->FetchDataToInput(elements,GiaMantleViscosityEnum);
 	iomodel->FetchDataToInput(elements,GiaLithosphereThicknessEnum);
+	iomodel->FetchDataToInput(elements,MaskIceLevelsetEnum);
 }/*}}}*/
 void GiaAnalysis::UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum){/*{{{*/
 }/*}}}*/

Modified: issm/trunk/src/c/analyses/HydrologyShreveAnalysis.cpp
===================================================================
--- issm/trunk/src/c/analyses/HydrologyShreveAnalysis.cpp	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/analyses/HydrologyShreveAnalysis.cpp	2016-04-13 04:32:01 UTC (rev 20500)
@@ -57,6 +57,7 @@
 	iomodel->FetchDataToInput(elements,ThicknessEnum);
 	iomodel->FetchDataToInput(elements,SurfaceEnum);
 	iomodel->FetchDataToInput(elements,BaseEnum);
+	iomodel->FetchDataToInput(elements,SealevelEnum,0);
 	if(iomodel->domaintype!=Domain2DhorizontalEnum){
 		iomodel->FetchDataToInput(elements,MeshVertexonbaseEnum);
 		iomodel->FetchDataToInput(elements,MeshVertexonsurfaceEnum);

Modified: issm/trunk/src/c/analyses/L2ProjectionBaseAnalysis.cpp
===================================================================
--- issm/trunk/src/c/analyses/L2ProjectionBaseAnalysis.cpp	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/analyses/L2ProjectionBaseAnalysis.cpp	2016-04-13 04:32:01 UTC (rev 20500)
@@ -41,8 +41,9 @@
 
 	iomodel->FetchDataToInput(elements,SurfaceEnum);
 	iomodel->FetchDataToInput(elements,BaseEnum);
+	iomodel->FetchDataToInput(elements,SealevelEnum,0);
 	iomodel->FetchDataToInput(elements,MaskIceLevelsetEnum);
-	if(iomodel->domaintype!=Domain2DhorizontalEnum){
+	if(iomodel->domaintype!=Domain2DhorizontalEnum & iomodel->domaintype!=Domain3DsurfaceEnum){
 		iomodel->FetchDataToInput(elements,MeshVertexonbaseEnum);
 		iomodel->FetchDataToInput(elements,MeshVertexonsurfaceEnum);
 	}

Modified: issm/trunk/src/c/analyses/LevelsetAnalysis.cpp
===================================================================
--- issm/trunk/src/c/analyses/LevelsetAnalysis.cpp	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/analyses/LevelsetAnalysis.cpp	2016-04-13 04:32:01 UTC (rev 20500)
@@ -11,7 +11,7 @@
 #include "../solutionsequences/solutionsequences.h"
 
 void LevelsetAnalysis::CreateConstraints(Constraints* constraints,IoModel* iomodel){/*{{{*/
-	return;
+	IoModelToConstraintsx(constraints,iomodel,SpclevelsetEnum,LevelsetAnalysisEnum,P1Enum);
 }
 /*}}}*/
 void LevelsetAnalysis::CreateLoads(Loads* loads, IoModel* iomodel){/*{{{*/
@@ -47,33 +47,24 @@
 	iomodel->FetchDataToInput(elements,VxEnum);
 	iomodel->FetchDataToInput(elements,VyEnum);
 
-	/*Get calving parameters*/
-	bool iscalving;
+	/*Get moving front parameters*/
 	int  calvinglaw;
-	iomodel->Constant(&iscalving,TransientIscalvingEnum);
-	if(iscalving){
-		iomodel->Constant(&calvinglaw,CalvingLawEnum);
-		iomodel->Constant(&iscalving,TransientIscalvingEnum);
-		switch(calvinglaw){
-			case DefaultCalvingEnum:
-				iomodel->FetchDataToInput(elements,CalvingCalvingrateEnum);
-				iomodel->FetchDataToInput(elements,CalvingMeltingrateEnum);
-				break;
-			case CalvingLevermannEnum:
-				iomodel->FetchDataToInput(elements,CalvinglevermannCoeffEnum);
-				iomodel->FetchDataToInput(elements,CalvinglevermannMeltingrateEnum);
-				break;
-			case CalvingPiEnum:
-				iomodel->FetchDataToInput(elements,CalvingpiCoeffEnum);
-				iomodel->FetchDataToInput(elements,CalvingpiMeltingrateEnum);
-				break;
-			case CalvingDevEnum:
-				iomodel->FetchDataToInput(elements,CalvingpiCoeffEnum);
-				iomodel->FetchDataToInput(elements,CalvingMeltingrateEnum);
-				break;
-			default:
-				_error_("Calving law "<<EnumToStringx(calvinglaw)<<" not supported yet");
-		}
+	iomodel->Constant(&calvinglaw,CalvingLawEnum);
+	switch(calvinglaw){
+		case DefaultCalvingEnum:
+			iomodel->FetchDataToInput(elements,CalvingCalvingrateEnum);
+			iomodel->FetchDataToInput(elements,CalvingMeltingrateEnum);
+			break;
+		case CalvingLevermannEnum:
+			iomodel->FetchDataToInput(elements,CalvinglevermannCoeffEnum);
+			iomodel->FetchDataToInput(elements,CalvinglevermannMeltingrateEnum);
+			break;
+		case CalvingDevEnum:
+			iomodel->FetchDataToInput(elements,CalvingdevCoeffEnum);
+			iomodel->FetchDataToInput(elements,CalvingMeltingrateEnum);
+			break;
+		default:
+			_error_("Calving law "<<EnumToStringx(calvinglaw)<<" not supported yet");
 	}
 }
 /*}}}*/
@@ -124,12 +115,287 @@
 ElementMatrix* LevelsetAnalysis::CreateKMatrix(Element* element){/*{{{*/
 
 	if(!element->IsOnBase()) return NULL;
-	_error_("not implemented yet");
+	Element* basalelement = element->SpawnBasalElement();
+
+	/*Intermediaries */
+	int  stabilization,dim, domaintype, calvinglaw;
+	int i, row, col;
+	IssmDouble kappa;
+	IssmDouble Jdet, dt, D_scalar;
+	IssmDouble h,hx,hy,hz;
+	IssmDouble vel;
+	IssmDouble norm_dlsf, norm_calving, calvingrate, meltingrate;
+	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){
+		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();
+
+	/*Initialize Element vector and other vectors*/
+	ElementMatrix* Ke       = basalelement->NewElementMatrix();
+	IssmDouble*    basis    = xNew<IssmDouble>(numnodes);
+	IssmDouble*    B        = xNew<IssmDouble>(dim*numnodes);
+	IssmDouble*    Bprime   = xNew<IssmDouble>(dim*numnodes);
+	IssmDouble*    D        = xNew<IssmDouble>(dim*dim);
+	IssmDouble*    v        = xNew<IssmDouble>(dim);
+	IssmDouble*    w        = xNew<IssmDouble>(dim);
+	IssmDouble*    c        = xNewZeroInit<IssmDouble>(dim);
+	IssmDouble*    m        = xNewZeroInit<IssmDouble>(dim);
+	IssmDouble*    dlsf     = xNew<IssmDouble>(dim);
+
+	/*Retrieve all inputs and parameters*/
+	basalelement->GetVerticesCoordinates(&xyz_list);
+	basalelement->FindParam(&dt,TimesteppingTimeStepEnum);
+	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;
+
+	/*Load velocities*/
+	switch(domaintype){
+		case Domain2DverticalEnum:
+			vx_input=basalelement->GetInput(VxEnum); _assert_(vx_input);
+			break;
+		case Domain2DhorizontalEnum:
+			vx_input=basalelement->GetInput(VxEnum); _assert_(vx_input);
+			vy_input=basalelement->GetInput(VyEnum); _assert_(vy_input);
+			break;
+		case Domain3DEnum:
+			vx_input=basalelement->GetInput(VxAverageEnum); _assert_(vx_input);
+			vy_input=basalelement->GetInput(VyAverageEnum); _assert_(vy_input);
+			break;
+		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+	}
+
+	/*Load calving inputs*/
+	switch(calvinglaw){
+		case DefaultCalvingEnum:
+		case CalvingDevEnum:
+			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(CalvinglevermannMeltingrateEnum);     _assert_(meltingrate_input);
+			break;
+		default:
+			_error_("Calving law "<<EnumToStringx(calvinglaw)<<" not supported yet");
+	}
+
+	/* Start  looping on the number of gaussian points: */
+	Gauss* gauss=basalelement->NewGauss(2);
+	for(int ig=gauss->begin();ig<gauss->end();ig++){
+		gauss->GaussPoint(ig);
+
+		basalelement->JacobianDeterminant(&Jdet,xyz_list,gauss);
+		D_scalar=gauss->weight*Jdet;
+
+		/* Transient */
+		if(dt!=0.){
+			basalelement->NodalFunctions(basis,gauss);
+			TripleMultiply(basis,numnodes,1,0,
+						&D_scalar,1,1,0,
+						basis,1,numnodes,0,
+						&Ke->values[0],1);
+			D_scalar*=dt;
+		}
+
+		/* Advection */
+		GetB(B,basalelement,xyz_list,gauss); 
+		GetBprime(Bprime,basalelement,xyz_list,gauss); 
+		vx_input->GetInputValue(&v[0],gauss);
+		vy_input->GetInputValue(&v[1],gauss); 
+
+		/*Get calving speed*/
+		switch(calvinglaw){
+			case DefaultCalvingEnum:
+				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);
+
+				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:
+			case CalvingDevEnum:
+				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;
+
+			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];
+
+		/*Compute D*/
+		for(row=0;row<dim;row++){
+			for(col=0;col<dim;col++){
+				if(row==col)
+				 D[row*dim+col]=D_scalar*w[row];
+				else
+				 D[row*dim+col]=0.;
+			}
+		}
+
+		TripleMultiply(B,dim,numnodes,1,
+					D,dim,dim,0,
+					Bprime,dim,numnodes,0,
+					&Ke->values[0],1);
+
+		/* Stabilization */
+		vel=0.;
+		for(i=0;i<dim;i++) vel+=w[i]*w[i];
+		vel=sqrt(vel)+1.e-14;
+		switch(stabilization){
+			case 0:
+				// no stabilization, do nothing
+				break;
+			case 1:
+				/* Artificial Diffusion */
+				basalelement->ElementSizes(&hx,&hy,&hz);
+				h=sqrt( pow(hx*w[0]/vel,2) + pow(hy*w[1]/vel,2) ); 
+				kappa=h*vel/2.;
+				for(row=0;row<dim;row++)
+					for(col=0;col<dim;col++)
+					if(row==col)
+						D[row*dim+col]=D_scalar*kappa;
+					else
+						D[row*dim+col]=0.;
+
+				TripleMultiply(Bprime,dim,numnodes,1,
+							D,dim,dim,0,
+							Bprime,dim,numnodes,0,
+							&Ke->values[0],1);
+				break;	
+			case 2:
+				/* Streamline Upwinding */
+				basalelement->ElementSizes(&hx,&hy,&hz);
+				h=sqrt( pow(hx*w[0]/vel,2) + pow(hy*w[1]/vel,2) );
+				for(row=0;row<dim;row++) 
+					for(col=0;col<dim;col++) 
+						D[row*dim+col] = D_scalar*h/(2.*vel)*w[row]*w[col];
+
+				TripleMultiply(Bprime,dim,numnodes,1,
+							D,dim,dim,0,
+							Bprime,dim,numnodes,0,
+							&Ke->values[0],1);
+				break;
+			default:
+				_error_("unknown type of stabilization in LevelsetAnalysis.cpp");
+		}
+	}
+
+	/*Clean up and return*/
+	xDelete<IssmDouble>(xyz_list);
+	xDelete<IssmDouble>(basis);
+	xDelete<IssmDouble>(B);
+	xDelete<IssmDouble>(D);
+	xDelete<IssmDouble>(Bprime);
+	xDelete<IssmDouble>(v);
+	xDelete<IssmDouble>(w);
+	xDelete<IssmDouble>(c);
+	xDelete<IssmDouble>(m);
+	xDelete<IssmDouble>(dlsf);
+	delete gauss;
+	if(domaintype!=Domain2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
+	return Ke;
 }/*}}}*/
 ElementVector* LevelsetAnalysis::CreatePVector(Element* element){/*{{{*/
 	
 	if(!element->IsOnBase()) return NULL;
-	_error_("not implemented yet");
+	Element* basalelement = element->SpawnBasalElement();
+
+	/*Intermediaries */
+	int i, ig, domaintype;
+	IssmDouble  Jdet,dt;
+	IssmDouble  lsf;
+	IssmDouble* xyz_list = NULL;
+	
+	/*Fetch number of nodes and dof for this finite element*/
+	int numnodes = basalelement->GetNumberOfNodes();
+
+	/*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);
+		for(ig=gauss->begin();ig<gauss->end();ig++){
+			gauss->GaussPoint(ig);
+
+			basalelement->JacobianDeterminant(&Jdet,xyz_list,gauss);
+			basalelement->NodalFunctions(basis,gauss);
+
+			/* old function value */
+			levelset_input->GetInputValue(&lsf,gauss);
+			for(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;
+	}
+
+	return pe;
 }/*}}}*/
 void           LevelsetAnalysis::GetB(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/
 	/*Compute B  matrix. B=[B1 B2 B3] where Bi is of size 3*NDOF2. 

Modified: issm/trunk/src/c/analyses/MasstransportAnalysis.cpp
===================================================================
--- issm/trunk/src/c/analyses/MasstransportAnalysis.cpp	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/analyses/MasstransportAnalysis.cpp	2016-04-13 04:32:01 UTC (rev 20500)
@@ -117,18 +117,16 @@
 }/*}}}*/
 void MasstransportAnalysis::UpdateElements(Elements* elements,IoModel* iomodel,int analysis_counter,int analysis_type){/*{{{*/
 
-	int    stabilization,finiteelement,smb_model;
+	int    stabilization,finiteelement;
 	bool   dakota_analysis;
-	bool   isdelta18o,ismungsm;
 	bool   isgroundingline;
-	bool   islevelset;
+	bool   ismovingfront;
 
 	/*Fetch data needed: */
 	iomodel->Constant(&stabilization,MasstransportStabilizationEnum);
 	iomodel->Constant(&dakota_analysis,QmuIsdakotaEnum);
-	iomodel->Constant(&smb_model,SurfaceforcingsEnum);
 	iomodel->Constant(&isgroundingline,TransientIsgroundinglineEnum);
-	iomodel->Constant(&islevelset,TransientIslevelsetEnum);
+	iomodel->Constant(&ismovingfront,TransientIsmovingfrontEnum);
 
 	/*Finite element type*/
 	finiteelement = P1Enum;
@@ -149,6 +147,7 @@
 	iomodel->FetchDataToInput(elements,ThicknessEnum);
 	iomodel->FetchDataToInput(elements,SurfaceEnum);
 	iomodel->FetchDataToInput(elements,BaseEnum);
+	iomodel->FetchDataToInput(elements,SealevelEnum,0);
 	iomodel->FetchDataToInput(elements,MaskIceLevelsetEnum);
 	iomodel->FetchDataToInput(elements,MaskGroundediceLevelsetEnum);
 	iomodel->FetchDataToInput(elements,BasalforcingsGroundediceMeltingRateEnum);
@@ -167,55 +166,6 @@
 		iomodel->FetchDataToInput(elements,MeshVertexonbaseEnum);
 		iomodel->FetchDataToInput(elements,MeshVertexonsurfaceEnum);
 	}
-
-	if(islevelset){
-		iomodel->FetchDataToInput(elements,IceMaskNodeActivationEnum);
-	}
-
-	switch(smb_model){
-		case SMBEnum:
-			iomodel->FetchDataToInput(elements,SurfaceforcingsMassBalanceEnum,0.);
-			break;
-		case SMBpddEnum:
-			iomodel->Constant(&isdelta18o,SurfaceforcingsIsdelta18oEnum);
-			iomodel->Constant(&ismungsm,SurfaceforcingsIsmungsmEnum);
-			iomodel->FetchDataToInput(elements,ThermalSpctemperatureEnum);
-			if(isdelta18o || ismungsm){
-				iomodel->FetchDataToInput(elements,SurfaceforcingsTemperaturesLgmEnum);
-				iomodel->FetchDataToInput(elements,SurfaceforcingsTemperaturesPresentdayEnum);
-				iomodel->FetchDataToInput(elements,SurfaceforcingsPrecipitationsPresentdayEnum);
-				iomodel->FetchDataToInput(elements,SurfaceforcingsPrecipitationsLgmEnum);
-			}
-			else{
-			        iomodel->FetchDataToInput(elements,SurfaceforcingsPrecipitationEnum);
-				iomodel->FetchDataToInput(elements,SurfaceforcingsMonthlytemperaturesEnum);
-			}
-
-			break;
-		case SMBgradientsEnum:
-			iomodel->FetchDataToInput(elements,SurfaceforcingsHrefEnum);
-			iomodel->FetchDataToInput(elements,SurfaceforcingsSmbrefEnum);
-			iomodel->FetchDataToInput(elements,SurfaceforcingsBPosEnum);
-			iomodel->FetchDataToInput(elements,SurfaceforcingsBNegEnum);
-			break;
-		case SMBhenningEnum:
-			iomodel->FetchDataToInput(elements,SurfaceforcingsSmbrefEnum,0.);
-			break;
-		case SMBcomponentsEnum:
-			iomodel->FetchDataToInput(elements,SurfaceforcingsAccumulationEnum,0.);
-			iomodel->FetchDataToInput(elements,SurfaceforcingsEvaporationEnum,0.);
-			iomodel->FetchDataToInput(elements,SurfaceforcingsRunoffEnum,0.);
-			break;
-		case SMBmeltcomponentsEnum:
-			iomodel->FetchDataToInput(elements,SurfaceforcingsAccumulationEnum,0.);
-			iomodel->FetchDataToInput(elements,SurfaceforcingsEvaporationEnum,0.);
-			iomodel->FetchDataToInput(elements,SurfaceforcingsMeltEnum,0.);
-			iomodel->FetchDataToInput(elements,SurfaceforcingsRefreezeEnum,0.);
-			break;
-		default:
-			_error_("Surface mass balance model "<<EnumToStringx(smb_model)<<" not supported yet");
-	}
-
 }/*}}}*/
 void MasstransportAnalysis::UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum){/*{{{*/
 
@@ -233,6 +183,8 @@
 	parameters->AddObject(new IntParam(MasstransportNumRequestedOutputsEnum,numoutputs));
 	if(numoutputs)parameters->AddObject(new StringArrayParam(MasstransportRequestedOutputsEnum,requestedoutputs,numoutputs));
 	iomodel->DeleteData(&requestedoutputs,numoutputs,MasstransportRequestedOutputsEnum);
+	
+	
 
 }/*}}}*/
 
@@ -548,7 +500,7 @@
 	Input* gmb_input           = element->GetInput(BasalforcingsGroundediceMeltingRateEnum);  _assert_(gmb_input);
 	Input* fmb_input           = element->GetInput(BasalforcingsFloatingiceMeltingRateEnum);  _assert_(fmb_input);
 	Input* groundedice_input   = element->GetInput(MaskGroundediceLevelsetEnum);              _assert_(groundedice_input);
-	Input* ms_input            = element->GetInput(SurfaceforcingsMassBalanceEnum);           _assert_(ms_input);
+	Input* ms_input            = element->GetInput(SmbMassBalanceEnum);                       _assert_(ms_input);
 	Input* thickness_input     = element->GetInput(ThicknessEnum);                            _assert_(thickness_input);
 
 	/* Start  looping on the number of gaussian points: */
@@ -598,7 +550,7 @@
 	element->FindParam(&dt,TimesteppingTimeStepEnum);
 	Input* gmb_input           = element->GetInput(BasalforcingsGroundediceMeltingRateEnum); _assert_(gmb_input);
 	Input* fmb_input           = element->GetInput(BasalforcingsFloatingiceMeltingRateEnum); _assert_(fmb_input);
-	Input* ms_input            = element->GetInput(SurfaceforcingsMassBalanceEnum);          _assert_(ms_input);
+	Input* ms_input            = element->GetInput(SmbMassBalanceEnum);          _assert_(ms_input);
 	Input* groundedice_input   = element->GetInput(MaskGroundediceLevelsetEnum);             _assert_(groundedice_input);
 	Input* thickness_input     = element->GetInput(ThicknessEnum);                           _assert_(thickness_input);
 
@@ -711,13 +663,15 @@
 
 	/*Fetch dof list and allocate solution vector*/
 	basalelement->GetDofList(&doflist,NoneApproximationEnum,GsetEnum);
-	IssmDouble* newthickness = xNew<IssmDouble>(numnodes);
-	IssmDouble* newbed       = xNew<IssmDouble>(numnodes);
-	IssmDouble* newsurface   = xNew<IssmDouble>(numnodes);
-	IssmDouble* oldthickness = xNew<IssmDouble>(numnodes);
-	IssmDouble* oldbed       = xNew<IssmDouble>(numnodes);
-	IssmDouble* oldsurface   = xNew<IssmDouble>(numnodes);
-	IssmDouble* phi          = xNew<IssmDouble>(numnodes);
+	IssmDouble* newthickness   = xNew<IssmDouble>(numnodes);
+	IssmDouble* deltathickness = xNew<IssmDouble>(numnodes);
+	IssmDouble* newbase        = xNew<IssmDouble>(numnodes);
+	IssmDouble* newsurface     = xNew<IssmDouble>(numnodes);
+	IssmDouble* oldthickness   = xNew<IssmDouble>(numnodes);
+	IssmDouble* oldbase        = xNew<IssmDouble>(numnodes);
+	IssmDouble* oldsurface     = xNew<IssmDouble>(numnodes);
+	IssmDouble* phi            = xNew<IssmDouble>(numnodes);
+	IssmDouble* sealevel       = xNew<IssmDouble>(numnodes);
 
 	/*Use the dof list to index into the solution vector: */
 	basalelement->FindParam(&minthickness,MasstransportMinThicknessEnum);
@@ -728,31 +682,34 @@
 		if(newthickness[i]<minthickness) newthickness[i]=minthickness;
 	}
 
-	/*Get previous bed, thickness and surface*/
-	basalelement->GetInputListOnNodes(&oldbed[0],BaseEnum);
+	/*Get previous base, thickness, surfac and current sealevel:*/
+	basalelement->GetInputListOnNodes(&oldbase[0],BaseEnum);
 	basalelement->GetInputListOnNodes(&oldsurface[0],SurfaceEnum);
 	basalelement->GetInputListOnNodes(&oldthickness[0],ThicknessEnum);
 	basalelement->GetInputListOnNodes(&phi[0],MaskGroundediceLevelsetEnum);
+	basalelement->GetInputListOnNodes(&sealevel[0],SealevelEnum);
 
+	/*What is the delta thickness forcing the sea-level rise core: */
+	for(i=0;i<numnodes;i++) deltathickness[i]=newthickness[i]-oldthickness[i];
+
 	/*Find MasstransportHydrostaticAdjustment to figure out how to update the geometry:*/
 	basalelement->FindParam(&hydroadjustment,MasstransportHydrostaticAdjustmentEnum);
 	rho_ice   = basalelement->GetMaterialParameter(MaterialsRhoIceEnum);
 	rho_water = basalelement->GetMaterialParameter(MaterialsRhoSeawaterEnum);
 
 	for(i=0;i<numnodes;i++) {
-		/*If shelf: hydrostatic equilibrium*/
-		if (phi[i]>0.){
-			newsurface[i] = oldbed[i]+newthickness[i]; //surface = oldbed + newthickness
-			newbed[i]     = oldbed[i];                 //same bed: do nothing
+		if (phi[i]>0.){ //this is an ice sheet: just add thickness to base.
+			newsurface[i] = oldbase[i]+newthickness[i]; //surface = oldbase + newthickness
+			newbase[i]     = oldbase[i];                 //same base: do nothing
 		}
-		else{ //this is an ice shelf
+		else{ //this is an ice shelf: hydrostatic equilibrium*/
 			if(hydroadjustment==AbsoluteEnum){
-				newsurface[i] = newthickness[i]*(1-rho_ice/rho_water);
-				newbed[i]     = newthickness[i]*(-rho_ice/rho_water);
+				newsurface[i] = newthickness[i]*(1-rho_ice/rho_water)+sealevel[i];
+				newbase[i]     = newthickness[i]*(-rho_ice/rho_water)+sealevel[i];
 			}
 			else if(hydroadjustment==IncrementalEnum){
-				newsurface[i] = oldsurface[i]+(1.0-rho_ice/rho_water)*(newthickness[i]-oldthickness[i]); //surface = oldsurface + (1-di) * dH
-				newbed[i]     = oldbed[i]-rho_ice/rho_water*(newthickness[i]-oldthickness[i]); //bed               = oldbed + di * dH
+				newsurface[i] = oldsurface[i]+(1.0-rho_ice/rho_water)*(newthickness[i]-oldthickness[i])+sealevel[i]; //surface = oldsurface + (1-di) * dH
+				newbase[i]     = oldbase[i]-rho_ice/rho_water*(newthickness[i]-oldthickness[i])+sealevel[i]; //base               = oldbed + di * dH
 			}
 			else _error_("Hydrostatic adjustment " << hydroadjustment << " (" << EnumToStringx(hydroadjustment) << ") not supported yet");
 		}
@@ -760,28 +717,25 @@
 
 	/*Add input to the element: */
 	element->AddBasalInput(ThicknessEnum,newthickness,P1Enum);
+	element->AddBasalInput(SealevelriseDeltathicknessEnum,deltathickness,P1Enum);
 	element->AddBasalInput(SurfaceEnum,newsurface,P1Enum);
-	element->AddBasalInput(BaseEnum,newbed,P1Enum);
+	element->AddBasalInput(BaseEnum,newbase,P1Enum);
 
 	/*Free ressources:*/
 	xDelete<IssmDouble>(newthickness);
-	xDelete<IssmDouble>(newbed);
+	xDelete<IssmDouble>(newbase);
 	xDelete<IssmDouble>(newsurface);
 	xDelete<IssmDouble>(oldthickness);
-	xDelete<IssmDouble>(oldbed);
+	xDelete<IssmDouble>(deltathickness);
+	xDelete<IssmDouble>(oldbase);
 	xDelete<IssmDouble>(oldsurface);
 	xDelete<IssmDouble>(phi);
+	xDelete<IssmDouble>(sealevel);
 	xDelete<int>(doflist);
 	if(domaintype!=Domain2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
 }/*}}}*/
 void           MasstransportAnalysis::UpdateConstraints(FemModel* femmodel){/*{{{*/
-
-	bool islevelset;
-	femmodel->parameters->FindParam(&islevelset,TransientIslevelsetEnum);
-	if(islevelset){
-		SetActiveNodesLSMx(femmodel);
-	}
-	return;
+	SetActiveNodesLSMx(femmodel);
 }/*}}}*/
 
 /*Flux Correction Transport*/

Modified: issm/trunk/src/c/analyses/MeltingAnalysis.cpp
===================================================================
--- issm/trunk/src/c/analyses/MeltingAnalysis.cpp	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/analyses/MeltingAnalysis.cpp	2016-04-13 04:32:01 UTC (rev 20500)
@@ -57,6 +57,7 @@
 	iomodel->FetchDataToInput(elements,ThicknessEnum);
 	iomodel->FetchDataToInput(elements,SurfaceEnum);
 	iomodel->FetchDataToInput(elements,BaseEnum);
+	iomodel->FetchDataToInput(elements,SealevelEnum,0);
 	iomodel->FetchDataToInput(elements,MaskIceLevelsetEnum);
 	if(iomodel->domaintype!=Domain2DhorizontalEnum){
 		iomodel->FetchDataToInput(elements,MeshVertexonbaseEnum);

Modified: issm/trunk/src/c/analyses/StressbalanceAnalysis.cpp
===================================================================
--- issm/trunk/src/c/analyses/StressbalanceAnalysis.cpp	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/analyses/StressbalanceAnalysis.cpp	2016-04-13 04:32:01 UTC (rev 20500)
@@ -672,11 +672,12 @@
 	/*Intermediaries*/
 	int    materials_type,finiteelement,fe_FS;
 	int    approximation,frictionlaw;
+	int    FrictionCoupling;
 	int*   finiteelement_list=NULL;
 	bool   isSSA,isL1L2,isHO,isFS,iscoupling;
 	bool   control_analysis;
 	bool   dakota_analysis;
-	bool   islevelset;
+	bool   ismovingfront;
 	bool   isdamage;
 
 	/*Fetch constants needed: */
@@ -687,7 +688,7 @@
 	iomodel->Constant(&control_analysis,InversionIscontrolEnum);
 	iomodel->Constant(&dakota_analysis,QmuIsdakotaEnum);
 	iomodel->Constant(&materials_type,MaterialsEnum);
-	iomodel->Constant(&islevelset,TransientIslevelsetEnum);
+	iomodel->Constant(&ismovingfront,TransientIsmovingfrontEnum);
 	iomodel->Constant(&frictionlaw,FrictionLawEnum);
 
 	/*return if no processing required*/
@@ -752,6 +753,7 @@
 	iomodel->FetchDataToInput(elements,ThicknessEnum);
 	iomodel->FetchDataToInput(elements,SurfaceEnum);
 	iomodel->FetchDataToInput(elements,BaseEnum);
+	iomodel->FetchDataToInput(elements,SealevelEnum,0);
 	iomodel->FetchDataToInput(elements,MaskIceLevelsetEnum);
 	iomodel->FetchDataToInput(elements,MaskGroundediceLevelsetEnum);
 	iomodel->FetchDataToInput(elements,MaterialsRheologyBEnum);
@@ -778,9 +780,6 @@
 		iomodel->FetchDataToInput(elements,PressureEnum,0.);
 		iomodel->FetchDataToInput(elements,BasalforcingsFloatingiceMeltingRateEnum,0.);
 	}
-	if(islevelset){
-		iomodel->FetchDataToInput(elements,IceMaskNodeActivationEnum);
-	}
 	/*LATH parameters*/
 	iomodel->Constant(&fe_FS,FlowequationFeFSEnum);
 	if(fe_FS==LATaylorHoodEnum || fe_FS==LACrouzeixRaviartEnum){
@@ -799,10 +798,13 @@
 			iomodel->FetchDataToInput(elements,FrictionMEnum);
 			break;
 		case 3:
+			iomodel->Constant(&FrictionCoupling,FrictionCouplingEnum);
 			iomodel->FetchDataToInput(elements,FrictionCEnum);
 			iomodel->FetchDataToInput(elements,FrictionAsEnum);
 			iomodel->FetchDataToInput(elements,FrictionQEnum);
-			iomodel->FetchDataToInput(elements,FrictionEffectivePressureEnum);
+			if (FrictionCoupling==0){
+				iomodel->FetchDataToInput(elements,FrictionEffectivePressureEnum);
+			}
 			break;
 		case 4:
 			iomodel->FetchDataToInput(elements,FrictionCoefficientEnum);
@@ -823,6 +825,12 @@
 			iomodel->FetchDataToInput(elements,PressureEnum);
 			iomodel->FetchDataToInput(elements,TemperatureEnum);
 			break;
+		case 7:
+			iomodel->FetchDataToInput(elements,FrictionCoefficientEnum);
+			iomodel->FetchDataToInput(elements,FrictionCoefficientcoulombEnum);
+			iomodel->FetchDataToInput(elements,FrictionPEnum);
+			iomodel->FetchDataToInput(elements,FrictionQEnum);
+			break;
 		default:
 			_error_("not supported");
 	}
@@ -871,7 +879,8 @@
 
 	iomodel->Constant(&materials_type,MaterialsEnum);
 	if(materials_type==MatdamageiceEnum){
-		parameters->AddObject(iomodel->CopyConstantObject(DamageC1Enum));
+		parameters->AddObject(iomodel->CopyConstantObject(DamageLawEnum));
+		parameters->AddObject(iomodel->CopyConstantObject(DamageKappaEnum));
 		parameters->AddObject(iomodel->CopyConstantObject(DamageStressThresholdEnum));
 	}
 
@@ -885,6 +894,8 @@
 	int frictionlaw;
 	iomodel->Constant(&frictionlaw,FrictionLawEnum);
 	if(frictionlaw==4 || frictionlaw==6) parameters->AddObject(iomodel->CopyConstantObject(FrictionGammaEnum));
+	if(frictionlaw==3) parameters->AddObject(iomodel->CopyConstantObject(FrictionCouplingEnum));
+	if(frictionlaw==5) parameters->AddObject(iomodel->CopyConstantObject(FrictionFEnum));
 
 }/*}}}*/
 
@@ -1133,13 +1144,7 @@
 	}
 }/*}}}*/
 void           StressbalanceAnalysis::UpdateConstraints(FemModel* femmodel){/*{{{*/
-	/*Default, do nothing*/
-	bool islevelset;
-	femmodel->parameters->FindParam(&islevelset,TransientIslevelsetEnum);
-	if(islevelset){
-		SetActiveNodesLSMx(femmodel);
-	}
-	return;
+	SetActiveNodesLSMx(femmodel);
 }/*}}}*/
 
 /*SSA*/
@@ -1595,7 +1600,7 @@
 
 	/*Intermediaries*/
 	int         dim,domaintype;
-	IssmDouble  Jdet,thickness,bed,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;
 	IssmDouble *xyz_list_front = NULL;
@@ -1620,6 +1625,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);
 	IssmDouble rho_water   = element->GetMaterialParameter(MaterialsRhoSeawaterEnum);
 	IssmDouble rho_ice     = element->GetMaterialParameter(MaterialsRhoIceEnum);
 	IssmDouble gravity     = element->GetMaterialParameter(ConstantsGEnum);
@@ -1633,12 +1639,13 @@
 
 		gauss->GaussPoint(ig);
 		thickness_input->GetInputValue(&thickness,gauss);
-		base_input->GetInputValue(&bed,gauss);
+		sealevel_input->GetInputValue(&sealevel,gauss);
+		base_input->GetInputValue(&base,gauss);
 		element->JacobianDeterminantSurface(&Jdet,xyz_list_front,gauss);
 		element->NodalFunctions(basis,gauss);
 
-		surface_under_water = min(0.,thickness+bed); // 0 if the top of the glacier is above water level
-		base_under_water    = min(0.,bed);           // 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;
 		pressure = ice_pressure + water_pressure;
@@ -1893,6 +1900,9 @@
 /*L1L2*/
 ElementMatrix* StressbalanceAnalysis::CreateKMatrixL1L2(Element* element){/*{{{*/
 
+	/* Check if ice in element */
+	if(!element->IsIceInElement()) return NULL;
+
 	/*compute all stiffness matrices for this element*/
 	ElementMatrix* Ke1=CreateKMatrixL1L2Viscous(element);
 	ElementMatrix* Ke2=CreateKMatrixL1L2Friction(element);
@@ -1975,6 +1985,9 @@
 }/*}}}*/
 ElementVector* StressbalanceAnalysis::CreatePVectorL1L2(Element* element){/*{{{*/
 
+	/* Check if ice in element */
+	if(!element->IsIceInElement()) return NULL;
+
 	/*Intermediaries*/
 	int      domaintype;
 	Element* basalelement;
@@ -2055,7 +2068,7 @@
 	if(!element->IsIcefront()) return NULL;
 
 	/*Intermediaries*/
-	IssmDouble  Jdet,thickness,bed,water_pressure,ice_pressure;
+	IssmDouble  Jdet,thickness,bed,sealevel,water_pressure,ice_pressure;
 	IssmDouble  surface_under_water,base_under_water,pressure;
 	IssmDouble *xyz_list = NULL;
 	IssmDouble *xyz_list_front = NULL;
@@ -2071,6 +2084,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);
 	IssmDouble rho_water   = element->GetMaterialParameter(MaterialsRhoSeawaterEnum);
 	IssmDouble rho_ice     = element->GetMaterialParameter(MaterialsRhoIceEnum);
 	IssmDouble gravity     = element->GetMaterialParameter(ConstantsGEnum);
@@ -2085,11 +2099,12 @@
 		gauss->GaussPoint(ig);
 		thickness_input->GetInputValue(&thickness,gauss);
 		base_input->GetInputValue(&bed,gauss);
+		sealevel_input->GetInputValue(&sealevel,gauss);
 		element->JacobianDeterminantSurface(&Jdet,xyz_list_front,gauss);
 		element->NodalFunctions(basis,gauss);
 
-		surface_under_water = min(0.,thickness+bed); // 0 if the top of the glacier is above water level
-		base_under_water    = min(0.,bed);           // 0 if the bottom of the glacier is above water level
+		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;
 		pressure = ice_pressure + water_pressure;
@@ -2326,8 +2341,7 @@
 	if(migration_style==SubelementMigration2Enum){
 		gllevelset_input=element->GetInput(MaskGroundediceLevelsetEnum); _assert_(gllevelset_input);
 		element->GetGroundedPart(&point1,&fraction1,&fraction2,&mainlyfloating);
-		//gauss = element->NewGauss(point1,fraction1,fraction2,mainlyfloating,2);
-		gauss=element->NewGaussBase(2);
+		gauss = element->NewGauss(point1,fraction1,fraction2,mainlyfloating,2);
 	}
 	else{
 		gauss=element->NewGaussBase(2);
@@ -2569,7 +2583,7 @@
 
 	/*Intermediaries*/
 	int         dim;
-	IssmDouble  Jdet,surface,z,water_pressure,ice_pressure;
+	IssmDouble  Jdet,surface,sealevel,z,water_pressure,ice_pressure;
 	IssmDouble  surface_under_water,base_under_water,pressure;
 	IssmDouble* xyz_list       = NULL;
 	IssmDouble* xyz_list_front = NULL;
@@ -2589,6 +2603,7 @@
 
 	/*Retrieve all inputs and parameters*/
 	Input* surface_input = element->GetInput(SurfaceEnum); _assert_(surface_input);
+	Input* sealevel_input       = element->GetInput(SealevelEnum);       _assert_(sealevel_input);
 	IssmDouble rho_water = element->GetMaterialParameter(MaterialsRhoSeawaterEnum);
 	IssmDouble rho_ice   = element->GetMaterialParameter(MaterialsRhoIceEnum);
 	IssmDouble gravity   = element->GetMaterialParameter(ConstantsGEnum);
@@ -2607,12 +2622,13 @@
 
 		gauss->GaussPoint(ig);
 		surface_input->GetInputValue(&surface,gauss);
+		sealevel_input->GetInputValue(&sealevel,gauss);
 		if(dim==3) z=element->GetZcoord(xyz_list,gauss);
 		else       z=element->GetYcoord(xyz_list,gauss);
 		element->NodalFunctions(basis,gauss);
 		element->JacobianDeterminantSurface(&Jdet,xyz_list_front,gauss);
 
-		water_pressure = rho_water*gravity*min(0.,z);//0 if the gaussian point is above water level
+		water_pressure = rho_water*gravity*min(0.,z-sealevel);//0 if the gaussian point is above water level
 		ice_pressure   = rho_ice*gravity*(surface-z);
 		pressure       = ice_pressure + water_pressure;
 
@@ -2958,6 +2974,9 @@
 }/*}}}*/
 ElementMatrix* StressbalanceAnalysis::CreateKMatrixFS(Element* element){/*{{{*/
 
+	/* Check if ice in element */
+	if(!element->IsIceInElement()) return NULL;
+
 	/*Get type of algorithm*/
 	int fe_FS;
 	element->FindParam(&fe_FS,FlowequationFeFSEnum);
@@ -3390,6 +3409,9 @@
 }/*}}}*/
 ElementVector* StressbalanceAnalysis::CreatePVectorFS(Element* element){/*{{{*/
 
+	/* Check if ice in element */
+	if(!element->IsIceInElement()) return NULL;
+
 	ElementVector* pe = NULL;
 
 	ElementVector* pe1=CreatePVectorFSViscous(element);
@@ -3675,8 +3697,10 @@
 }/*}}}*/
 ElementVector* StressbalanceAnalysis::CreatePVectorFS(Element* element){/*{{{*/
 
+	/* Check if ice in element */
+	if(!element->IsIceInElement()) return NULL;
+
 	ElementVector* pe = NULL;
-
 	int fe_FS;
 	element->FindParam(&fe_FS,FlowequationFeFSEnum);
 
@@ -3796,7 +3820,7 @@
 
 	/*Intermediaries*/
 	int         i,dim;
-	IssmDouble  Jdet,pressure,surface,z;
+	IssmDouble  Jdet,pressure,surface,sealevel,z;
 	IssmDouble	normal[3];
 	IssmDouble *xyz_list       = NULL;
 	IssmDouble *xyz_list_front = NULL;
@@ -3828,6 +3852,7 @@
 	element->GetIcefrontCoordinates(&xyz_list_front,xyz_list,MaskIceLevelsetEnum);
 	element->NormalSection(&normal[0],xyz_list_front);
 	Input* surface_input  = element->GetInput(SurfaceEnum); _assert_(surface_input);
+	Input* sealevel_input       = element->GetInput(SealevelEnum);       _assert_(sealevel_input);
 	IssmDouble  rho_water = element->GetMaterialParameter(MaterialsRhoSeawaterEnum);
 	IssmDouble  gravity   = element->GetMaterialParameter(ConstantsGEnum);
 
@@ -3844,9 +3869,10 @@
 		element->JacobianDeterminantSurface(&Jdet,xyz_list_front,gauss);
 		element->NodalFunctionsVelocity(vbasis,gauss);
 		surface_input->GetInputValue(&surface,gauss);
+		sealevel_input->GetInputValue(&sealevel,gauss);
 		if(dim==3) z=element->GetZcoord(xyz_list,gauss);
 		else       z=element->GetYcoord(xyz_list,gauss);
-		pressure = rho_water*gravity*min(0.,z);//0 if the gaussian point is above water level
+		pressure = rho_water*gravity*min(0.,z-sealevel);//0 if the gaussian point is above water level
 
 		for (int i=0;i<vnumnodes;i++){
 			pe->values[dim*i+0]+= pressure*Jdet*gauss->weight*normal[0]*vbasis[i];

Modified: issm/trunk/src/c/analyses/StressbalanceSIAAnalysis.cpp
===================================================================
--- issm/trunk/src/c/analyses/StressbalanceSIAAnalysis.cpp	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/analyses/StressbalanceSIAAnalysis.cpp	2016-04-13 04:32:01 UTC (rev 20500)
@@ -8,46 +8,60 @@
 /*Model processing*/
 void StressbalanceSIAAnalysis::CreateConstraints(Constraints* constraints,IoModel* iomodel){/*{{{*/
 
-	/*Intermediary*/
-	int        count;
-	IssmDouble yts;
-	bool       isSIA;
+	/*Intermediaries*/
+	bool       isSIA,isSSA,isL1L2,isHO,isFS,iscoupling;
 
 	/*Fetch parameters: */
-	iomodel->Constant(&yts,ConstantsYtsEnum);
 	iomodel->Constant(&isSIA,FlowequationIsSIAEnum);
+	iomodel->Constant(&isSSA,FlowequationIsSSAEnum);
+	iomodel->Constant(&isL1L2,FlowequationIsL1L2Enum);
+	iomodel->Constant(&isHO,FlowequationIsHOEnum);
+	iomodel->Constant(&isFS,FlowequationIsFSEnum);
 
 	/*Now, is the flag isSIA on? otherwise, do nothing: */
 	if (!isSIA) return;
 
-	/*Fetch data: */
-	iomodel->FetchData(3,StressbalanceSpcvxEnum,StressbalanceSpcvyEnum,FlowequationVertexEquationEnum);
+	/*Do we have coupling*/
+	if((isSIA?1.:0.) + (isSSA?1.:0.) + (isL1L2?1.:0.) + (isHO?1.:0.) + (isFS?1.:0.) >1.)
+	 iscoupling = true;
+	else
+	 iscoupling = false;
 
-	/*Initialize conunter*/
-	count=0;
+	/*If no coupling, call Regular IoModelToConstraintsx, else, OLD stuff, keep for now*/
+	if(!iscoupling){
+		IoModelToConstraintsx(constraints,iomodel,StressbalanceSpcvxEnum,StressbalanceSIAAnalysisEnum,P1Enum,0);
+		IoModelToConstraintsx(constraints,iomodel,StressbalanceSpcvyEnum,StressbalanceSIAAnalysisEnum,P1Enum,1);
+	}
+	else{
+		/*Fetch data: */
+		iomodel->FetchData(3,StressbalanceSpcvxEnum,StressbalanceSpcvyEnum,FlowequationVertexEquationEnum);
 
-	/*vx and vy are spc'd if we are not on nodeonSIA: */
-	for(int i=0;i<iomodel->numberofvertices;i++){
-		/*keep only this partition's nodes:*/
-		if((iomodel->my_vertices[i])){
-			if (reCast<int,IssmDouble>(iomodel->Data(FlowequationVertexEquationEnum)[i])!=SIAApproximationEnum){
+		/*Initialize conunter*/
+		int count=0;
 
-				constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,0,0,StressbalanceSIAAnalysisEnum));
-				count++;
+		/*vx and vy are spc'd if we are not on nodeonSIA: */
+		for(int i=0;i<iomodel->numberofvertices;i++){
+			/*keep only this partition's nodes:*/
+			if((iomodel->my_vertices[i])){
+				if (reCast<int,IssmDouble>(iomodel->Data(FlowequationVertexEquationEnum)[i])!=SIAApproximationEnum){
 
-				constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,1,0,StressbalanceSIAAnalysisEnum));
-				count++;
-			}
-			else{
-				if (!xIsNan<IssmDouble>(iomodel->Data(StressbalanceSpcvxEnum)[i])){
-					constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,0,iomodel->Data(StressbalanceSpcvxEnum)[i]/yts,StressbalanceSIAAnalysisEnum)); //add count'th spc, on node i+1, setting dof 1 to vx.
+					constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,0,0,StressbalanceSIAAnalysisEnum));
 					count++;
-				}
 
-				if (!xIsNan<IssmDouble>(iomodel->Data(StressbalanceSpcvyEnum)[i])){
-					constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,1,iomodel->Data(StressbalanceSpcvyEnum)[i]/yts,StressbalanceSIAAnalysisEnum)); //add count'th spc, on node i+1, setting dof 2 to vy
+					constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,1,0,StressbalanceSIAAnalysisEnum));
 					count++;
 				}
+				else{
+					if (!xIsNan<IssmDouble>(iomodel->Data(StressbalanceSpcvxEnum)[i])){
+						constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,0,iomodel->Data(StressbalanceSpcvxEnum)[i],StressbalanceSIAAnalysisEnum)); //add count'th spc, on node i+1, setting dof 1 to vx.
+						count++;
+					}
+
+					if (!xIsNan<IssmDouble>(iomodel->Data(StressbalanceSpcvyEnum)[i])){
+						constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,1,iomodel->Data(StressbalanceSpcvyEnum)[i],StressbalanceSIAAnalysisEnum)); //add count'th spc, on node i+1, setting dof 2 to vy
+						count++;
+					}
+				}
 			}
 		}
 	}
@@ -107,9 +121,11 @@
 
 	/*Fetch data needed: */
 	bool   isSIA;
-	bool   islevelset;
+	bool   ismovingfront;
+	int    frictionlaw;
 	iomodel->Constant(&isSIA,FlowequationIsSIAEnum);
-	iomodel->Constant(&islevelset,TransientIslevelsetEnum);
+	iomodel->Constant(&ismovingfront,TransientIsmovingfrontEnum);
+	iomodel->Constant(&frictionlaw,FrictionLawEnum);
 
 	/*Now, is the flag SIA on? otherwise, do nothing: */
 	if (!isSIA)return;
@@ -126,11 +142,30 @@
 		}
 	}
 
+	/*Friction law variables*/
+	switch(frictionlaw){
+		case 1:
+			iomodel->FetchDataToInput(elements,FrictionCoefficientEnum);
+			iomodel->FetchDataToInput(elements,FrictionPEnum);
+			iomodel->FetchDataToInput(elements,FrictionQEnum);
+			break;
+		case 2:
+			iomodel->FetchDataToInput(elements,FrictionCEnum);
+			iomodel->FetchDataToInput(elements,FrictionMEnum);
+			break;
+		case 6:
+			iomodel->FetchDataToInput(elements,FrictionCEnum);
+			iomodel->FetchDataToInput(elements,FrictionMEnum);
+			iomodel->FetchDataToInput(elements,PressureEnum);
+			iomodel->FetchDataToInput(elements,TemperatureEnum);
+			break;
+		default:
+			_error_("not supported");
+	}
+
 	iomodel->FetchDataToInput(elements,ThicknessEnum);
-	iomodel->FetchDataToInput(elements,FrictionCoefficientEnum);
 	iomodel->FetchDataToInput(elements,MaskGroundediceLevelsetEnum);
-	if(islevelset){
-		iomodel->FetchDataToInput(elements,IceMaskNodeActivationEnum);
+	if(ismovingfront){
 		if(iomodel->domaintype!=Domain2DhorizontalEnum)
 			iomodel->FetchDataToInput(elements,MeshVertexonbaseEnum); // required for updating active nodes
 	}
@@ -301,7 +336,10 @@
 	Input* slopey_input    = element->GetInput(SurfaceSlopeYEnum);        _assert_(slopey_input);
 	Input* thickness_input = element->GetInput(ThicknessEnum);            _assert_(thickness_input);
 	Input* surface_input   = element->GetInput(SurfaceEnum);              _assert_(surface_input);
-	Input* drag_input      = element->GetInput(FrictionCoefficientEnum);  _assert_(drag_input);
+	Input* drag_input      = NULL;
+	if(frictionlaw!=5 && frictionlaw!=1){
+		drag_input = element->GetInput(FrictionCoefficientEnum);  _assert_(drag_input);
+	}
 
 	Gauss* gauss=element->NewGauss();
 	for(int iv=0;iv<numvertices;iv++){
@@ -311,7 +349,6 @@
 
 		thickness_input->GetInputValue(&thickness,gauss);
 		surface_input->GetInputValue(&surface,gauss);
-		drag_input->GetInputValue(&drag,gauss);
 		slopex_input->GetInputValue(&slope[0],gauss);
 		slopey_input->GetInputValue(&slope[1],gauss);
 		slope2=slope[0]*slope[0]+slope[1]*slope[1];
@@ -324,11 +361,13 @@
 				break;
 			case 2:
 				/*Ritz et al. 1996*/
+				drag_input->GetInputValue(&drag,gauss);
 				ub=drag*(rho_ice*gravity*thickness)*(rho_ice*gravity*thickness)*slope[0]/sqrt(slope2);
 				vb=drag*(rho_ice*gravity*thickness)*(rho_ice*gravity*thickness)*slope[1]/sqrt(slope2);
 				break;
 			case 3:
 				/*Rutt et al. 2009*/
+				drag_input->GetInputValue(&drag,gauss);
 				ub=-drag*rho_ice*gravity*thickness*slope[0];
 				vb=-drag*rho_ice*gravity*thickness*slope[1];
 				break;
@@ -342,8 +381,8 @@
 				_error_("Not supported yet");
 		}
 
-		pe->values[2*iv+0]=(ub-2.*pow(rho_ice*gravity,n)*pow(slope2,((n-1.)/2.))*pow(thickness,n)/(pow(B,n)*(n+1))*slope[0])/connectivity;
-		pe->values[2*iv+1]=(vb-2.*pow(rho_ice*gravity,n)*pow(slope2,((n-1.)/2.))*pow(thickness,n)/(pow(B,n)*(n+1))*slope[1])/connectivity;
+		pe->values[2*iv+0]=(ub-2.*pow(rho_ice*gravity,n)*pow(slope2,((n-1.)/2.))*pow(thickness,n+1.)/(pow(B,n)*(n+2))*slope[0])/connectivity;
+		pe->values[2*iv+1]=(vb-2.*pow(rho_ice*gravity,n)*pow(slope2,((n-1.)/2.))*pow(thickness,n+1.)/(pow(B,n)*(n+2))*slope[1])/connectivity;
 	}
 
 	/*Clean up and return*/
@@ -379,7 +418,14 @@
 	Input* slopex_input    = element->GetInput(SurfaceSlopeXEnum);        _assert_(slopex_input);
 	Input* slopey_input    = element->GetInput(SurfaceSlopeYEnum);        _assert_(slopey_input);
 	Input* thickness_input = element->GetInput(ThicknessEnum);            _assert_(thickness_input);
-	Input* drag_input      = element->GetInput(FrictionCoefficientEnum);  _assert_(drag_input);
+	Input* drag_input      = NULL;
+	Friction* friction     = NULL;
+	if(frictionlaw!=5 && frictionlaw!=1){
+		drag_input = element->GetInput(FrictionCoefficientEnum);  _assert_(drag_input);
+	}
+	else if(frictionlaw==5){
+		friction=new Friction(element,3);
+	}
 
 	/*Get Vertical segment indices*/
 	element->VerticalSegmentIndices(&pairindices,&numsegments);
@@ -420,8 +466,6 @@
 
 		/*Deal with basal velocities*/
 		if(element->IsOnBase()){
-			drag_input->GetInputValue(&drag,gauss);
-
 			switch(frictionlaw){
 				case 1:
 					/*Payne 1995 (m = 1, B = 5e-3/yts = 1.58e-10  m/s/Pa*/
@@ -430,20 +474,29 @@
 					break;
 				case 2:
 					/*Ritz et al. 1996*/
+					drag_input->GetInputValue(&drag,gauss);
 					ub=drag*(rho_ice*gravity*thickness)*(rho_ice*gravity*thickness)*slope[0]/sqrt(slope2);
 					vb=drag*(rho_ice*gravity*thickness)*(rho_ice*gravity*thickness)*slope[1]/sqrt(slope2);
 					break;
 				case 3:
 					/*Rutt et al. 2009*/
+					drag_input->GetInputValue(&drag,gauss);
 					ub=-drag*rho_ice*gravity*thickness*slope[0];
 					vb=-drag*rho_ice*gravity*thickness*slope[1];
 					break;
 				case 4:
 					/*Henning Akesson*/
+					drag_input->GetInputValue(&drag,gauss);
 					drag = -4e-15 * surface + 8.6e-12;
 					ub=-drag*rho_ice*gravity*thickness*slope[0];
 					vb=-drag*rho_ice*gravity*thickness*slope[1];
 					break;
+				case 5: /*Weertman temp for Kevin*/{
+					friction->GetAlpha2WeertmanTemp(&drag,gauss);
+					ub = -1./drag * rho_ice*gravity*thickness*slope[0];
+					vb = -1./drag * rho_ice*gravity*thickness*slope[1];
+					}
+					break;
 				default:
 					_error_("Not supported yet");
 			}
@@ -457,6 +510,7 @@
 	/*Clean up and return*/
 	xDelete<int>(pairindices);
 	xDelete<IssmDouble>(xyz_list);
+	if(frictionlaw==5) delete friction;
 	return pe;
 
 }/*}}}*/
@@ -581,11 +635,5 @@
 	xDelete<int>(doflist);
 }/*}}}*/
 void           StressbalanceSIAAnalysis::UpdateConstraints(FemModel* femmodel){/*{{{*/
-
-	bool islevelset;
-	femmodel->parameters->FindParam(&islevelset,TransientIslevelsetEnum);
-	if(islevelset){
-		SetActiveNodesLSMx(femmodel);
-	}
-	return;
+	SetActiveNodesLSMx(femmodel);
 }/*}}}*/

Modified: issm/trunk/src/c/analyses/StressbalanceVerticalAnalysis.cpp
===================================================================
--- issm/trunk/src/c/analyses/StressbalanceVerticalAnalysis.cpp	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/analyses/StressbalanceVerticalAnalysis.cpp	2016-04-13 04:32:01 UTC (rev 20500)
@@ -9,43 +9,65 @@
 void StressbalanceVerticalAnalysis::CreateConstraints(Constraints* constraints,IoModel* iomodel){/*{{{*/
 
 	/*Intermediary*/
-	int count;
-	IssmDouble yts;
+	bool        isSIA,isSSA,isL1L2,isHO,isFS,iscoupling;
+	int         Mz,Nz;
+	IssmDouble *spcvz = NULL;
 
-	/*Fetch parameters: */
-	iomodel->Constant(&yts,ConstantsYtsEnum);
-
 	/*return if not 3d mesh*/
 	if(iomodel->domaintype!=Domain3DEnum) return;
 
-	/*Fetch data: */
-	iomodel->FetchData(2,StressbalanceSpcvzEnum,FlowequationBorderFSEnum);
+	/*Fetch parameters: */
+	iomodel->Constant(&isSIA,FlowequationIsSIAEnum);
+	iomodel->Constant(&isSSA,FlowequationIsSSAEnum);
+	iomodel->Constant(&isL1L2,FlowequationIsL1L2Enum);
+	iomodel->Constant(&isHO,FlowequationIsHOEnum);
+	iomodel->Constant(&isFS,FlowequationIsFSEnum);
 
-	/*Initialize counter*/
-	count=0;
+	/*Do we have coupling*/
+	if((isSIA?1.:0.) + (isSSA?1.:0.) + (isL1L2?1.:0.) + (isHO?1.:0.) + (isFS?1.:0.) >1.)
+	 iscoupling = true;
+	else
+	 iscoupling = false;
 
-	/*Create spcs from x,y,z, as well as the spc values on those spcs: */
-	for(int i=0;i<iomodel->numberofvertices;i++){
 
-		/*keep only this partition's nodes:*/
-		if(iomodel->my_vertices[i]){
+	/*If no coupling, call Regular IoModelToConstraintsx, else, use P1 elements only*/
+	if(!iscoupling){
+		IoModelToConstraintsx(constraints,iomodel,StressbalanceSpcvzEnum,StressbalanceVerticalAnalysisEnum,P1Enum,0);
+	}
+	else{
+		/*Fetch data: */
+		iomodel->FetchData(1,FlowequationBorderFSEnum);
+		/*Fetch Spc*/
+		iomodel->FetchData(&spcvz,&Mz,&Nz,StressbalanceSpcvzEnum);
+		if(Nz>1) _error_("not supported yet (needs to be coded)");
 
-			if (reCast<int,IssmDouble>(iomodel->Data(FlowequationBorderFSEnum)[i])){
-				constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,0,0,StressbalanceVerticalAnalysisEnum)); //spc to zero as vertical velocity is done in Horiz for FS
-				count++;
-			}
-			else if (!xIsNan<IssmDouble>(iomodel->Data(StressbalanceSpcvzEnum)[i])){
-				constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,0,
-								iomodel->Data(StressbalanceSpcvzEnum)[i],StressbalanceVerticalAnalysisEnum)); //add count'th spc, on node i+1, setting dof 1 to vx.
-				count++;
+		/*Initialize counter*/
+		int count=0;
 
-			}
-		} 
+		/*Create spcs from x,y,z, as well as the spc values on those spcs: */
+		for(int i=0;i<iomodel->numberofvertices;i++){
+
+			/*keep only this partition's nodes:*/
+			if(iomodel->my_vertices[i]){
+
+				if (reCast<int,IssmDouble>(iomodel->Data(FlowequationBorderFSEnum)[i])){
+					constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,0,0,StressbalanceVerticalAnalysisEnum)); //spc to zero as vertical velocity is done in Horiz for FS
+					count++;
+				}
+				else if (!xIsNan<IssmDouble>(spcvz[i])){
+					constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,0,
+									spcvz[i],StressbalanceVerticalAnalysisEnum)); //add count'th spc, on node i+1, setting dof 1 to vx.
+					count++;
+
+				}
+			} 
+		}
+
+		/*Free data: */
+		iomodel->DeleteData(1,FlowequationBorderFSEnum);
+		iomodel->DeleteData(spcvz,StressbalanceSpcvzEnum);
 	}
 
-	/*Free data: */
-	iomodel->DeleteData(2,StressbalanceSpcvzEnum,FlowequationBorderFSEnum);
-
 }/*}}}*/
 void StressbalanceVerticalAnalysis::CreateLoads(Loads* loads, IoModel* iomodel){/*{{{*/
 
@@ -82,6 +104,7 @@
 	iomodel->FetchDataToInput(elements,ThicknessEnum);
 	iomodel->FetchDataToInput(elements,SurfaceEnum);
 	iomodel->FetchDataToInput(elements,BaseEnum);
+	iomodel->FetchDataToInput(elements,SealevelEnum,0);
 	iomodel->FetchDataToInput(elements,MaskIceLevelsetEnum);
 	if(iomodel->domaintype!=Domain2DhorizontalEnum){
 		iomodel->FetchDataToInput(elements,MeshVertexonbaseEnum);
@@ -89,6 +112,7 @@
 	}
 	iomodel->FetchDataToInput(elements,BasalforcingsGroundediceMeltingRateEnum);
 	iomodel->FetchDataToInput(elements,BasalforcingsFloatingiceMeltingRateEnum);
+	//iomodel->FetchDataToInput(elements,SmbMassBalanceEnum);
 	iomodel->FetchDataToInput(elements,VxEnum,0.);
 	iomodel->FetchDataToInput(elements,VyEnum,0.);
 }/*}}}*/
@@ -114,9 +138,13 @@
 }/*}}}*/
 ElementMatrix* StressbalanceVerticalAnalysis::CreateKMatrix(Element* element){/*{{{*/
 
+	bool hack = false;
+
 	/*compute all stiffness matrices for this element*/
 	ElementMatrix* Ke1=CreateKMatrixVolume(element);
-	ElementMatrix* Ke2=CreateKMatrixSurface(element);
+	ElementMatrix* Ke2=NULL;
+	if(hack) Ke2=CreateKMatrixBase(element);
+	else Ke2=CreateKMatrixSurface(element);
 	ElementMatrix* Ke =new ElementMatrix(Ke1,Ke2);
 
 	/*clean-up and return*/
@@ -125,6 +153,47 @@
 	return Ke;
 
 }/*}}}*/
+ElementMatrix* StressbalanceVerticalAnalysis::CreateKMatrixBase(Element* element){/*{{{*/
+
+
+	if(!element->IsOnBase()) return NULL;
+
+	/*Intermediaries*/
+	IssmDouble  D,Jdet,normal[3];
+	IssmDouble *xyz_list = NULL;
+
+	/*Fetch number of nodes and dof for this finite element*/
+	int numnodes = element->GetNumberOfNodes();
+
+	/*Initialize Element matrix and vectors*/
+	ElementMatrix* Ke    = element->NewElementMatrix(NoneApproximationEnum);
+	IssmDouble*    basis = xNew<IssmDouble>(numnodes);
+
+	/*Retrieve all inputs and parameters*/
+	element->GetVerticesCoordinatesBase(&xyz_list);
+
+	/* Start  looping on the number of gaussian points: */
+	Gauss* gauss = element->NewGaussBase(2);
+	element->NormalBase(&normal[0],xyz_list);
+	for(int ig=gauss->begin();ig<gauss->end();ig++){
+		gauss->GaussPoint(ig);
+
+		element->JacobianDeterminantBase(&Jdet,xyz_list,gauss);
+		element->NodalFunctions(basis,gauss);
+		D = -gauss->weight*Jdet*normal[2];
+
+		TripleMultiply( basis,1,numnodes,1,
+					&D,1,1,0,
+					basis,1,numnodes,0,
+					&Ke->values[0],1);
+	}
+
+	/*Clean up and return*/
+	delete gauss;
+	xDelete<IssmDouble>(xyz_list);
+	xDelete<IssmDouble>(basis);
+	return Ke;
+}/*}}}*/
 ElementMatrix* StressbalanceVerticalAnalysis::CreateKMatrixSurface(Element* element){/*{{{*/
 
 
@@ -209,9 +278,13 @@
 }/*}}}*/
 ElementVector* StressbalanceVerticalAnalysis::CreatePVector(Element* element){/*{{{*/
 
+	bool hack = false;
+
 	/*compute all load vectors for this element*/
 	ElementVector* pe1=CreatePVectorVolume(element);
-	ElementVector* pe2=CreatePVectorBase(element);
+	ElementVector* pe2=NULL;
+	if(hack) pe2=CreatePVectorSurface(element);
+	else     pe2=CreatePVectorBase(element);
 	ElementVector* pe =new ElementVector(pe1,pe2);
 
 	/*clean-up and return*/
@@ -285,6 +358,66 @@
 	xDelete<IssmDouble>(xyz_list_base);
 	return pe;
 }/*}}}*/
+ElementVector* StressbalanceVerticalAnalysis::CreatePVectorSurface(Element* element){/*{{{*/
+
+	/*Intermediaries */
+	int         approximation;
+	IssmDouble *xyz_list      = NULL;
+	IssmDouble *xyz_list_surface= NULL;
+	IssmDouble  Jdet,slope[3];
+	IssmDouble  vx,vy,vz=0.,dsdx,dsdy;
+	IssmDouble  smb,smbvalue;
+
+	if(!element->IsOnSurface()) return NULL;
+
+	/*Fetch number of nodes for this finite element*/
+	int numnodes = element->GetNumberOfNodes();
+
+	/*Initialize Element vector*/
+	ElementVector* pe    = element->NewElementVector();
+	IssmDouble*    basis = xNew<IssmDouble>(numnodes);
+
+	/*Retrieve all inputs and parameters*/
+	element->GetVerticesCoordinates(&xyz_list);
+	element->GetVerticesCoordinatesTop(&xyz_list_surface);
+	element->GetInputValue(&approximation,ApproximationEnum);
+	Input* surface_input    =element->GetInput(SurfaceEnum);               _assert_(surface_input);
+	Input* smb_input=element->GetInput(SmbMassBalanceEnum);    _assert_(smb_input);
+	Input* vx_input=element->GetInput(VxEnum);                             _assert_(vx_input);
+	Input* vy_input=element->GetInput(VyEnum);                             _assert_(vy_input);
+	Input* vzFS_input=NULL;
+	if(approximation==HOFSApproximationEnum || approximation==SSAFSApproximationEnum){
+		vzFS_input=element->GetInput(VzFSEnum);       _assert_(vzFS_input);
+	}
+
+	/* Start  looping on the number of gaussian points: */
+	Gauss* gauss=element->NewGaussTop(2);
+	for(int ig=gauss->begin();ig<gauss->end();ig++){
+		gauss->GaussPoint(ig);
+
+		smb_input->GetInputValue(&smb,gauss);
+		surface_input->GetInputDerivativeValue(&slope[0],xyz_list,gauss);
+		vx_input->GetInputValue(&vx,gauss);
+		vy_input->GetInputValue(&vy,gauss);
+		if(approximation==HOFSApproximationEnum || approximation==SSAFSApproximationEnum){
+			vzFS_input->GetInputValue(&vz,gauss);
+		}
+		dsdx=slope[0];
+		dsdy=slope[1];
+
+		element->JacobianDeterminantTop(&Jdet,xyz_list_surface,gauss);
+		element->NodalFunctions(basis,gauss);
+
+		for(int i=0;i<numnodes;i++) pe->values[i]+=-Jdet*gauss->weight*(vx*dsdx+vy*dsdy-vz+smb)*basis[i];
+	}
+
+	/*Clean up and return*/
+	delete gauss;
+	xDelete<IssmDouble>(basis);
+	xDelete<IssmDouble>(xyz_list);
+	xDelete<IssmDouble>(xyz_list_surface);
+	return pe;
+}/*}}}*/
 ElementVector* StressbalanceVerticalAnalysis::CreatePVectorVolume(Element* element){/*{{{*/
 
 	/*Intermediaries*/

Modified: issm/trunk/src/c/analyses/StressbalanceVerticalAnalysis.h
===================================================================
--- issm/trunk/src/c/analyses/StressbalanceVerticalAnalysis.h	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/analyses/StressbalanceVerticalAnalysis.h	2016-04-13 04:32:01 UTC (rev 20500)
@@ -24,10 +24,12 @@
 		ElementVector* CreateDVector(Element* element);
 		ElementMatrix* CreateJacobianMatrix(Element* element);
 		ElementMatrix* CreateKMatrix(Element* element);
+		ElementMatrix* CreateKMatrixBase(Element* element);
 		ElementMatrix* CreateKMatrixSurface(Element* element);
 		ElementMatrix* CreateKMatrixVolume(Element* element);
 		ElementVector* CreatePVector(Element* element);
 		ElementVector* CreatePVectorBase(Element* element);
+		ElementVector* CreatePVectorSurface(Element* element);
 		ElementVector* CreatePVectorVolume(Element* element);
 		void           GetB(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss);
 		void           GetBprime(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss);

Modified: issm/trunk/src/c/analyses/ThermalAnalysis.cpp
===================================================================
--- issm/trunk/src/c/analyses/ThermalAnalysis.cpp	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/analyses/ThermalAnalysis.cpp	2016-04-13 04:32:01 UTC (rev 20500)
@@ -7,9 +7,34 @@
 /*Model processing*/
 void ThermalAnalysis::CreateConstraints(Constraints* constraints,IoModel* iomodel){/*{{{*/
 
+	/*Intermediary*/
+	int finiteelement = P1Enum;
+
 	/*Only 3d mesh supported*/
-	int finiteelement = P1Enum;
-	if(iomodel->domaintype==Domain3DEnum){
+	if(iomodel->domaintype!=Domain3DEnum) _error_("not supported yet");
+
+	/*Specific case for PDD, we want the constaints to be updated by the PDD scheme itself*/
+	bool isdynamic = false;
+	if(iomodel->solution_enum==ThermalSolutionEnum){
+		/*No PDD scheme, keep default*/
+	}
+	else if(iomodel->solution_enum==SteadystateSolutionEnum){
+		/*No PDD scheme, keep default*/
+	}
+	else if (iomodel->solution_enum==TransientSolutionEnum){
+		int smb_model;
+		iomodel->Constant(&smb_model,SmbEnum);
+		if(smb_model==SMBpddEnum) isdynamic=true;
+		if(smb_model==SMBd18opddEnum) isdynamic=true;
+	}
+	else{
+		_error_("Solution "<<EnumToStringx(iomodel->solution_enum)<<" not supported yet");
+	}
+
+	if(isdynamic){
+		IoModelToDynamicConstraintsx(constraints,iomodel,ThermalSpctemperatureEnum,ThermalAnalysisEnum,finiteelement);
+	}
+	else{
 		IoModelToConstraintsx(constraints,iomodel,ThermalSpctemperatureEnum,ThermalAnalysisEnum,finiteelement);
 	}
 
@@ -37,6 +62,7 @@
 void ThermalAnalysis::CreateNodes(Nodes* nodes,IoModel* iomodel){/*{{{*/
 
 	int finiteelement = P1Enum;
+	
 	if(iomodel->domaintype==Domain3DEnum) iomodel->FetchData(2,MeshVertexonbaseEnum,MeshVertexonsurfaceEnum);
 	::CreateNodes(nodes,iomodel,ThermalAnalysisEnum,finiteelement);
 	iomodel->DeleteData(2,MeshVertexonbaseEnum,MeshVertexonsurfaceEnum);
@@ -46,8 +72,8 @@
 }/*}}}*/
 void ThermalAnalysis::UpdateElements(Elements* elements,IoModel* iomodel,int analysis_counter,int analysis_type){/*{{{*/
 
-	int frictionlaw;
-
+	int frictionlaw,basalforcing_model;
+	int FrictionCoupling;
 	/*Now, is the model 3d? otherwise, do nothing: */
 	if(iomodel->domaintype==Domain2DhorizontalEnum)return;
 
@@ -62,14 +88,15 @@
 		}
 	}
 
-	bool dakota_analysis, islevelset;
+	bool dakota_analysis, ismovingfront;
 	iomodel->Constant(&dakota_analysis,QmuIsdakotaEnum);
-	iomodel->Constant(&islevelset,TransientIslevelsetEnum);
+	iomodel->Constant(&ismovingfront,TransientIsmovingfrontEnum);
 	iomodel->Constant(&frictionlaw,FrictionLawEnum);
 
 	iomodel->FetchDataToInput(elements,ThicknessEnum);
 	iomodel->FetchDataToInput(elements,SurfaceEnum);
 	iomodel->FetchDataToInput(elements,BaseEnum);
+	iomodel->FetchDataToInput(elements,SealevelEnum,0);
 	iomodel->FetchDataToInput(elements,MaskIceLevelsetEnum);
 	iomodel->FetchDataToInput(elements,MaskGroundediceLevelsetEnum);
 	if(iomodel->domaintype!=Domain2DhorizontalEnum){
@@ -82,17 +109,24 @@
 	iomodel->FetchDataToInput(elements,MaterialsRheologyNEnum);
 	iomodel->FetchDataToInput(elements,PressureEnum);
 	iomodel->FetchDataToInput(elements,TemperatureEnum);
-	iomodel->FetchDataToInput(elements,BasalforcingsGeothermalfluxEnum);
 	iomodel->FetchDataToInput(elements,VxEnum);
 	iomodel->FetchDataToInput(elements,VyEnum);
 	iomodel->FetchDataToInput(elements,VzEnum);
 	InputUpdateFromConstantx(elements,0.,VxMeshEnum);
 	InputUpdateFromConstantx(elements,0.,VyMeshEnum);
 	InputUpdateFromConstantx(elements,0.,VzMeshEnum);
-	if(islevelset){
-		iomodel->FetchDataToInput(elements,IceMaskNodeActivationEnum);
+	if(ismovingfront){
 		iomodel->FetchDataToInput(elements,MeshVertexonbaseEnum); // required for updating active nodes
 	}
+	/*Basal forcings variables*/
+	iomodel->Constant(&basalforcing_model,BasalforcingsEnum);
+	switch(basalforcing_model){
+		case MantlePlumeGeothermalFluxEnum:
+			break;
+		default:
+			iomodel->FetchDataToInput(elements,BasalforcingsGeothermalfluxEnum);
+			break;
+	}
 	/*Friction law variables*/
 	switch(frictionlaw){
 		case 1:
@@ -105,10 +139,13 @@
 			iomodel->FetchDataToInput(elements,FrictionMEnum);
 			break;
 		case 3:
+			iomodel->Constant(&FrictionCoupling,FrictionCouplingEnum);
 			iomodel->FetchDataToInput(elements,FrictionCEnum);
 			iomodel->FetchDataToInput(elements,FrictionAsEnum);
 			iomodel->FetchDataToInput(elements,FrictionQEnum);
-			iomodel->FetchDataToInput(elements,FrictionEffectivePressureEnum);
+			if (FrictionCoupling==0){
+				iomodel->FetchDataToInput(elements,FrictionEffectivePressureEnum);
+			}
 			break;
 		case 4:
 			iomodel->FetchDataToInput(elements,FrictionCoefficientEnum);
@@ -156,6 +193,7 @@
 	int frictionlaw;
 	iomodel->Constant(&frictionlaw,FrictionLawEnum);
 	if(frictionlaw==4 || frictionlaw==6) parameters->AddObject(iomodel->CopyConstantObject(FrictionGammaEnum));
+	if(frictionlaw==3) parameters->AddObject(iomodel->CopyConstantObject(FrictionCouplingEnum));
 }/*}}}*/
 
 /*Finite Element Analysis*/
@@ -216,7 +254,7 @@
 	IssmDouble  thermal_exchange_vel= element->GetMaterialParameter(MaterialsThermalExchangeVelocityEnum);
 
 	/* Start  looping on the number of gaussian points: */
-	Gauss* gauss=element->NewGaussBase(2);
+	Gauss* gauss=element->NewGaussBase(4);
 	for(int ig=gauss->begin();ig<gauss->end();ig++){
 		gauss->GaussPoint(ig);
 
@@ -282,7 +320,7 @@
 	if(stabilization==2) diameter=element->MinEdgeLength(xyz_list);
 
 	/* Start  looping on the number of gaussian points: */
-	Gauss* gauss=element->NewGauss(2);
+	Gauss* gauss=element->NewGauss(4);
 	for(int ig=gauss->begin();ig<gauss->end();ig++){
 		gauss->GaussPoint(ig);
 
@@ -421,7 +459,7 @@
 	Friction* friction=new Friction(element,3);
 
 	/* Start  looping on the number of gaussian points: */
-	Gauss* gauss   = element->NewGaussBase(2);
+	Gauss* gauss   = element->NewGaussBase(4);
 	for(int ig=gauss->begin();ig<gauss->end();ig++){
 		gauss->GaussPoint(ig);
 
@@ -480,7 +518,7 @@
 	IssmDouble  thermal_exchange_vel= element->GetMaterialParameter(MaterialsThermalExchangeVelocityEnum);
 
 	/* Start  looping on the number of gaussian points: */
-	Gauss* gauss=element->NewGaussBase(2);
+	Gauss* gauss=element->NewGaussBase(4);
 	for(int ig=gauss->begin();ig<gauss->end();ig++){
 		gauss->GaussPoint(ig);
 
@@ -540,7 +578,7 @@
 	if(stabilization==2) diameter=element->MinEdgeLength(xyz_list);
 
 	/* Start  looping on the number of gaussian points: */
-	Gauss* gauss=element->NewGauss(3);
+	Gauss* gauss=element->NewGauss(4);
 	for(int ig=gauss->begin();ig<gauss->end();ig++){
 		gauss->GaussPoint(ig);
 
@@ -758,11 +796,5 @@
 	xDelete<int>(doflist);
 }/*}}}*/
 void           ThermalAnalysis::UpdateConstraints(FemModel* femmodel){/*{{{*/
-
-	bool islevelset;
-	femmodel->parameters->FindParam(&islevelset,TransientIslevelsetEnum);
-	if(islevelset){
-		SetActiveNodesLSMx(femmodel);
-	}
-	return;
+	SetActiveNodesLSMx(femmodel);
 }/*}}}*/

Modified: issm/trunk/src/c/analyses/analyses.h
===================================================================
--- issm/trunk/src/c/analyses/analyses.h	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/analyses/analyses.h	2016-04-13 04:32:01 UTC (rev 20500)
@@ -26,9 +26,12 @@
 #include "./HydrologyDCEfficientAnalysis.h"
 #include "./HydrologyDCInefficientAnalysis.h"
 #include "./HydrologyShreveAnalysis.h"
+#include "./HydrologySommersAnalysis.h"
 #include "./LevelsetAnalysis.h"
 #include "./LsfReinitializationAnalysis.h"
 #include "./MasstransportAnalysis.h"
+#include "./SmbAnalysis.h"
+#include "./SealevelriseAnalysis.h"
 #include "./MeltingAnalysis.h"
 #include "./MeshdeformationAnalysis.h"
 #include "./SmoothAnalysis.h"

Modified: issm/trunk/src/c/classes/Constraints/SpcDynamic.cpp
===================================================================
--- issm/trunk/src/c/classes/Constraints/SpcDynamic.cpp	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/classes/Constraints/SpcDynamic.cpp	2016-04-13 04:32:01 UTC (rev 20500)
@@ -76,7 +76,21 @@
 
 }
 /*}}}*/
+void    SpcDynamic::Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ /*{{{*/
 
+	MARSHALLING_ENUM(SpcDynamicEnum);
+
+	MARSHALLING(sid);
+	MARSHALLING(nodeid);
+	MARSHALLING(dof);
+	MARSHALLING(value);
+	MARSHALLING(analysis_type);
+	MARSHALLING(isset);
+	MARSHALLING(penalty);
+
+}
+/*}}}*/
+
 /*Constraint virtual functions definitions: */
 void SpcDynamic::ActivatePenaltyMethod(void){/*{{{*/
 	this->penalty = true;

Modified: issm/trunk/src/c/classes/Constraints/SpcDynamic.h
===================================================================
--- issm/trunk/src/c/classes/Constraints/SpcDynamic.h	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/classes/Constraints/SpcDynamic.h	2016-04-13 04:32:01 UTC (rev 20500)
@@ -34,6 +34,7 @@
 		void    Echo();
 		int     Id();
 		int     ObjectEnum();
+		void    Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction);
 
 		/*Constraint virtual functions definitions*/
 		void ActivatePenaltyMethod(void);

Modified: issm/trunk/src/c/classes/Constraints/SpcStatic.cpp
===================================================================
--- issm/trunk/src/c/classes/Constraints/SpcStatic.cpp	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/classes/Constraints/SpcStatic.cpp	2016-04-13 04:32:01 UTC (rev 20500)
@@ -78,7 +78,20 @@
 
 }
 /*}}}*/
+void    SpcStatic::Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ /*{{{*/
 
+	MARSHALLING_ENUM(SpcStaticEnum);
+
+	MARSHALLING(sid);
+	MARSHALLING(nodeid);
+	MARSHALLING(dof);
+	MARSHALLING(value);
+	MARSHALLING(analysis_type);
+	MARSHALLING(penalty);
+
+}
+/*}}}*/
+
 /*Constraint virtual functions definitions: */
 void SpcStatic::ActivatePenaltyMethod(void){/*{{{*/
 	   this->penalty = true;

Modified: issm/trunk/src/c/classes/Constraints/SpcStatic.h
===================================================================
--- issm/trunk/src/c/classes/Constraints/SpcStatic.h	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/classes/Constraints/SpcStatic.h	2016-04-13 04:32:01 UTC (rev 20500)
@@ -33,6 +33,7 @@
 		int   Id(); 
 		int   ObjectEnum();
 		Object* copy();
+		void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction);
 		/*}}}*/
 		/*Constraint virtual functions definitions: {{{*/
 		void ActivatePenaltyMethod(void);

Modified: issm/trunk/src/c/classes/Constraints/SpcTransient.cpp
===================================================================
--- issm/trunk/src/c/classes/Constraints/SpcTransient.cpp	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/classes/Constraints/SpcTransient.cpp	2016-04-13 04:32:01 UTC (rev 20500)
@@ -84,7 +84,28 @@
 
 }
 /*}}}*/
+void    SpcTransient::Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ /*{{{*/
 
+	MARSHALLING_ENUM(SpcTransientEnum);
+
+	MARSHALLING(sid);
+	MARSHALLING(nodeid);
+	MARSHALLING(dof);
+	MARSHALLING(analysis_type);
+	MARSHALLING(penalty);
+	MARSHALLING(nsteps);
+	if(nsteps){
+		MARSHALLING_DYNAMIC(values,IssmDouble,nsteps);
+		MARSHALLING_DYNAMIC(times,IssmDouble,nsteps);
+	}
+	else{
+		values=NULL;
+		times=NULL;
+	}
+
+}
+/*}}}*/
+
 /*Constraint virtual functions definitions:*/
 void SpcTransient::ActivatePenaltyMethod(void){/*{{{*/
 	   this->penalty = true;

Modified: issm/trunk/src/c/classes/Constraints/SpcTransient.h
===================================================================
--- issm/trunk/src/c/classes/Constraints/SpcTransient.h	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/classes/Constraints/SpcTransient.h	2016-04-13 04:32:01 UTC (rev 20500)
@@ -35,6 +35,7 @@
 		void    Echo();
 		int     Id(); 
 		int     ObjectEnum();
+		void    Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction);
 		/*}}}*/
 		/*Constraint virtual functions definitions: {{{*/
 		void   ActivatePenaltyMethod(void);

Modified: issm/trunk/src/c/classes/Contour.h
===================================================================
--- issm/trunk/src/c/classes/Contour.h	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/classes/Contour.h	2016-04-13 04:32:01 UTC (rev 20500)
@@ -82,6 +82,11 @@
 			return (Object*) contour;
 		}
 		/*}}}*/
+		void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){/*{{{*/
+			_error_("not implemented yet!"); 
+		} 
+		/*}}}*/
+
 };
 
 #endif  /* _CONTOUR_H_ */

Modified: issm/trunk/src/c/classes/DependentObject.h
===================================================================
--- issm/trunk/src/c/classes/DependentObject.h	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/classes/DependentObject.h	2016-04-13 04:32:01 UTC (rev 20500)
@@ -31,7 +31,11 @@
 		int   Id(); 
 		int   ObjectEnum();
 		Object* copy(void);
+		void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){/*{{{*/
+			_error_("not implemented yet!"); 
+		} 
 		/*}}}*/
+		/*}}}*/
 
 		/*DependentObject methods: */
 		int  NumDependents(void);

Modified: issm/trunk/src/c/classes/DofIndexing.cpp
===================================================================
--- issm/trunk/src/c/classes/DofIndexing.cpp	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/classes/DofIndexing.cpp	2016-04-13 04:32:01 UTC (rev 20500)
@@ -14,6 +14,7 @@
 #include "../shared/Numerics/types.h"
 #include "../shared/Numerics/constants.h"
 #include "../shared/io/Print/Print.h"
+#include "../shared/io/Marshalling/Marshalling.h"
 #include "../shared/Exceptions/exceptions.h"
 #include "../shared/MemOps/MemOps.h"
 #include "../shared/Enum/Enum.h"
@@ -26,6 +27,7 @@
 	this->ssize    = UNDEF;
 	this->clone    = false;
 	this->active   = true;
+	this->freeze   = false;
 	this->f_set    = NULL;
 	this->s_set    = NULL;
 	this->svalues  = NULL;
@@ -49,6 +51,7 @@
 	this->ssize  = in->ssize;
 	this->clone  = in->clone;
 	this->active = in->active;
+	this->freeze = in->freeze;
 
 	if(this->gsize>0){
 		this->f_set=xNew<bool>(this->gsize);
@@ -110,6 +113,7 @@
 	this->ssize  = in.ssize;
 	this->clone  = in.clone;
 	this->active = in.active;
+	this->freeze = in.freeze;
 
 	if(this->gsize>0){
 		this->f_set=xNew<bool>(this->gsize);
@@ -217,6 +221,7 @@
 	_printf_("   ssize:  " << ssize << "\n");
 	_printf_("   clone:  " << clone << "\n");
 	_printf_("   active: " << active << "\n");
+	_printf_("   freeze: " << freeze << "\n");
 }
 /*}}}*/
 void DofIndexing::DeepEcho(void){/*{{{*/
@@ -229,6 +234,7 @@
 	_printf_("   ssize:  " << ssize << "\n");
 	_printf_("   clone:  " << clone << "\n");
 	_printf_("   active: " << active << "\n");
+	_printf_("   freeze: " << freeze << "\n");
 
 	_printf_("   set membership: f,s sets \n");
 	for(i=0;i<gsize;i++){
@@ -282,6 +288,7 @@
 }
 /*}}}*/
 void DofIndexing::Activate(void){/*{{{*/
+
 	this->active = true;
 
 	/*Constrain to 0. at this point*/
@@ -293,3 +300,21 @@
 	return;
 }
 /*}}}*/
+void DofIndexing::Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ /*{{{*/
+
+	MARSHALLING(gsize);
+	MARSHALLING(fsize);
+	MARSHALLING(ssize);
+	MARSHALLING(clone);
+	MARSHALLING(active);
+	MARSHALLING(freeze);
+	MARSHALLING_DYNAMIC(f_set,bool,gsize);
+	MARSHALLING_DYNAMIC(s_set,bool,gsize);
+	MARSHALLING_DYNAMIC(svalues,IssmDouble,gsize);
+	MARSHALLING_DYNAMIC(doftype,int,gsize);
+	MARSHALLING_DYNAMIC(gdoflist,int,gsize);
+	MARSHALLING_DYNAMIC(fdoflist,int,fsize);
+	MARSHALLING_DYNAMIC(sdoflist,int,ssize);
+
+}
+/*}}}*/

Modified: issm/trunk/src/c/classes/DofIndexing.h
===================================================================
--- issm/trunk/src/c/classes/DofIndexing.h	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/classes/DofIndexing.h	2016-04-13 04:32:01 UTC (rev 20500)
@@ -17,8 +17,9 @@
 		int ssize;   //number of constrained dofs
 
 		/*partitioning: */
-		bool clone;   //this node is replicated from another one
-		bool active;  //Is this node active or inactive (all dofs are constrained)
+		bool clone;  //this node is replicated from another one
+		bool active; //Is this node active or inactive (all dofs are constrained)
+		bool freeze; //this is required for 2d solutions, we never activate nodes that are not on base
 
 		/*boundary conditions sets: */
 		bool       *f_set;     //is dof on f-set (on which we solve)
@@ -46,6 +47,7 @@
 		void  Echo(void); 
 		void  DeepEcho(void); 
 		void  copy(const DofIndexing& in);
+		void    Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction);
 		/*}}}*/
 		/*DofIndexing management: {{{*/
 		DofIndexing* Spawn(int* indices, int numindices);

Modified: issm/trunk/src/c/classes/Elements/Element.cpp
===================================================================
--- issm/trunk/src/c/classes/Elements/Element.cpp	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/classes/Elements/Element.cpp	2016-04-13 04:32:01 UTC (rev 20500)
@@ -8,10 +8,12 @@
 #else
 #error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
 #endif
+#include <math.h>
 #include <stdio.h>
 #include <string.h>
 #include "../classes.h"
 #include "../../shared/shared.h"
+#include "../../modules/SurfaceMassBalancex/SurfaceMassBalancex.h"
 /*}}}*/
 
 /*Constructors/destructor/copy*/
@@ -45,7 +47,7 @@
 	IssmDouble *xyz_list=NULL;
 	IssmDouble  eps_xx,eps_xy,eps_yy,eps_xz,eps_yz,eps_zz,eps_eff;
 	IssmDouble  epsmin=1.e-27;
-	IssmDouble  eps_0,eps_f,sigma_0,B,D,n;
+	IssmDouble  eps_0,kappa,sigma_0,B,D,n,envelopeD;
 	int         dim,counter=0;
 	IssmDouble  k1,k2,threshold=1.e-12;
 
@@ -53,7 +55,7 @@
 	this->GetVerticesCoordinates(&xyz_list);
 	this->ComputeStrainRate();
 	parameters->FindParam(&dim,DomainDimensionEnum);
-	parameters->FindParam(&eps_f,DamageC1Enum);
+	parameters->FindParam(&kappa,DamageKappaEnum);
 	parameters->FindParam(&sigma_0,DamageStressThresholdEnum);
 
 	/* Retrieve inputs */
@@ -112,35 +114,15 @@
 
 		/* Compute threshold strain rate from threshold stress */
 		eps_0=pow(sigma_0/B,n); 
-		_assert_(eps_f>eps_0);
 
-		/* Compute kappa (k) from pre-existing level of damage, using Newton-Raphson */
-		/* provide a reasonable initial guess */
-		if(D==0){
-			k1=eps_0;
-		}
-		else{
-			k1=exp(n*eps_0/(eps_f-eps_0)-n*log(1.-D)+log(eps_0)); /* initial guess */
-		}
-	
-		counter=0;
-		while(true){
-      	/*Newton step k2=k1-f(k1)/f'(k1) */
-			k2=k1-(k1+(eps_f-eps_0)/n*log(k1)-eps_0+(eps_f-eps_0)*(log(1.-D)-1./n*log(eps_0)))/(1.+(eps_f-eps_0)/n/k1);
+		if(eps_eff>eps_0){
+			/* Compute damage on envelope curve for existing level of effective strain rate */
+			envelopeD=1.-pow(eps_0/eps_eff,1./n)*exp(-(eps_eff-eps_0)/(eps_0*(kappa-1.)));
 
-      	if( fabs(k2-k1)/(fabs(k2))<threshold ){
-         	break;
-      	}
-      	else{
-				k1=k2;
-      	   counter++;
-      	}
-
-      	if(counter>50) break;
-   	}
-
-		if(eps_eff>k2){
-			newD[i]=1.-pow(eps_0/eps_eff,1./n)*exp(-(eps_eff-eps_0)/(eps_f-eps_0));
+			if(envelopeD>D){
+				newD[i]=envelopeD;
+			}
+			else newD[i]=D;
 		}
 		else newD[i]=D;
 	}
@@ -234,6 +216,7 @@
 	xDelete<IssmDouble>(eps_xy);
 	xDelete<IssmDouble>(eps_xz);
 	xDelete<IssmDouble>(eps_yz);
+	xDelete<IssmDouble>(eps_ef);
 
 }
 /*}}}*/
@@ -393,6 +376,7 @@
 	}
 
 	/*Clean up and return*/
+	xDelete<IssmDouble>(xyz_list);
 	delete gauss;
 	return divergence;
 }/*}}}*/
@@ -504,6 +488,301 @@
 
 }
 /*}}}*/
+void       Element::Delta18oParameterization(void){/*{{{*/
+
+	/*Are we on the base? If not, return*/
+	if(!IsOnBase()) return;
+
+	int        numvertices = this->GetNumberOfVertices();
+
+	int        i;
+	IssmDouble* monthlytemperatures=xNew<IssmDouble>(12*numvertices);
+	IssmDouble* monthlyprec=xNew<IssmDouble>(12*numvertices);
+	IssmDouble* TemperaturesPresentday=xNew<IssmDouble>(12*numvertices);
+	IssmDouble* TemperaturesLgm=xNew<IssmDouble>(12*numvertices);
+	IssmDouble* PrecipitationsPresentday=xNew<IssmDouble>(12*numvertices);
+	IssmDouble* tmp=xNew<IssmDouble>(numvertices);
+	IssmDouble Delta18oPresent,Delta18oLgm,Delta18oTime;
+	IssmDouble Delta18oSurfacePresent,Delta18oSurfaceLgm,Delta18oSurfaceTime;
+	IssmDouble time,yts,finaltime,time_yr;
+
+	/*Recover parameters*/
+	this->parameters->FindParam(&time,TimeEnum);
+	this->parameters->FindParam(&yts,ConstantsYtsEnum);
+	this->parameters->FindParam(&finaltime,TimesteppingFinalTimeEnum);
+	time_yr=floor(time/yts)*yts;
+
+	/*Recover present day temperature and precipitation*/
+	Input* input=this->inputs->GetInput(SmbTemperaturesPresentdayEnum);    _assert_(input);
+	Input* input2=this->inputs->GetInput(SmbTemperaturesLgmEnum);          _assert_(input2);
+	Input* input3=this->inputs->GetInput(SmbPrecipitationsPresentdayEnum); _assert_(input3);
+	/*loop over vertices: */
+	Gauss* gauss=this->NewGauss();
+	for(int month=0;month<12;month++){
+		for(int iv=0;iv<numvertices;iv++){
+			gauss->GaussVertex(iv);
+			input->GetInputValue(&TemperaturesPresentday[iv*12+month],gauss,month/12.*yts);
+			input2->GetInputValue(&TemperaturesLgm[iv*12+month],gauss,month/12.*yts);
+			input3->GetInputValue(&PrecipitationsPresentday[iv*12+month],gauss,month/12.*yts);
+
+			PrecipitationsPresentday[iv*12+month]=PrecipitationsPresentday[iv*12+month]*yts;
+		}
+	}
+
+	/*Recover delta18o and Delta18oSurface at present day, lgm and at time t*/
+	this->parameters->FindParam(&Delta18oPresent,SmbDelta18oEnum,finaltime);
+	this->parameters->FindParam(&Delta18oLgm,SmbDelta18oEnum,(finaltime-(21000*yts)));
+	this->parameters->FindParam(&Delta18oTime,SmbDelta18oEnum,time);
+	this->parameters->FindParam(&Delta18oSurfacePresent,SmbDelta18oSurfaceEnum,finaltime);
+	this->parameters->FindParam(&Delta18oSurfaceLgm,SmbDelta18oSurfaceEnum,(finaltime-(21000*yts)));
+	this->parameters->FindParam(&Delta18oSurfaceTime,SmbDelta18oSurfaceEnum,time);
+
+	/*Compute the temperature and precipitation*/
+	for(int iv=0;iv<numvertices;iv++){
+		ComputeDelta18oTemperaturePrecipitation(Delta18oSurfacePresent, Delta18oSurfaceLgm, Delta18oSurfaceTime,
+					Delta18oPresent, Delta18oLgm, Delta18oTime,
+					&PrecipitationsPresentday[iv*12],
+					&TemperaturesLgm[iv*12], &TemperaturesPresentday[iv*12],
+					&monthlytemperatures[iv*12], &monthlyprec[iv*12]);
+	}
+
+	/*Update inputs*/
+	TransientInput* NewTemperatureInput = new TransientInput(SmbMonthlytemperaturesEnum);
+	TransientInput* NewPrecipitationInput = new TransientInput(SmbPrecipitationEnum);
+	for (int imonth=0;imonth<12;imonth++) {
+		for(i=0;i<numvertices;i++) tmp[i]=monthlytemperatures[i*12+imonth];
+		switch(this->ObjectEnum()){
+			case TriaEnum:  NewTemperatureInput->AddTimeInput(new TriaInput(SmbMonthlytemperaturesEnum,&tmp[0],P1Enum),time_yr+imonth/12.*yts); break;
+			case PentaEnum: NewTemperatureInput->AddTimeInput(new PentaInput(SmbMonthlytemperaturesEnum,&tmp[0],P1Enum),time_yr+imonth/12.*yts); break;
+			case TetraEnum: NewTemperatureInput->AddTimeInput(new TetraInput(SmbMonthlytemperaturesEnum,&tmp[0],P1Enum),time_yr+imonth/12.*yts); break;
+			default: _error_("Not implemented yet");
+		}
+		for(i=0;i<numvertices;i++) tmp[i]=monthlyprec[i*12+imonth]/yts;
+		switch(this->ObjectEnum()){
+			case TriaEnum:  NewPrecipitationInput->AddTimeInput(new TriaInput(SmbPrecipitationEnum,&tmp[0],P1Enum),time_yr+imonth/12.*yts); break;
+			case PentaEnum: NewPrecipitationInput->AddTimeInput(new PentaInput(SmbPrecipitationEnum,&tmp[0],P1Enum),time_yr+imonth/12.*yts); break;
+			case TetraEnum: NewPrecipitationInput->AddTimeInput(new TetraInput(SmbPrecipitationEnum,&tmp[0],P1Enum),time_yr+imonth/12.*yts); break;
+			default: _error_("Not implemented yet");
+		}
+	}
+	NewTemperatureInput->Configure(this->parameters);
+	NewPrecipitationInput->Configure(this->parameters);
+
+	this->inputs->AddInput(NewTemperatureInput);
+	this->inputs->AddInput(NewPrecipitationInput);
+
+	switch(this->ObjectEnum()){
+		case TriaEnum: break;
+		case PentaEnum:
+		case TetraEnum:
+							this->InputExtrude(SmbMonthlytemperaturesEnum,-1);
+							this->InputExtrude(SmbPrecipitationEnum,-1);
+							break;
+		default: _error_("Not implemented yet");
+	}
+
+	/*clean-up*/
+	delete gauss;
+	xDelete<IssmDouble>(monthlytemperatures);
+	xDelete<IssmDouble>(monthlyprec);
+	xDelete<IssmDouble>(TemperaturesPresentday);
+	xDelete<IssmDouble>(TemperaturesLgm);
+	xDelete<IssmDouble>(PrecipitationsPresentday);
+	xDelete<IssmDouble>(tmp);
+
+}
+/*}}}*/
+void       Element::MungsmtpParameterization(void){/*{{{*/
+	/*Are we on the base? If not, return*/
+	if(!IsOnBase()) return;
+
+	int        numvertices = this->GetNumberOfVertices();
+
+	int        i;
+	IssmDouble* monthlytemperatures=xNew<IssmDouble>(12*numvertices);
+	IssmDouble* monthlyprec=xNew<IssmDouble>(12*numvertices);
+	IssmDouble* TemperaturesPresentday=xNew<IssmDouble>(12*numvertices);
+	IssmDouble* TemperaturesLgm=xNew<IssmDouble>(12*numvertices);
+	IssmDouble* PrecipitationsPresentday=xNew<IssmDouble>(12*numvertices);
+	IssmDouble* PrecipitationsLgm=xNew<IssmDouble>(12*numvertices);
+	IssmDouble* tmp=xNew<IssmDouble>(numvertices);
+	IssmDouble TdiffTime,PfacTime;
+	IssmDouble time,yts,time_yr;
+	this->parameters->FindParam(&time,TimeEnum);
+	this->parameters->FindParam(&yts,ConstantsYtsEnum);
+	time_yr=floor(time/yts)*yts;
+
+	/*Recover present day temperature and precipitation*/
+	Input*     input=this->inputs->GetInput(SmbTemperaturesPresentdayEnum);    _assert_(input);
+	Input*     input2=this->inputs->GetInput(SmbTemperaturesLgmEnum);          _assert_(input2);
+	Input*     input3=this->inputs->GetInput(SmbPrecipitationsPresentdayEnum); _assert_(input3);
+	Input*     input4=this->inputs->GetInput(SmbPrecipitationsLgmEnum);        _assert_(input4);
+	/*loop over vertices: */
+	Gauss* gauss=this->NewGauss();
+	for(int month=0;month<12;month++) {
+		for(int iv=0;iv<numvertices;iv++) {
+			gauss->GaussVertex(iv);
+			input->GetInputValue(&TemperaturesPresentday[iv*12+month],gauss,month/12.*yts);
+			input2->GetInputValue(&TemperaturesLgm[iv*12+month],gauss,month/12.*yts);
+			input3->GetInputValue(&PrecipitationsPresentday[iv*12+month],gauss,month/12.*yts);
+			input4->GetInputValue(&PrecipitationsLgm[iv*12+month],gauss,month/12.*yts);
+
+			PrecipitationsPresentday[iv*12+month]=PrecipitationsPresentday[iv*12+month]*yts;
+			PrecipitationsLgm[iv*12+month]=PrecipitationsLgm[iv*12+month]*yts;
+		}
+	}
+
+	/*Recover interpolation parameters at time t*/
+	this->parameters->FindParam(&TdiffTime,SmbTdiffEnum,time);
+	this->parameters->FindParam(&PfacTime,SmbPfacEnum,time);
+
+	/*Compute the temperature and precipitation*/
+	for(int iv=0;iv<numvertices;iv++){
+		ComputeMungsmTemperaturePrecipitation(TdiffTime,PfacTime,
+					&PrecipitationsLgm[iv*12],&PrecipitationsPresentday[iv*12],
+					&TemperaturesLgm[iv*12], &TemperaturesPresentday[iv*12],
+					&monthlytemperatures[iv*12], &monthlyprec[iv*12]);
+	}
+
+	/*Update inputs*/
+	TransientInput* NewTemperatureInput = new TransientInput(SmbMonthlytemperaturesEnum);
+	TransientInput* NewPrecipitationInput = new TransientInput(SmbPrecipitationEnum);
+	for (int imonth=0;imonth<12;imonth++) {
+		for(i=0;i<numvertices;i++) tmp[i]=monthlytemperatures[i*12+imonth];
+		switch(this->ObjectEnum()){
+			case TriaEnum:  NewTemperatureInput->AddTimeInput(new TriaInput(SmbMonthlytemperaturesEnum,&tmp[0],P1Enum),time_yr+imonth/12.*yts); break;
+			case PentaEnum: NewTemperatureInput->AddTimeInput(new PentaInput(SmbMonthlytemperaturesEnum,&tmp[0],P1Enum),time_yr+imonth/12.*yts); break;
+			case TetraEnum: NewTemperatureInput->AddTimeInput(new TetraInput(SmbMonthlytemperaturesEnum,&tmp[0],P1Enum),time_yr+imonth/12.*yts); break;
+			default: _error_("Not implemented yet");
+		}
+		for(i=0;i<numvertices;i++) tmp[i]=monthlyprec[i*12+imonth]/yts;
+		switch(this->ObjectEnum()){
+			case TriaEnum:  NewPrecipitationInput->AddTimeInput(new TriaInput(SmbPrecipitationEnum,&tmp[0],P1Enum),time_yr+imonth/12.*yts); break;
+			case PentaEnum: NewPrecipitationInput->AddTimeInput(new PentaInput(SmbPrecipitationEnum,&tmp[0],P1Enum),time_yr+imonth/12.*yts); break;
+			case TetraEnum: NewPrecipitationInput->AddTimeInput(new TetraInput(SmbPrecipitationEnum,&tmp[0],P1Enum),time_yr+imonth/12.*yts); break;
+			default: _error_("Not implemented yet");
+		}
+	}
+	NewTemperatureInput->Configure(this->parameters);
+	NewPrecipitationInput->Configure(this->parameters);
+
+	this->inputs->AddInput(NewTemperatureInput);
+	this->inputs->AddInput(NewPrecipitationInput);
+
+	switch(this->ObjectEnum()){
+		case TriaEnum: break;
+		case PentaEnum:
+		case TetraEnum:
+							this->InputExtrude(SmbMonthlytemperaturesEnum,-1);
+							this->InputExtrude(SmbPrecipitationEnum,-1);
+							break;
+		default: _error_("Not implemented yet");
+	}
+
+	/*clean-up*/
+	delete gauss;
+	xDelete<IssmDouble>(monthlytemperatures);
+	xDelete<IssmDouble>(monthlyprec);
+	xDelete<IssmDouble>(TemperaturesPresentday);
+	xDelete<IssmDouble>(TemperaturesLgm);
+	xDelete<IssmDouble>(PrecipitationsPresentday);
+	xDelete<IssmDouble>(PrecipitationsLgm);
+	xDelete<IssmDouble>(tmp);
+
+}
+/*}}}*/
+void       Element::Delta18opdParameterization(void){/*{{{*/
+	/*Are we on the base? If not, return*/
+	if(!IsOnBase()) return;
+
+	int        numvertices = this->GetNumberOfVertices();
+
+	int        i;
+	IssmDouble* monthlytemperatures=xNew<IssmDouble>(12*numvertices);
+	IssmDouble* monthlyprec=xNew<IssmDouble>(12*numvertices);
+	IssmDouble* TemperaturesPresentday=xNew<IssmDouble>(12*numvertices);
+	IssmDouble* PrecipitationsPresentday=xNew<IssmDouble>(12*numvertices);
+	IssmDouble* tmp=xNew<IssmDouble>(numvertices);
+	IssmDouble Delta18oTime;
+	IssmDouble dpermil;
+	IssmDouble time,yts,time_yr,month;
+	this->parameters->FindParam(&time,TimeEnum);
+	this->parameters->FindParam(&yts,ConstantsYtsEnum);
+	time_yr=floor(time/yts)*yts;
+
+	/*Get some pdd parameters*/
+	dpermil=this->matpar->GetMaterialParameter(SmbDpermilEnum);
+
+	/*Recover present day temperature and precipitation*/
+	Input*     input=this->inputs->GetInput(SmbTemperaturesPresentdayEnum);    _assert_(input);
+	Input*     input2=this->inputs->GetInput(SmbPrecipitationsPresentdayEnum); _assert_(input2);
+	/*loop over vertices: */
+	Gauss* gauss=this->NewGauss();
+	for(int month=0;month<12;month++) {
+		for(int iv=0;iv<numvertices;iv++) {
+			gauss->GaussVertex(iv);
+			input->GetInputValue(&TemperaturesPresentday[iv*12+month],gauss,month/12.*yts);
+			input2->GetInputValue(&PrecipitationsPresentday[iv*12+month],gauss,month/12.*yts);
+
+			PrecipitationsPresentday[iv*12+month]=PrecipitationsPresentday[iv*12+month]*yts;
+		}
+	}
+
+	/*Recover interpolation parameters at time t*/
+	this->parameters->FindParam(&Delta18oTime,SmbDelta18oEnum,time);
+
+	/*Compute the temperature and precipitation*/
+	for(int iv=0;iv<numvertices;iv++){
+		ComputeD18OTemperaturePrecipitationFromPD(Delta18oTime,dpermil,
+					&PrecipitationsPresentday[iv*12], &TemperaturesPresentday[iv*12],
+					&monthlytemperatures[iv*12], &monthlyprec[iv*12]);
+	}
+
+	/*Update inputs*/
+	TransientInput* NewTemperatureInput = new TransientInput(SmbMonthlytemperaturesEnum);
+	TransientInput* NewPrecipitationInput = new TransientInput(SmbPrecipitationEnum);
+	for (int imonth=0;imonth<12;imonth++) {
+		for(i=0;i<numvertices;i++) tmp[i]=monthlytemperatures[i*12+imonth];
+		switch(this->ObjectEnum()){
+			case TriaEnum:  NewTemperatureInput->AddTimeInput(new TriaInput(SmbMonthlytemperaturesEnum,&tmp[0],P1Enum),time_yr+imonth/12.*yts); break;
+			case PentaEnum: NewTemperatureInput->AddTimeInput(new PentaInput(SmbMonthlytemperaturesEnum,&tmp[0],P1Enum),time_yr+imonth/12.*yts); break;
+			case TetraEnum: NewTemperatureInput->AddTimeInput(new TetraInput(SmbMonthlytemperaturesEnum,&tmp[0],P1Enum),time_yr+imonth/12.*yts); break;
+			default: _error_("Not implemented yet");
+		}
+		for(i=0;i<numvertices;i++) tmp[i]=monthlyprec[i*12+imonth]/yts;
+		switch(this->ObjectEnum()){
+			case TriaEnum:  NewPrecipitationInput->AddTimeInput(new TriaInput(SmbPrecipitationEnum,&tmp[0],P1Enum),time_yr+imonth/12.*yts); break;
+			case PentaEnum: NewPrecipitationInput->AddTimeInput(new PentaInput(SmbPrecipitationEnum,&tmp[0],P1Enum),time_yr+imonth/12.*yts); break;
+			case TetraEnum: NewPrecipitationInput->AddTimeInput(new TetraInput(SmbPrecipitationEnum,&tmp[0],P1Enum),time_yr+imonth/12.*yts); break;
+			default: _error_("Not implemented yet");
+		}
+	}
+	NewTemperatureInput->Configure(this->parameters);
+	NewPrecipitationInput->Configure(this->parameters);
+
+	this->inputs->AddInput(NewTemperatureInput);
+	this->inputs->AddInput(NewPrecipitationInput);
+
+	switch(this->ObjectEnum()){
+		case TriaEnum: break;
+		case PentaEnum:
+		case TetraEnum:
+							this->InputExtrude(SmbMonthlytemperaturesEnum,-1);
+							this->InputExtrude(SmbPrecipitationEnum,-1);
+							break;
+		default: _error_("Not implemented yet");
+	}
+
+	/*clean-up*/
+	delete gauss;
+	xDelete<IssmDouble>(monthlytemperatures);
+	xDelete<IssmDouble>(monthlyprec);
+	xDelete<IssmDouble>(TemperaturesPresentday);
+	xDelete<IssmDouble>(PrecipitationsPresentday);
+	xDelete<IssmDouble>(tmp);
+	
+}
+/*}}}*/
 void       Element::Echo(void){/*{{{*/
 	_printf_(EnumToStringx(this->ObjectEnum())<<" element:\n");
 	_printf_("   id : "<<this->id <<"\n");
@@ -1089,6 +1368,9 @@
 		xDelete<int>(vertexids);
 	}
 	else if(vector_type==2){ //element vector
+
+		IssmDouble value;
+
 		/*Are we in transient or static? */
 		if(M==iomodel->numberofelements){
 			if (code==5){ //boolean
@@ -1102,14 +1384,29 @@
 			}
 			else _error_("could not recognize nature of vector from code " << code);
 		}
-		else {
-			_error_("transient element inputs not supported yet!");
+		else if(M==iomodel->numberofelements+1){
+			/*create transient input: */
+			IssmDouble* times = xNew<IssmDouble>(N);
+			for(t=0;t<N;t++) times[t] = vector[(M-1)*N+t];
+			TransientInput* transientinput=new TransientInput(vector_enum,times,N);
+			TriaInput* bof=NULL;
+			for(t=0;t<N;t++){
+				value=vector[N*this->Sid()+t];
+				switch(this->ObjectEnum()){
+					case TriaEnum:  transientinput->AddTimeInput(new TriaInput( vector_enum,&value,P0Enum)); break;
+					case PentaEnum: transientinput->AddTimeInput(new PentaInput(vector_enum,&value,P0Enum)); break;
+					case TetraEnum: transientinput->AddTimeInput(new TetraInput(vector_enum,&value,P0Enum)); break;
+					default: _error_("Not implemented yet");
+				}
+			}
+			this->inputs->AddInput(transientinput);
+			xDelete<IssmDouble>(times);
 		}
+		else _error_("element vector is either numberofelements or numberofelements+1 long. Field provided (" << EnumToStringx(vector_enum) << ") is " << M << " long");
 	}
-	else{
-		_error_("Cannot add input for vector type " << vector_type << " (not supported)");
-	}
-}/*}}}*/
+	else _error_("Cannot add input for vector type " << vector_type << " (not supported)");
+}
+/*}}}*/
 void       Element::InputDuplicate(int original_enum,int new_enum){/*{{{*/
 
 	/*Call inputs method*/
@@ -1170,6 +1467,14 @@
 	return (this->inputs->Min(MaskIceLevelsetEnum)<0.);
 }
 /*}}}*/
+bool       Element::IsWaterInElement(){/*{{{*/
+	return (this->inputs->Max(MaskOceanLevelsetEnum)>0.);
+}
+/*}}}*/
+bool       Element::IsLandInElement(){/*{{{*/
+	return (this->inputs->Max(MaskLandLevelsetEnum)>0.);
+}
+/*}}}*/
 bool       Element::IsInput(int name){/*{{{*/
 	if (
 				name==ThicknessEnum ||
@@ -1181,7 +1486,12 @@
 				name==SigmaNNEnum ||
 				name==SurfaceSlopeXEnum ||
 				name==SurfaceSlopeYEnum ||
-				name==SurfaceforcingsMassBalanceEnum ||
+				name==SmbMassBalanceEnum ||
+				name==SmbAccumulationEnum ||
+				name==SmbRunoffEnum ||
+				name==SmbMeltEnum ||
+				name==SmbRefreezeEnum ||
+				name==SmbEvaporationEnum ||
 				name==BasalforcingsGroundediceMeltingRateEnum ||
 				name==BasalforcingsFloatingiceMeltingRateEnum ||
 				name==BasalforcingsGeothermalfluxEnum ||
@@ -1199,12 +1509,14 @@
 				name==InversionVyObsEnum ||
 				name==InversionVzObsEnum ||
 				name==TemperatureEnum ||
+				name==TemperaturePDDEnum ||
 				name==EnthalpyEnum ||
 				name==EnthalpyPicardEnum ||
 				name==WaterfractionEnum||
 				name==WatercolumnEnum || 
 				name==FrictionCoefficientEnum ||
 				name==FrictionAsEnum ||
+				name==FrictionEffectivePressureEnum ||
 				name==MaskGroundediceLevelsetEnum ||
 				name==MaskIceLevelsetEnum ||
 				name==IceMaskNodeActivationEnum ||
@@ -1218,6 +1530,9 @@
 				name==MaterialsRheologyBEnum ||
 				name==MaterialsRheologyBbarEnum ||
 				name==MaterialsRheologyNEnum ||
+				name==SealevelEnum || 
+				name==SealevelEustaticEnum || 
+				name==SealevelriseDeltathicknessEnum || 
 				name==GiaWEnum || 
 				name==GiadWdtEnum ||
 				name==SedimentHeadEnum ||
@@ -1262,6 +1577,71 @@
 	xDelete<IssmDouble>(values);
 
 }/*}}}*/
+void       Element::MantlePlumeGeothermalFlux(){/*{{{*/
+
+	int numvertices      = this->GetNumberOfVertices();
+	IssmDouble  mantleconductivity,nusselt,dtbg,plumeradius,topplumedepth,bottomplumedepth,plumex,plumey;
+	IssmDouble  crustthickness,uppercrustthickness,uppercrustheat,lowercrustheat;
+	IssmDouble  crustheat,plumeheat,dt,middleplumedepth,a,e,eprime,A0,lambda,Alambda,dAlambda;
+	IssmDouble  x,y,z,c;
+	IssmDouble* values   = xNew<IssmDouble>(numvertices);
+	IssmDouble *xyz_list = NULL;
+
+	parameters->FindParam(&mantleconductivity,BasalforcingsMantleconductivityEnum);
+	parameters->FindParam(&nusselt,BasalforcingsNusseltEnum);
+	parameters->FindParam(&dtbg,BasalforcingsDtbgEnum);
+	parameters->FindParam(&plumeradius,BasalforcingsPlumeradiusEnum);
+	parameters->FindParam(&topplumedepth,BasalforcingsTopplumedepthEnum);
+	parameters->FindParam(&bottomplumedepth,BasalforcingsBottomplumedepthEnum);
+	parameters->FindParam(&plumex,BasalforcingsPlumexEnum);
+	parameters->FindParam(&plumey,BasalforcingsPlumeyEnum);
+	parameters->FindParam(&crustthickness,BasalforcingsCrustthicknessEnum);
+	parameters->FindParam(&uppercrustthickness,BasalforcingsUppercrustthicknessEnum);
+	parameters->FindParam(&uppercrustheat,BasalforcingsUppercrustheatEnum);
+	parameters->FindParam(&lowercrustheat,BasalforcingsLowercrustheatEnum);
+
+	this->GetVerticesCoordinates(&xyz_list);
+	c=plumeradius;
+	a=(bottomplumedepth-topplumedepth)/2.;
+	e=pow(a*a-c*c,1./2.)/a;
+	A0=(1-pow(e,2.))/pow(e,3.)*(1./2.*log((1+e)/(1-e))-e);
+	for(int i=0;i<numvertices;i++){
+		y=xyz_list[i*3+0]-plumex;
+		z=xyz_list[i*3+1]-plumey;
+		x=-(a+topplumedepth+crustthickness);
+		lambda=(-pow(a,2)-pow(c,2)+pow(x,2)+pow(y,2)+pow(z,2)+sqrt(pow(-pow(a,2)-pow(c,2)+pow(x,2)+pow(y,2)+pow(z,2),2)+4*(pow(c,2)*pow(x,2)+pow(a,2)*(-pow(c,2)+pow(y,2)+pow(z,2)))))/2;
+		dAlambda=(-8*a*pow(c,2)*x*(-2*pow(a,2)+2*pow(c,2)+sqrt(2)*sqrt((a-c)*(a+c))*sqrt(pow(a,2)-pow(c,2)+pow(x,2)+pow(y,2)+pow(z,2)+sqrt(pow(-pow(a,2)-pow(c,2)+pow(x,2)+pow(y,2)+pow(z,2),2)+4*(pow(c,2)*pow(x,2)+pow(a,2)*(-pow(c,2)+pow(y,2)+pow(z,2))))))*(pow(a,4)*(pow(y,2)+pow(z,2))+pow(c,4)*(pow(y,2)+pow(z,2))+pow(pow(x,2)+pow(y,2)+pow(z,2),2)*(pow(x,2)+pow(y,2)+pow(z,2)+sqrt(pow(-pow(a,2)-pow(c,2)+pow(x,2)+pow(y,2)+pow(z,2),2)+4*(pow(c,2)*pow(x,2)+pow(a,2)*(-pow(c,2)+pow(y,2)+pow(z,2)))))+pow(c,2)*(pow(x,4)-pow(x,2)*(pow(y,2)+pow(z,2))-(pow(y,2)+pow(z,2))*(2*pow(y,2)+2*pow(z,2)+sqrt(pow(-pow(a,2)-pow(c,2)+pow(x,2)+pow(y,2)+pow(z,2),2)+4*(pow(c,2)*pow(x,2)+pow(a,2)*(-pow(c,2)+pow(y,2)+pow(z,2))))))+pow(a,2)*(-pow(x,4)+pow(x,2)*(pow(y,2)+pow(z,2))+(pow(y,2)+pow(z,2))*(-2*pow(c,2)+2*(pow(y,2)+pow(z,2))+sqrt(pow(-pow(a,2)-pow(c,2)+pow(x,2)+pow(y,2)+pow(z,2),2)+4*(pow(c,2)*pow(x,2)+pow(a,2)*(-pow(c,2)+pow(y,2)+pow(z,2))))))))/(sqrt((a-c)*(a+c))*sqrt(pow(-pow(a,2)-pow(c,2)+pow(x,2)+pow(y,2)+pow(z,2),2)+4*(pow(c,2)*pow(x,2)+pow(a,2)*(-pow(c,2)+pow(y,2)+pow(z,2))))*pow(pow(a,2)-pow(c,2)+pow(x,2)+pow(y,2)+pow(z,2)+sqrt(pow(-pow(a,2)-pow(c,2)+pow(x,2)+pow(y,2)+pow(z,2),2)+4*(pow(c,2)*pow(x,2)+pow(a,2)*(-pow(c,2)+pow(y,2)+pow(z,2)))),3.5)*pow(-(sqrt(2)*sqrt((a-c)*(a+c)))+sqrt(pow(a,2)-pow(c,2)+pow(x,2)+pow(y,2)+pow(z,2)+sqrt(pow(-pow(a,2)-pow(c,2)+pow(x,2)+pow(y,2)+pow(z,2),2)+4*(pow(c,2)*pow(x,2)+pow(a,2)*(-pow(c,2)+pow(y,2)+pow(z,2))))),2)*(sqrt(2)*sqrt((a-c)*(a+c))+sqrt(pow(a,2)-pow(c,2)+pow(x,2)+pow(y,2)+pow(z,2)+sqrt(pow(-pow(a,2)-pow(c,2)+pow(x,2)+pow(y,2)+pow(z,2),2)+4*(pow(c,2)*pow(x,2)+pow(a,2)*(-pow(c,2)+pow(y,2)+pow(z,2)))))));
+		eprime=pow((a*a-plumeradius*plumeradius)/(a*a+lambda),1./2.);
+		Alambda=(1.-e*e)/(e*e*e)*(1./2.*log((1.+eprime)/(1.-eprime))-eprime);
+		dt=dtbg-(nusselt-1.)/(1.+A0*(nusselt-1.))*(Alambda*dtbg+x*dtbg*dAlambda);
+		plumeheat=mantleconductivity*dt;
+		crustheat=uppercrustheat*uppercrustthickness+lowercrustheat*(crustthickness-uppercrustthickness);
+		values[i]=crustheat+plumeheat;
+	}
+
+	this->AddInput(BasalforcingsGeothermalfluxEnum,values,P1Enum);
+	xDelete<IssmDouble>(xyz_list);
+	xDelete<IssmDouble>(values);
+
+}/*}}}*/
+void       Element::MarshallElement(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction,int numanalyses){/*{{{*/
+	
+	_assert_(this);
+	if(marshall_direction==MARSHALLING_BACKWARD){
+		inputs=new Inputs();
+		nodes = NULL;
+	}
+
+	MARSHALLING_ENUM(ElementEnum);
+	
+	MARSHALLING(id);
+	MARSHALLING(sid);
+	MARSHALLING(element_type);
+	MARSHALLING_DYNAMIC(element_type_list,int,numanalyses);
+	inputs->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
+
+}
+/*}}}*/
 void       Element::MigrateGroundingLine(IssmDouble* phi_ungrounding){/*{{{*/
 
 	int         numvertices = this->GetNumberOfVertices();
@@ -1274,6 +1654,7 @@
 	IssmDouble* s       = xNew<IssmDouble>(numvertices);
 	IssmDouble* b       = xNew<IssmDouble>(numvertices);
 	IssmDouble* r       = xNew<IssmDouble>(numvertices);
+	IssmDouble* sl      = xNew<IssmDouble>(numvertices);
 
 	/*Recover info at the vertices: */
 	parameters->FindParam(&migration_style,GroundinglineMigrationEnum);
@@ -1282,6 +1663,7 @@
 	GetInputListOnVertices(&s[0],SurfaceEnum);
 	GetInputListOnVertices(&b[0],BaseEnum);
 	GetInputListOnVertices(&r[0],BedEnum);
+	GetInputListOnVertices(&sl[0],SealevelEnum);
 	GetInputListOnVertices(&phi[0],MaskGroundediceLevelsetEnum);
 	rho_water   = matpar->GetMaterialParameter(MaterialsRhoSeawaterEnum);
 	rho_ice     = matpar->GetMaterialParameter(MaterialsRhoIceEnum);
@@ -1305,16 +1687,16 @@
 		/*Ice sheet: if hydrostatic bed above bathymetry, ice sheet starts to unground, elso do nothing */
 		/*Change only if AggressiveMigration or if the ice sheet is in contact with the ocean*/
 		else{ // phi>0
-			bed_hydro=-density*h[i];
+			bed_hydro=-density*h[i]+sl[i];
 			if (bed_hydro>r[i]){
 				/*Unground only if the element is connected to the ice shelf*/
 				if(migration_style==AggressiveMigrationEnum || migration_style==SubelementMigrationEnum || migration_style==SubelementMigration2Enum){
-					s[i]        = (1-density)*h[i];
-					b[i]        = -density*h[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];
-					b[i]        = -density*h[i];
+					s[i]        = (1-density)*h[i]+sl[i];
+					b[i]        = -density*h[i]+sl[i];
 				}
 				else{
 					if(migration_style!=SoftMigrationEnum && migration_style!=ContactEnum && migration_style!=GroundingOnlyEnum) _error_("Error: migration should be Aggressive, Soft, Subelement, Contact or GroundingOnly");
@@ -1326,12 +1708,12 @@
 	/*Recalculate phi*/
 	for(i=0;i<numvertices;i++){
 		if(migration_style==SoftMigrationEnum){
-			bed_hydro=-density*h[i];
+			bed_hydro=-density*h[i]+sl[i];
 			if(phi[i]<0. || bed_hydro<=r[i] || phi_ungrounding[vertices[i]->Pid()]<0.){
-				phi[i]=h[i]+r[i]/density;
+				phi[i]=h[i]+(r[i]-sl[i])/density;
 			}
 		}
-		else if(migration_style!=ContactEnum) phi[i]=h[i]+r[i]/density;
+		else if(migration_style!=ContactEnum) phi[i]=h[i]+(r[i]-sl[i])/density;
 		else{
 			/*do nothing*/
 		}
@@ -1348,10 +1730,40 @@
 	xDelete<IssmDouble>(r);
 	xDelete<IssmDouble>(b);
 	xDelete<IssmDouble>(s);
+	xDelete<IssmDouble>(sl);
 	xDelete<IssmDouble>(h);
 
 }
 /*}}}*/
+void       Element::MismipFloatingiceMeltingRate(){/*{{{*/
+
+	int numvertices      = this->GetNumberOfVertices();
+	IssmDouble  meltratefactor,thresholdthickness,upperdepthmelt;
+	IssmDouble* base     = xNew<IssmDouble>(numvertices);
+	IssmDouble* bed      = xNew<IssmDouble>(numvertices);
+	IssmDouble* values   = xNew<IssmDouble>(numvertices);
+
+	parameters->FindParam(&meltratefactor,BasalforcingsMeltrateFactorEnum);
+	parameters->FindParam(&thresholdthickness,BasalforcingsThresholdThicknessEnum);
+	parameters->FindParam(&upperdepthmelt,BasalforcingsUpperdepthMeltEnum);
+
+	this->GetInputListOnVertices(base,BaseEnum);
+	this->GetInputListOnVertices(bed,BedEnum);
+	for(int i=0;i<numvertices;i++){
+		if(base[i]>upperdepthmelt){
+			values[i]=0;
+		}
+		else{
+			values[i]=meltratefactor*tanh((base[i]-bed[i])/thresholdthickness)*(upperdepthmelt-base[i]);
+		}
+	}
+
+	this->AddInput(BasalforcingsFloatingiceMeltingRateEnum,values,P1Enum);
+	xDelete<IssmDouble>(base);
+	xDelete<IssmDouble>(bed);
+	xDelete<IssmDouble>(values);
+
+}/*}}}*/
 ElementMatrix* Element::NewElementMatrix(int approximation_enum){/*{{{*/
 	return new ElementMatrix(nodes,this->GetNumberOfNodes(),this->parameters,approximation_enum);
 }
@@ -1364,103 +1776,228 @@
 	return new ElementVector(nodes,this->GetNumberOfNodes(),this->parameters,approximation_enum);
 }
 /*}}}*/
+void       Element::PositiveDegreeDay(IssmDouble* pdds,IssmDouble* pds,IssmDouble signorm,bool ismungsm){/*{{{*/
+
+	int  numvertices = this->GetNumberOfVertices();
+
+	int        i;
+	IssmDouble* agd=xNew<IssmDouble>(numvertices); // surface mass balance
+	IssmDouble* melt=xNew<IssmDouble>(numvertices); // surface mass balance
+	IssmDouble* accu=xNew<IssmDouble>(numvertices); // surface mass balance
+	IssmDouble* monthlytemperatures=xNew<IssmDouble>(12*numvertices);
+	IssmDouble* monthlyprec=xNew<IssmDouble>(12*numvertices);
+	IssmDouble* yearlytemperatures=xNew<IssmDouble>(numvertices); memset(yearlytemperatures, 0., numvertices*sizeof(IssmDouble));
+	IssmDouble* tmp=xNew<IssmDouble>(numvertices);
+	IssmDouble* h=xNew<IssmDouble>(numvertices);
+	IssmDouble* s=xNew<IssmDouble>(numvertices);
+	IssmDouble* s0p=xNew<IssmDouble>(numvertices);
+	IssmDouble* s0t=xNew<IssmDouble>(numvertices);
+	IssmDouble rho_water,rho_ice,desfac,rlaps,rlapslgm;
+	IssmDouble PfacTime,TdiffTime,sealevTime;
+	IssmDouble mavg=1./12.; //factor for monthly average
+
+	/*Get material parameters :*/
+	rho_water=this->matpar->GetMaterialParameter(MaterialsRhoSeawaterEnum);
+	rho_ice=this->matpar->GetMaterialParameter(MaterialsRhoIceEnum);
+
+	/*Get some pdd parameters*/
+	desfac=this->matpar->GetMaterialParameter(SmbDesfacEnum);
+	rlaps=this->matpar->GetMaterialParameter(SmbRlapsEnum);
+	rlapslgm=this->matpar->GetMaterialParameter(SmbRlapslgmEnum);
+
+	/*Recover monthly temperatures and precipitation and compute the yearly mean temperatures*/
+	Input*     input=this->inputs->GetInput(SmbMonthlytemperaturesEnum); _assert_(input);
+	Input*     input2=this->inputs->GetInput(SmbPrecipitationEnum); _assert_(input2);
+	IssmDouble time,yts,time_yr;
+	this->parameters->FindParam(&time,TimeEnum);
+	this->parameters->FindParam(&yts,ConstantsYtsEnum);
+	time_yr=floor(time/yts)*yts;
+
+	/*loop over vertices: */
+	Gauss* gauss=this->NewGauss();
+	for(int month=0;month<12;month++) {
+		for(int iv=0;iv<numvertices;iv++) {
+			gauss->GaussVertex(iv);
+			input->GetInputValue(&monthlytemperatures[iv*12+month],gauss,time_yr+month/12.*yts);
+			// yearlytemperatures[iv]=yearlytemperatures[iv]+monthlytemperatures[iv*12+month]*mavg; // Has to be in Kelvin
+			monthlytemperatures[iv*12+month]=monthlytemperatures[iv*12+month]-273.15; // conversion from Kelvin to celcius for PDD module
+			input2->GetInputValue(&monthlyprec[iv*12+month],gauss,time_yr+month/12.*yts);
+			monthlyprec[iv*12+month]=monthlyprec[iv*12+month]*yts;
+		}
+	}
+
+	/*Recover Pfac, Tdiff and sealev at time t:
+	 *     This parameters are used to interpolate the temperature
+	 *         and precipitaton between PD and LGM when ismungsm==1 */
+	if (ismungsm==1){
+		this->parameters->FindParam(&TdiffTime,SmbTdiffEnum,time);
+		this->parameters->FindParam(&sealevTime,SmbSealevEnum,time);
+	}
+	else {
+		TdiffTime=0;
+		sealevTime=0;
+	}
+
+	/*Recover info at the vertices: */
+	GetInputListOnVertices(&h[0],ThicknessEnum);
+	GetInputListOnVertices(&s[0],SurfaceEnum);
+	GetInputListOnVertices(&s0p[0],SmbS0pEnum);
+	GetInputListOnVertices(&s0t[0],SmbS0tEnum);
+
+	/*measure the surface mass balance*/
+	for (int iv = 0; iv<numvertices; iv++){
+		agd[iv]=PddSurfaceMassBalance(&monthlytemperatures[iv*12], &monthlyprec[iv*12],
+					pdds, pds, &melt[iv], &accu[iv], signorm, yts, h[iv], s[iv],
+					desfac, s0t[iv], s0p[iv],rlaps,rlapslgm,TdiffTime,sealevTime,
+					rho_water,rho_ice);
+	/*Get yearlytemperatures */
+		for(int month=0;month<12;month++) {
+		  yearlytemperatures[iv]=yearlytemperatures[iv]+(monthlytemperatures[iv*12+month]+273.15)*mavg; // Has to be in Kelvin
+		}
+	}
+
+	/*Update inputs*/
+	// TransientInput* NewTemperatureInput = new TransientInput(SmbMonthlytemperaturesEnum);
+	// TransientInput* NewPrecipitationInput = new TransientInput(SmbPrecipitationEnum);
+	// for (int imonth=0;imonth<12;imonth++) {
+	//   for(i=0;i<numvertices;i++) tmp[i]=monthlytemperatures[i*12+imonth];
+	//   TriaInput* newmonthinput1 = new TriaInput(SmbMonthlytemperaturesEnum,&tmp[0],P1Enum);
+	//   NewTemperatureInput->AddTimeInput(newmonthinput1,time+imonth/12.*yts);
+	//
+	//   for(i=0;i<numvertices;i++) tmp[i]=monthlyprec[i*12+imonth]/yts;
+	//   TriaInput* newmonthinput2 = new TriaInput(SmbPrecipitationEnum,&tmp[0],P1Enum);
+	//   NewPrecipitationInput->AddTimeInput(newmonthinput2,time+imonth/12.*yts);
+	// }
+	// NewTemperatureInput->Configure(this->parameters);
+	// NewPrecipitationInput->Configure(this->parameters);
+
+	switch(this->ObjectEnum()){
+		case TriaEnum:  
+		        // this->inputs->AddInput(new TriaInput(TemperatureEnum,&yearlytemperatures[0],P1Enum));
+		        this->inputs->AddInput(new TriaInput(TemperaturePDDEnum,&yearlytemperatures[0],P1Enum));
+			this->inputs->AddInput(new TriaInput(SmbMassBalanceEnum,&agd[0],P1Enum));
+			this->inputs->AddInput(new TriaInput(SmbAccumulationEnum,&accu[0],P1Enum));
+			this->inputs->AddInput(new TriaInput(SmbMeltEnum,&melt[0],P1Enum));
+			break;
+		case PentaEnum:
+		        if(IsOnSurface()){
+		              GetInputListOnVertices(&s[0],TemperatureEnum);
+		              yearlytemperatures[0] = s[0];
+		              yearlytemperatures[1] = s[1];
+		              yearlytemperatures[2] = s[2];
+		              this->inputs->AddInput(new PentaInput(TemperatureEnum,&yearlytemperatures[0],P1Enum));
+		        }
+		        this->inputs->AddInput(new PentaInput(SmbMassBalanceEnum,&agd[0],P1Enum));
+		        this->inputs->AddInput(new PentaInput(TemperaturePDDEnum,&yearlytemperatures[0],P1Enum));
+		        this->InputExtrude(TemperaturePDDEnum,-1);
+		        this->InputExtrude(SmbMassBalanceEnum,-1);
+		        break;
+		case TetraEnum: 
+		        if(IsOnSurface()){
+		              GetInputListOnVertices(&s[0],TemperatureEnum);
+		              yearlytemperatures[0] = s[0];
+		              yearlytemperatures[1] = s[1];
+		              yearlytemperatures[2] = s[2];
+		              this->inputs->AddInput(new TetraInput(TemperatureEnum,&yearlytemperatures[0],P1Enum));
+		        }
+		        this->inputs->AddInput(new TetraInput(SmbMassBalanceEnum,&agd[0],P1Enum));
+		        this->inputs->AddInput(new TetraInput(TemperaturePDDEnum,&yearlytemperatures[0],P1Enum));
+		        this->InputExtrude(TemperaturePDDEnum,-1);
+		        this->InputExtrude(SmbMassBalanceEnum,-1);
+		        break;
+		default: _error_("Not implemented yet");
+	}
+	// this->inputs->AddInput(NewTemperatureInput);
+	// this->inputs->AddInput(NewPrecipitationInput);
+	// this->inputs->AddInput(new TriaVertexInput(ThermalSpcTemperatureEnum,&Tsurf[0]));
+
+	//this->InputExtrude(SmbMassBalanceEnum,-1);
+	// this->InputExtrude(SmbMonthlytemperaturesEnum,-1);
+	// this->InputExtrude(SmbPrecipitationEnum,-1);
+
+	/*clean-up*/
+	delete gauss;
+	xDelete<IssmDouble>(monthlytemperatures);
+	xDelete<IssmDouble>(monthlyprec);
+	xDelete<IssmDouble>(agd);
+	xDelete<IssmDouble>(melt);
+	xDelete<IssmDouble>(accu);
+	xDelete<IssmDouble>(yearlytemperatures);
+	xDelete<IssmDouble>(h);
+	xDelete<IssmDouble>(s);
+	xDelete<IssmDouble>(s0t);
+	xDelete<IssmDouble>(s0p);
+	xDelete<IssmDouble>(tmp);
+
+}
+/*}}}*/
 IssmDouble Element::PureIceEnthalpy(IssmDouble pressure){/*{{{*/
 	return this->matpar->PureIceEnthalpy(pressure);
 }/*}}}*/
-void       Element::ResultInterpolation(int* pinterpolation,int* pnodesperelement,int output_enum){/*{{{*/
+void       Element::ResultInterpolation(int* pinterpolation,int* pnodesperelement,int* parray_size, int output_enum){/*{{{*/
 
+	/*Some intputs need to be computed, even if they are already in inputs, they might not be up to date!*/
+	switch(output_enum){
+		case ViscousHeatingEnum: this->ViscousHeatingCreateInput(); break;
+		case StressMaxPrincipalEnum: this->StressMaxPrincipalCreateInput(); break;
+		case StressTensorxxEnum: 
+		case StressTensorxyEnum: 
+		case StressTensorxzEnum: 
+		case StressTensoryyEnum: 
+		case StressTensoryzEnum: 
+		case StressTensorzzEnum: this->ComputeStressTensor(); break;
+		case StrainRatexxEnum:
+		case StrainRatexyEnum:
+		case StrainRatexzEnum:
+		case StrainRateyyEnum:
+		case StrainRateyzEnum:
+		case StrainRatezzEnum:
+		case StrainRateeffectiveEnum: this->ComputeStrainRate(); break;
+		case DeviatoricStressxxEnum: 
+		case DeviatoricStressxyEnum: 
+		case DeviatoricStressxzEnum: 
+		case DeviatoricStressyyEnum: 
+		case DeviatoricStressyzEnum: 
+		case DeviatoricStresszzEnum: 
+		case DeviatoricStresseffectiveEnum: this->ComputeDeviatoricStressTensor(); break;
+		case SigmaNNEnum: this->ComputeSigmaNN(); break;
+		case NewDamageEnum: this->ComputeNewDamage(); break;
+		case StressIntensityFactorEnum: this->StressIntensityFactor(); break;
+		case CalvingratexEnum:
+		case CalvingrateyEnum:
+		case CalvingCalvingrateEnum:
+			this->StrainRateparallel();
+			this->StrainRateperpendicular();
+			int calvinglaw;
+			this->FindParam(&calvinglaw,CalvingLawEnum);
+			switch(calvinglaw){
+				case DefaultCalvingEnum:
+					//do nothing
+					break;
+				case CalvingLevermannEnum:
+					this->CalvingRateLevermann();
+					break;
+				case CalvingDevEnum:
+					this->CalvingRateDev();
+					break;
+				default:
+					_error_("Calving law "<<EnumToStringx(calvinglaw)<<" not supported yet");
+			}
+			break;
+		case StrainRateparallelEnum: this->StrainRateparallel(); break;
+		case StrainRateperpendicularEnum: this->StrainRateperpendicular(); break;
+	}
+
+	/*Find input*/
 	Input* input=this->inputs->GetInput(output_enum);
 
 	/*If this input is not already in Inputs, maybe it needs to be computed?*/
-	if(!input){
-		switch(output_enum){
-			case ViscousHeatingEnum:
-				this->ViscousHeatingCreateInput();
-				input=this->inputs->GetInput(output_enum);
-				break;
-			case StressMaxPrincipalEnum:
-				this->StressMaxPrincipalCreateInput();
-				input=this->inputs->GetInput(output_enum);
-				break;
-			case StressTensorxxEnum: 
-			case StressTensorxyEnum: 
-			case StressTensorxzEnum: 
-			case StressTensoryyEnum: 
-			case StressTensoryzEnum: 
-			case StressTensorzzEnum: 
-				this->ComputeStressTensor();
-				input=this->inputs->GetInput(output_enum);
-				break;
-			case StrainRatexxEnum:
-			case StrainRatexyEnum:
-			case StrainRatexzEnum:
-			case StrainRateyyEnum:
-			case StrainRateyzEnum:
-			case StrainRatezzEnum:
-			case StrainRateeffectiveEnum:
-				this->ComputeStrainRate();
-				input=this->inputs->GetInput(output_enum);
-				break;
-			case DeviatoricStressxxEnum: 
-			case DeviatoricStressxyEnum: 
-			case DeviatoricStressxzEnum: 
-			case DeviatoricStressyyEnum: 
-			case DeviatoricStressyzEnum: 
-			case DeviatoricStresszzEnum: 
-				this->ComputeDeviatoricStressTensor();
-				input=this->inputs->GetInput(output_enum);
-				break;
-			case SigmaNNEnum: 
-				this->ComputeSigmaNN();
-				input=this->inputs->GetInput(output_enum);
-				break;
-			case NewDamageEnum:
-				this->ComputeNewDamage();
-				input=this->inputs->GetInput(output_enum);
-				break;
-			case StressIntensityFactorEnum:
-				this->StressIntensityFactor();
-				input=this->inputs->GetInput(output_enum);
-				break;
-			case CalvingratexEnum:
-			case CalvingrateyEnum:
-			case CalvingCalvingrateEnum:
-				this->StrainRateparallel();
-				this->StrainRateperpendicular();
-				int calvinglaw;
-				this->FindParam(&calvinglaw,CalvingLawEnum);
-					switch(calvinglaw){
-						case DefaultCalvingEnum:
-							//do nothing
-							break;
-						case CalvingLevermannEnum:
-							this->CalvingRateLevermann();
-							break;
-						case CalvingPiEnum:
-							this->CalvingRatePi();
-							break;
-						default:
-							_error_("Calving law "<<EnumToStringx(calvinglaw)<<" not supported yet");
-				}
-				input=this->inputs->GetInput(output_enum);
-				break;
-			case StrainRateparallelEnum:
-				this->StrainRateparallel();
-				input=this->inputs->GetInput(output_enum);
-				break;
-			case StrainRateperpendicularEnum:
-				this->StrainRateperpendicular();
-				input=this->inputs->GetInput(output_enum);
-				break;
-			default:
-				_error_("input "<<EnumToStringx(output_enum)<<" not found in element");
-		}
-	}
+	if(!input) _error_("input "<<EnumToStringx(output_enum)<<" not found in element");
 
 	/*Assign output pointer*/
-	_assert_(input);
 	*pinterpolation   = input->GetResultInterpolation();
 	*pnodesperelement = input->GetResultNumberOfNodes();
+	*parray_size      = input->GetResultArraySize();
 }/*}}}*/
 void       Element::ResultToPatch(IssmDouble* values,int nodesperelement,int output_enum){/*{{{*/
 
@@ -1470,6 +2007,14 @@
 	input->ResultToPatch(values,nodesperelement,this->Sid());
 
 } /*}}}*/
+void       Element::ResultToMatrix(IssmDouble* values,int ncols,int output_enum){/*{{{*/
+
+	Input* input=this->inputs->GetInput(output_enum);
+	if(!input) _error_("input "<<EnumToStringx(output_enum)<<" not found in element");
+
+	input->ResultToMatrix(values,ncols,this->Sid());
+
+} /*}}}*/
 void       Element::ResultToVector(Vector<IssmDouble>* vector,int output_enum){/*{{{*/
 
 	Input* input=this->inputs->GetInput(output_enum);
@@ -1594,6 +2139,311 @@
 
 }
 /*}}}*/
+void       Element::SmbGemb(){/*{{{*/
+
+	/*Intermediary variables: {{{*/
+	bool       isinitialized=false;
+	IssmDouble zTop,dzTop,zMax,zMin,zY,dzMin;
+	IssmDouble Tmean; 
+	IssmDouble C; 
+	IssmDouble Tz,Vz; 
+	IssmDouble rho_ice, rho_water,aSnow,aIce;
+	IssmDouble time,dt;
+	IssmDouble t,smb_dt;
+	IssmDouble yts;
+	IssmDouble Ta,V,dlw,dsw,P,eAir,pAir;
+	int        aIdx=0;
+	int        denIdx=0;
+	int        swIdx=0;
+	IssmDouble cldFrac,t0wet, t0dry, K;
+	IssmDouble ulw;
+	IssmDouble netSW;
+	IssmDouble netLW;
+	IssmDouble lhf, shf, dayEC;
+	IssmDouble initMass;
+    IssmDouble sumR, sumM, sumEC, sumP, sumW,sumMassAdd;
+    IssmDouble sumMass,dMass;
+	bool isgraingrowth,isalbedo,isshortwave,isthermal,isaccumulation,ismelt,isdensification,isturbulentflux;
+	IssmDouble init_scaling=1.0;
+	/*}}}*/
+	/*Output variables:{{{ */
+	IssmDouble* dz=NULL;
+	IssmDouble* d = NULL;
+	IssmDouble* re = NULL;
+	IssmDouble* gdn = NULL;
+	IssmDouble* gsp = NULL;
+	IssmDouble  EC = 0;
+	IssmDouble* W = NULL;
+	IssmDouble* a = NULL;
+	IssmDouble* swf=NULL;
+	IssmDouble* T = NULL;
+	IssmDouble  T_bottom;
+	IssmDouble  M;
+	IssmDouble  R; 
+	IssmDouble  mAdd;
+	int         m;
+	int         count=0;
+	/*}}}*/
+
+	/*only compute SMB at the surface: */
+	if (!IsOnSurface()) return;
+
+
+	/*Retrieve material properties and parameters:{{{ */
+	rho_ice = matpar->GetMaterialParameter(MaterialsRhoIceEnum);
+	rho_water = matpar->GetMaterialParameter(MaterialsRhoFreshwaterEnum);
+	parameters->FindParam(&aSnow,SmbASnowEnum);
+	parameters->FindParam(&aIce,SmbAIceEnum);
+	parameters->FindParam(&time,TimeEnum);                        /*transient core time at which we run the smb core*/
+	parameters->FindParam(&dt,TimesteppingTimeStepEnum);          /*transient core time step*/
+	parameters->FindParam(&smb_dt,SmbDtEnum);                     /*time period for the smb solution,  usually smaller than the glaciological dt*/
+	parameters->FindParam(&aIdx,SmbAIdxEnum);
+	parameters->FindParam(&denIdx,SmbDenIdxEnum);
+	parameters->FindParam(&swIdx,SmbSwIdxEnum);
+	parameters->FindParam(&cldFrac,SmbCldFracEnum);
+	parameters->FindParam(&t0wet,SmbT0wetEnum);
+	parameters->FindParam(&t0dry,SmbT0dryEnum);
+	parameters->FindParam(&K,SmbKEnum);
+	parameters->FindParam(&isgraingrowth,SmbIsgraingrowthEnum);
+	parameters->FindParam(&isalbedo,SmbIsalbedoEnum);
+	parameters->FindParam(&isshortwave,SmbIsshortwaveEnum);
+	parameters->FindParam(&isthermal,SmbIsthermalEnum);
+	parameters->FindParam(&isaccumulation,SmbIsaccumulationEnum);
+	parameters->FindParam(&ismelt,SmbIsmeltEnum);
+	parameters->FindParam(&isdensification,SmbIsdensificationEnum);
+	parameters->FindParam(&isturbulentflux,SmbIsturbulentfluxEnum);
+	parameters->FindParam(&init_scaling,SmbInitDensityScalingEnum);
+	/*}}}*/
+	/*Retrieve inputs: {{{*/
+	Input* zTop_input=this->GetInput(SmbZTopEnum); _assert_(zTop_input); 
+	Input* dzTop_input=this->GetInput(SmbDzTopEnum); _assert_(dzTop_input); 
+	Input* dzMin_input=this->GetInput(SmbDzMinEnum); _assert_(dzMin_input); 
+	Input* zMax_input=this->GetInput(SmbZMaxEnum); _assert_(zMax_input); 
+	Input* zMin_input=this->GetInput(SmbZMinEnum); _assert_(zMin_input); 
+	Input* zY_input=this->GetInput(SmbZYEnum); _assert_(zY_input); 
+	Input* Tmean_input=this->GetInput(SmbTmeanEnum); _assert_(Tmean_input);
+	Input* C_input=this->GetInput(SmbCEnum); _assert_(C_input);
+	Input* Tz_input=this->GetInput(SmbTzEnum); _assert_(Tz_input);
+	Input* Vz_input=this->GetInput(SmbVzEnum); _assert_(Vz_input);
+	Input* Ta_input=this->GetInput(SmbTaEnum); _assert_(Ta_input);
+	Input* V_input=this->GetInput(SmbVEnum); _assert_(V_input);
+	Input* Dlwr_input=this->GetInput(SmbDlwrfEnum); _assert_(Dlwr_input);
+	Input* Dswr_input=this->GetInput(SmbDswrfEnum); _assert_(Dswr_input);
+	Input* P_input=this->GetInput(SmbPEnum); _assert_(P_input);
+	Input* eAir_input=this->GetInput(SmbEAirEnum); _assert_(eAir_input);
+	Input* pAir_input=this->GetInput(SmbPAirEnum); _assert_(pAir_input);
+	Input* isinitialized_input=this->inputs->GetInput(SmbIsInitializedEnum); 
+	
+	/*Retrieve input values:*/
+	Gauss* gauss=this->NewGauss(1); gauss->GaussPoint(0);
+
+	zTop_input->GetInputValue(&zTop,gauss);
+	dzTop_input->GetInputValue(&dzTop,gauss);
+	dzMin_input->GetInputValue(&dzMin,gauss);
+	zMax_input->GetInputValue(&zMax,gauss); 
+	zMin_input->GetInputValue(&zMin,gauss); 
+	zY_input->GetInputValue(&zY,gauss);
+	Tmean_input->GetInputValue(&Tmean,gauss);
+	C_input->GetInputValue(&C,gauss);
+	Tz_input->GetInputValue(&Tz,gauss);
+	Vz_input->GetInputValue(&Vz,gauss);
+	/*}}}*/
+
+	/*First, check that the initial structures have been setup in GEMB. If not, initialize profile variables: layer thickness dz, * density d, temperature T, etc. {{{*/
+	if(!isinitialized_input){
+
+		if(VerboseSmb() && this->Sid()==0)_printf0_("smb core: Initializing grid\n");
+		GembgridInitialize(&dz, &m, zTop, dzTop, zMax, zY);
+		//if(this->Sid()==1) for(int i=0;i<m;i++)_printf_("z[" << i << "]=" <<
+		//dz[i] << "\n");
+
+		/*initialize profile variables:*/
+		d = xNewZeroInit<IssmDouble>(m); for(int i=0;i<m;i++)d[i]=rho_ice*init_scaling; //ice density scaled by a factor
+		re = xNewZeroInit<IssmDouble>(m); for(int i=0;i<m;i++)re[i]=2.5;         //set grain size to old snow [mm] 
+		gdn = xNewZeroInit<IssmDouble>(m); for(int i=0;i<m;i++)gdn[i]=0;         //set grain dentricity to old snow 
+		gsp = xNewZeroInit<IssmDouble>(m); for(int i=0;i<m;i++)gsp[i]=0;         //set grain sphericity to old snow 
+		EC = 0;                                                                //surface evaporation (-) condensation (+) [kg m-2] 
+		W = xNewZeroInit<IssmDouble>(m); for(int i=0;i<m;i++)W[i]=0;             //set water content to zero [kg m-2]
+		a = xNewZeroInit<IssmDouble>(m); for(int i=0;i<m;i++)a[i]=aSnow;         //set albedo equal to fresh snow [fraction] 
+		T = xNewZeroInit<IssmDouble>(m); for(int i=0;i<m;i++)T[i]=Tmean;         //set initial grid cell temperature to the annual mean temperature [K]
+
+		//fixed lower temperatuer bounday condition - T is fixed
+		T_bottom=T[m-1];
+
+		/*Flag the initialization:*/
+		this->AddInput(new BoolInput(SmbIsInitializedEnum,true));
+	} 
+	else{ 
+		/*Recover inputs: */
+		DoubleArrayInput* dz_input= dynamic_cast<DoubleArrayInput*>(this->GetInput(SmbDzEnum)); _assert_(dz_input);
+		DoubleArrayInput* d_input= dynamic_cast<DoubleArrayInput*>(this->GetInput(SmbDEnum));_assert_(d_input);
+		DoubleArrayInput* re_input= dynamic_cast<DoubleArrayInput*>(this->GetInput(SmbReEnum));_assert_(re_input);
+		DoubleArrayInput* gdn_input= dynamic_cast<DoubleArrayInput*>(this->GetInput(SmbGdnEnum));_assert_(gdn_input);
+		DoubleArrayInput* gsp_input= dynamic_cast<DoubleArrayInput*>(this->GetInput(SmbGspEnum));_assert_(gsp_input);
+		DoubleInput* EC_input= dynamic_cast<DoubleInput*>(this->GetInput(SmbECEnum));_assert_(EC_input);
+		DoubleArrayInput* W_input= dynamic_cast<DoubleArrayInput*>(this->GetInput(SmbWEnum));_assert_(W_input);
+		DoubleArrayInput* a_input= dynamic_cast<DoubleArrayInput*>(this->GetInput(SmbAEnum));_assert_(a_input);
+		DoubleArrayInput* T_input= dynamic_cast<DoubleArrayInput*>(this->GetInput(SmbTEnum));_assert_(T_input);
+		
+		/*Recover arrays: */
+		dz_input->GetValues(&dz,&m);
+		d_input->GetValues(&d,&m);
+		re_input->GetValues(&re,&m);
+		gdn_input->GetValues(&gdn,&m);
+		gsp_input->GetValues(&gsp,&m);
+		EC_input->GetInputValue(&EC);
+		W_input->GetValues(&W,&m);
+		a_input->GetValues(&a,&m);
+		T_input->GetValues(&T,&m);
+		
+		//fixed lower temperatuer bounday condition - T is fixed
+		T_bottom=T[m-1];
+
+	} /*}}}*/
+
+	// determine initial mass [kg]
+	initMass=0; for(int i=0;i<m;i++) initMass += dz[i]*d[i] + W[i];
+    
+    // initialize cumulative variables
+    sumR = 0; sumM = 0; sumEC = 0; sumP = 0; sumMassAdd = 0;
+
+	//before starting loop, realize that the transient core runs this smb_core at time = time +deltaT. 
+	//go back to time - deltaT: 
+	time-=dt;
+
+	/*Start loop: */
+	count=1;
+	for (t=time;t<=time+dt;t=t+smb_dt){
+
+		if(VerboseSmb() && this->Sid()==0 && IssmComm::GetRank()==0)_printf0_("Time: t=" << setprecision(8) << t/365.0/24.0/3600.0 << " yr/" << (time+dt)/365.0/24.0/3600.0 << " yr" << setprecision(3) << " Step: " << count << "\n");
+
+		/*extract daily data:{{{*/
+		Ta_input->GetInputValue(&Ta,gauss,t);//screen level air temperature [K]
+		V_input->GetInputValue(&V,gauss,t);  //wind speed [m s-1]
+		Dlwr_input->GetInputValue(&dlw,gauss,t);   //downward longwave radiation flux [W m-2]
+		Dswr_input->GetInputValue(&dsw,gauss,t);   //downward shortwave radiation flux [W m-2]
+		P_input->GetInputValue(&P,gauss,t);        //precipitation [kg m-2]
+		eAir_input->GetInputValue(&eAir,gauss,t);  //screen level vapor pressure [Pa]
+		pAir_input->GetInputValue(&pAir,gauss,t);  // screen level air pressure [Pa]
+		//_printf_("Time: " << t << " Ta: " << Ta << " V: " << V << " dlw: " << dlw << " dsw: " << dsw << " P: " << P << " eAir: " << eAir << " pAir: " << pAir << "\n");
+		/*}}}*/
+
+		/*Snow grain metamorphism:*/
+		if(isgraingrowth)grainGrowth(re, gdn, gsp, T, dz, d, W, smb_dt, m, aIdx,this->Sid());
+
+		/*Snow, firn and ice albedo:*/
+		if(isalbedo)albedo(a,aIdx,re,d,cldFrac,aIce, aSnow,T,W,P,EC,t0wet,t0dry,K,smb_dt,m,this->Sid());
+		
+					
+		/*Distribution of absorbed short wave radation with depth:*/
+        if(isshortwave)shortwave(&swf, swIdx, aIdx, dsw, a[0], d, dz, re,m,this->Sid());
+		
+		/*Calculate net shortwave [W m-2]*/
+        netSW = cellsum(swf,m);
+
+		/*Thermal profile computation:*/
+        if(isthermal)thermo(&EC, T, dz, d, swf, dlw, Ta, V, eAir, pAir, W[0], smb_dt, m, Vz, Tz,this->Sid());     
+
+		/*Change in thickness of top cell due to evaporation/condensation  assuming same density as top cell. 
+		 * need to fix this in case all or more of cell evaporates */
+        dz[0] = dz[0] + EC / d[0];
+		
+		/*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, Ta, P, dzMin, aSnow,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, &R, &mAdd, &T, &d, &dz, &W, &a, &re, &gdn, &gsp, &m, dzMin, zMax, zMin,this->Sid());
+
+		/*Allow non-melt densification and determine compaction [m]*/
+        if(isdensification)densification(d,dz, T, re, denIdx, C, smb_dt, Tmean,rho_ice,m,this->Sid());
+		
+		/*Calculate upward longwave radiation flux [W m-2] not used in energy balance. Calculated for every 
+		 * sub-time step in thermo equations*/
+        ulw = 5.67E-8 * pow(T[0],4.0);
+
+		/*Calculate net longwave [W m-2]*/
+        netLW = dlw - ulw;
+		
+		/*Calculate turbulent heat fluxes [W m-2]*/
+        if(isturbulentflux)turbulentFlux(&shf, &lhf, &dayEC, Ta, T[0], V, eAir, pAir, d[0], W[0], Vz, Tz,this->Sid());
+		
+		/*Verbose some resuls in debug mode: {{{*/
+		if(VerboseSmb() && 0){ 
+			_printf_("smb log: count[" << count << "] m[" << m << "] " 
+				<< setprecision(16)   << "T[" << cellsum(T,m)  << "] " 
+					                  << "d[" << cellsum(d,m)  << "] "
+					                  << "dz[" << cellsum(dz,m)  << "] "
+					                  << "a[" << cellsum(a,m)  << "] "
+					                  << "W[" << cellsum(W,m)  << "] "
+					                  << "re[" << cellsum(re,m)  << "] "
+					                  << "gdn[" << cellsum(gdn,m)  << "] "
+					                  << "gsp[" << cellsum(gsp,m)  << "] "
+					                  << "swf[" << netSW << "] "
+									  << "\n");
+		} /*}}}*/
+		
+		/*Sum component mass changes [kg m-2]*/
+        sumMassAdd = mAdd + sumMassAdd;
+        sumM = M + sumM;
+        sumR = R + sumR;
+        sumW = cellsum(W,m);
+        sumP = P +  sumP;
+        sumEC = sumEC + EC;  // evap (-)/cond(+)
+
+		/*Calculate total system mass:*/
+        sumMass=0; for(int i=0;i<m;i++) sumMass += dz[i]*d[i];
+
+        #ifndef _HAVE_ADOLC_ //we want to avoid the round operation at all cost. Not differentiable.
+        dMass = sumMass + sumR + sumW - sumP - sumEC - initMass - sumMassAdd;
+		dMass = round(dMass * 100.0)/100.0;
+
+		/*Check mass conservation:*/
+        if (dMass != 0.0) _printf_("total system mass not conserved in MB function");
+		#endif
+		
+		/*Check bottom grid cell T is unchanged:*/
+        if (T[m-1]!=T_bottom) _printf_("T(end)~=T_bottom" << "\n");
+		
+		/*Free ressources: */
+		xDelete<IssmDouble>(swf);
+
+		/*increase counter:*/
+		count++;
+
+	} //for (t=time;t<=time+dt;t=t+smb_dt)
+
+
+	/*Save generated inputs: */
+	this->AddInput(new DoubleArrayInput(SmbDzEnum,dz,m));
+	this->AddInput(new DoubleArrayInput(SmbDEnum,d,m));
+	this->AddInput(new DoubleArrayInput(SmbReEnum,re,m));
+	this->AddInput(new DoubleArrayInput(SmbGdnEnum,gdn,m));
+	this->AddInput(new DoubleArrayInput(SmbGspEnum,gsp,m));
+	this->AddInput(new DoubleArrayInput(SmbTEnum,T,m));
+	this->AddInput(new DoubleInput(SmbECEnum,EC));
+	this->AddInput(new DoubleArrayInput(SmbWEnum,W,m));
+	this->AddInput(new DoubleArrayInput(SmbAEnum,a,m));
+	this->AddInput(new DoubleInput(SmbMassBalanceEnum,(sumP + sumEC -sumR)/rho_water/dt));
+	this->AddInput(new DoubleInput(SmbRunoffEnum,sumR/rho_water/dt));
+	this->AddInput(new DoubleInput(SmbPrecipitationEnum,sumP/rho_water/dt));
+	this->AddInput(new DoubleInput(SmbCondensationEnum,sumEC/rho_water/dt));
+
+
+
+	/*Free allocations:{{{*/
+	xDelete<IssmDouble>(dz);
+	xDelete<IssmDouble>(d);
+	xDelete<IssmDouble>(re);
+	xDelete<IssmDouble>(gdn);
+	xDelete<IssmDouble>(gsp);
+	xDelete<IssmDouble>(W);
+	xDelete<IssmDouble>(a);
+	xDelete<IssmDouble>(T);
+	delete gauss;
+	/*}}}*/
+}
+/*}}}*/
 void       Element::StrainRateFS(IssmDouble* epsilon,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input,Input* vz_input){/*{{{*/
 	/*Compute the 3d Strain Rate (6 components):
 	 *
@@ -1793,6 +2643,7 @@
 
 	/*Clean up and return*/
 	xDelete<IssmDouble>(maxprincipal);
+	xDelete<IssmDouble>(xyz_list);
 	delete gauss;
 }
 /*}}}*/
@@ -2222,6 +3073,7 @@
 
 	/*Clean up and return*/
 	xDelete<IssmDouble>(viscousheating);
+	xDelete<IssmDouble>(xyz_list);
 	delete gauss;
 }
 /*}}}*/

Modified: issm/trunk/src/c/classes/Elements/Element.h
===================================================================
--- issm/trunk/src/c/classes/Elements/Element.h	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/classes/Elements/Element.h	2016-04-13 04:32:01 UTC (rev 20500)
@@ -65,6 +65,9 @@
 		void               DeepEcho();
 		void               DeleteInput(int input_enum);
 		void               DeleteMaterials(void);
+		void               Delta18oParameterization(void);
+		void               MungsmtpParameterization(void);
+		void               Delta18opdParameterization(void);
 		IssmDouble         Divergence(void);
 		void               dViscositydBFS(IssmDouble* pdmudB,int dim,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input,Input* vz_input);
 		void               dViscositydBHO(IssmDouble* pdmudB,int dim,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input);
@@ -115,18 +118,26 @@
 		void               InputUpdateFromConstant(bool constant, int name);
 		bool               IsFloating(); 
 		bool               IsIceInElement();
+		bool               IsWaterInElement();
+		bool               IsLandInElement();
 		bool	             IsInput(int name);
 		void               LinearFloatingiceMeltingRate(); 
+		void               MantlePlumeGeothermalFlux(); 
+		void               MarshallElement(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction,int numanalyses);
 		void               MigrateGroundingLine(IssmDouble* sheet_ungrounding);
+		void               MismipFloatingiceMeltingRate(); 
 		ElementMatrix*     NewElementMatrix(int approximation_enum=NoneApproximationEnum);
 		ElementMatrix*     NewElementMatrixCoupling(int number_nodes,int approximation_enum=NoneApproximationEnum);
 		ElementVector*     NewElementVector(int approximation_enum=NoneApproximationEnum);
+		void               PositiveDegreeDay(IssmDouble* pdds,IssmDouble* pds,IssmDouble signorm,bool ismungsm);
 		IssmDouble         PureIceEnthalpy(IssmDouble pressure);
-		void               ResultInterpolation(int* pinterpolation,int*nodesperelement,int output_enum);
+		void               ResultInterpolation(int* pinterpolation,int*nodesperelement,int* parray_size, int output_enum);
 		void               ResultToPatch(IssmDouble* values,int nodesperelement,int output_enum);
+		void               ResultToMatrix(IssmDouble* values,int ncols,int output_enum);
 		void               ResultToVector(Vector<IssmDouble>* vector,int output_enum);
 		void               SetwiseNodeConnectivity(int* d_nz,int* o_nz,Node* node,bool* flags,int* flagsindices,int set1_enum,int set2_enum);
 		int                Sid();
+		void               SmbGemb();
 		void               StrainRateFS(IssmDouble* epsilon,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input,Input* vz_input);
 		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);
@@ -169,8 +180,9 @@
 		virtual void       AddInput(int input_enum, IssmDouble* values, int interpolation_enum)=0;
 		virtual void       AverageOntoPartition(Vector<IssmDouble>* partition_contributions,Vector<IssmDouble>* partition_areas,IssmDouble* vertex_response,IssmDouble* qmu_part)=0;
 		virtual void	    CalvingRateLevermann(void)=0;
-		virtual void       CalvingRatePi(void)=0;
 		virtual void       CalvingRateDev(void){_error_("not implemented yet");};
+		virtual void       WriteLevelsetSegment(DataSet* segments){_error_("not implemented yet");};
+		virtual void       ResetLevelsetFromSegmentlist(IssmDouble* segments,int numsegments){_error_("not implemented yet");};
 		virtual IssmDouble CharacteristicLength(void)=0;
 		virtual void       ComputeBasalStress(Vector<IssmDouble>* sigma_b)=0;
 		virtual void       ComputeDeviatoricStressTensor(void)=0;
@@ -179,11 +191,10 @@
 		virtual void       Configure(Elements* elements,Loads* loads,Nodes* nodes,Vertices* vertices,Materials* materials,Parameters* parameters)=0;
 		virtual void       ControlInputSetGradient(IssmDouble* gradient,int enum_type,int control_index)=0;
 		virtual void       ControlToVectors(Vector<IssmPDouble>* vector_control, Vector<IssmPDouble>* vector_gradient,int control_enum)=0;
-		virtual void       Delta18oParameterization(void)=0;
-		virtual void       MungsmtpParameterization(void)=0;
 		virtual void       ElementResponse(IssmDouble* presponse,int response_enum)=0;
 		virtual void       ElementSizes(IssmDouble* phx,IssmDouble* phy,IssmDouble* phz)=0;
 		virtual int        FiniteElement(void)=0;
+		virtual IssmDouble FloatingArea(void)=0;
 		virtual void       FSContactMigration(Vector<IssmDouble>* vertexgrounded,Vector<IssmDouble>* vertexfloating)=0;
 		virtual Element*   GetBasalElement(void)=0;
 		virtual int        GetElementType(void)=0;
@@ -203,6 +214,7 @@
 		virtual void       GetVectorFromControlInputs(Vector<IssmDouble>* gradient,int control_enum,int control_index,const char* data,bool onsid)=0;
 		virtual void       GetVerticesCoordinatesBase(IssmDouble** xyz_list)=0;
 		virtual void       GetVerticesCoordinatesTop(IssmDouble** xyz_list)=0;
+		virtual IssmDouble GroundedArea(void)=0;
 		virtual IssmDouble IceMass(void)=0;
 		virtual IssmDouble IceVolume(void)=0;
 		virtual IssmDouble IceVolumeAboveFloatation(void)=0;
@@ -223,6 +235,7 @@
 		virtual void       JacobianDeterminantLine(IssmDouble* Jdet, IssmDouble* xyz_list,Gauss* gauss)=0;
 		virtual void       JacobianDeterminantSurface(IssmDouble* Jdet, IssmDouble* xyz_list,Gauss* gauss)=0;
 		virtual void       JacobianDeterminantTop(IssmDouble* Jdet,IssmDouble* xyz_list_base,Gauss* gauss)=0;
+		virtual void       Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction)=0;
 		virtual IssmDouble Masscon(IssmDouble* levelset)=0;
 		virtual IssmDouble MassFlux(IssmDouble* segment)=0;
 		virtual IssmDouble MassFlux(IssmDouble x1,IssmDouble y1, IssmDouble x2, IssmDouble y2,int segment_id)=0;
@@ -253,7 +266,6 @@
 		virtual void       NormalTop(IssmDouble* normal,IssmDouble* xyz_list)=0;
 		virtual int        NumberofNodesPressure(void)=0;
 		virtual int        NumberofNodesVelocity(void)=0;
-		virtual void       PositiveDegreeDay(IssmDouble* pdds,IssmDouble* pds,IssmDouble signorm,bool ismungsm)=0;
 		virtual void       PotentialUngrounding(Vector<IssmDouble>* potential_sheet_ungrounding)=0;
 		virtual int        PressureInterpolation()=0;
 		virtual void       ReduceMatrices(ElementMatrix* Ke,ElementVector* pe)=0;
@@ -271,6 +283,8 @@
 		virtual IssmDouble SurfaceArea(void)=0;
 		virtual int        TensorInterpolation()=0;
 		virtual IssmDouble TimeAdapt()=0;
+		virtual IssmDouble TotalFloatingBmb(void)=0;
+		virtual IssmDouble TotalGroundedBmb(void)=0;
 		virtual IssmDouble TotalSmb(void)=0;
 		virtual void       Update(int index, IoModel* iomodel,int analysis_counter,int analysis_type,int finite_element)=0;
 		virtual void       UpdateConstraintsExtrudeFromBase(void)=0;
@@ -287,5 +301,13 @@
 		#ifdef _HAVE_GIA_
 		virtual void       GiaDeflection(Vector<IssmDouble>* wg,Vector<IssmDouble>* dwgdt,IssmDouble* x,IssmDouble* y)=0;
 		#endif
+		#ifdef _HAVE_SEALEVELRISE_
+		virtual void          SealevelriseEustatic(Vector<IssmDouble>* pSgi,IssmDouble* peustatic,IssmDouble* latitude,IssmDouble* longitude,IssmDouble* radius,IssmDouble oceanarea,IssmDouble eartharea)=0;
+		virtual void          SealevelriseNonEustatic(Vector<IssmDouble>* pSgo,IssmDouble* Sg_old,IssmDouble* latitude,IssmDouble* longitude,IssmDouble* radius,IssmDouble oceanarea,IssmDouble eartharea)=0;
+		virtual IssmDouble    OceanAverage(IssmDouble* Sg)=0;
+		virtual IssmDouble    OceanArea(void)=0;
+		virtual IssmDouble    GetArea3D(void)=0;
+		#endif
+
 };
 #endif

Modified: issm/trunk/src/c/classes/Elements/ElementHook.cpp
===================================================================
--- issm/trunk/src/c/classes/Elements/ElementHook.cpp	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/classes/Elements/ElementHook.cpp	2016-04-13 04:32:01 UTC (rev 20500)
@@ -73,7 +73,68 @@
 
 }
 /*}}}*/
+void ElementHook::Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ /*{{{*/
 
+	int i;
+	bool* hnodesi_null=NULL; /*intermediary needed*/
+	bool  hnodes_null=true; /*this could be NULL on empty constructor*/
+	bool  hneighbors_null=true; /*don't deal with hneighbors, unless explicitely asked to*/
+
+	_assert_(this);
+
+	/*preliminary, before marshall starts: */
+	if(marshall_direction==MARSHALLING_FORWARD || marshall_direction==MARSHALLING_SIZE){
+		if(this->hneighbors)hneighbors_null=false;
+		if(this->hnodes){
+			hnodes_null=false;
+			hnodesi_null=xNew<bool>(numanalyses);
+			for(i=0;i<numanalyses;i++){
+				if(this->hnodes[i])hnodesi_null[i]=false;
+				else hnodesi_null[i]=true;
+			}
+		}
+	}
+
+	/*ok, marshall operations: */
+	MARSHALLING_ENUM(ElementHookEnum);
+	MARSHALLING(numanalyses);
+	MARSHALLING(hneighbors_null);
+	MARSHALLING(hnodes_null);
+	MARSHALLING_DYNAMIC(hnodesi_null,bool,numanalyses);
+
+	if(marshall_direction==MARSHALLING_BACKWARD){
+		
+		if (!hnodes_null)this->hnodes = new Hook*[numanalyses];
+		else this->hnodes=NULL;
+		this->hvertices   = new Hook();
+		this->hmaterial   = new Hook();
+		this->hmatpar     = new Hook();
+		if(!hneighbors_null)this->hneighbors  = new Hook();
+		else this->hneighbors=NULL;
+
+		/*Initialize hnodes: */
+		if (this->hnodes){
+			for(int i=0;i<this->numanalyses;i++){
+				if(!hnodesi_null[i])this->hnodes[i]=new Hook();
+				else this->hnodes[i]=NULL;
+			}
+		}
+	}
+
+	if (this->hnodes){ 
+		for (i=0;i<numanalyses;i++) if(this->hnodes[i])this->hnodes[i]->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
+	}
+	this->hvertices->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
+	this->hmaterial->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
+	this->hmatpar->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
+	if(this->hneighbors)this->hneighbors->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
+
+	/*Free ressources: */
+	if(hnodesi_null) xDelete<bool>(hnodesi_null);
+
+}
+/*}}}*/
+
 void ElementHook::InitHookNeighbors(int* element_ids){/*{{{*/
 	this->hneighbors=new Hook(element_ids,2);
 }

Modified: issm/trunk/src/c/classes/Elements/ElementHook.h
===================================================================
--- issm/trunk/src/c/classes/Elements/ElementHook.h	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/classes/Elements/ElementHook.h	2016-04-13 04:32:01 UTC (rev 20500)
@@ -22,6 +22,7 @@
 		ElementHook();
 		ElementHook(int in_numanalyses,int material_id,int numvertices,IoModel* iomodel);
 		~ElementHook();
+		void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction);
 
 		void InitHookNeighbors(int* element_ids);               //3d only
 		void SetHookNodes(int* node_ids,int numnodes,int analysis_counter);

Modified: issm/trunk/src/c/classes/Elements/Penta.cpp
===================================================================
--- issm/trunk/src/c/classes/Elements/Penta.cpp	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/classes/Elements/Penta.cpp	2016-04-13 04:32:01 UTC (rev 20500)
@@ -122,7 +122,23 @@
 
 }
 /*}}}*/
+void Penta::Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ /*{{{*/
 
+	MARSHALLING_ENUM(PentaEnum);
+
+	/*Call parent classes: */
+	ElementHook::Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
+	Element::MarshallElement(pmarshalled_data,pmarshalled_data_size,marshall_direction,this->numanalyses);
+	PentaRef::Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
+
+	vertices = (Vertex**)this->hvertices->deliverp();
+	material = (Material*)this->hmaterial->delivers();
+	matpar   = (Matpar*)this->hmatpar->delivers();
+	verticalneighbors = (Penta**)this->hneighbors->deliverp();
+
+}
+/*}}}*/
+
 /*Other*/
 void       Penta::AddBasalInput(int input_enum,IssmDouble* values, int interpolation_enum){/*{{{*/
 
@@ -214,81 +230,6 @@
 
 }
 /*}}}*/
-void       Penta::CalvingRatePi(){/*{{{*/
-
-	IssmDouble  xyz_list[NUMVERTICES][3];
-	GaussPenta* gauss=NULL;
-	IssmDouble  vx,vy,vel;
-	IssmDouble  strainparallel;
-	IssmDouble  sxx;
-	IssmDouble  sxy;
-	IssmDouble  syy;
-	IssmDouble  sigVM;
-	IssmDouble  thickness;
-	IssmDouble  base;
-	IssmDouble  hAB;
-	IssmDouble  propcoeff;
-	IssmDouble  calvingratex[NUMVERTICES];
-	IssmDouble  calvingratey[NUMVERTICES];
-	IssmDouble  calvingrate[NUMVERTICES];
-
-
-	/* Get node coordinates and dof list: */
-	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
-
-	/*Retrieve all inputs and parameters we will need*/
-	Input* vx_input=inputs->GetInput(VxEnum);                                                    _assert_(vx_input);
-	Input* vy_input=inputs->GetInput(VyEnum);                                                    _assert_(vy_input);
-	Input* strainparallel_input=inputs->GetInput(StrainRateparallelEnum);                        _assert_(strainparallel_input);
-	Input* sxx_input=inputs->GetInput(DeviatoricStressxxEnum);                                   _assert_(sxx_input);
-	Input* sxy_input=inputs->GetInput(DeviatoricStressxyEnum);                                   _assert_(sxy_input);
-	Input* syy_input=inputs->GetInput(DeviatoricStressyyEnum);                                   _assert_(syy_input);
-	Input* thickness_input=inputs->GetInput(ThicknessEnum);                                      _assert_(thickness_input);
-	Input* base_input=inputs->GetInput(BaseEnum);                                                _assert_(base_input);
-	Input* picoeff_input=inputs->GetInput(CalvingpiCoeffEnum);                                   _assert_(picoeff_input);
-
-	/* Start looping on the number of vertices: */
-	gauss=new GaussPenta();
-	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);
-		vel=vx*vx+vy*vy;
-		strainparallel_input->GetInputValue(&strainparallel,gauss);
-		sxx_input->GetInputValue(&sxx,gauss);
-		sxy_input->GetInputValue(&sxy,gauss);
-		syy_input->GetInputValue(&syy,gauss);
-		thickness_input->GetInputValue(&thickness,gauss);
-		base_input->GetInputValue(&base,gauss);
-		picoeff_input->GetInputValue(&propcoeff,gauss);
-
-		/* Computing sigma Von Mises*/
-		sigVM=sqrt(sxx*sxx+syy*syy+3*sxy*sxy-sxx*syy);
-
-		/* Computing heigth above buoyancy*/
-		hAB=thickness+1028/920*base;
-
-		/*Calving rate for Pi criterion proportionnal to the product of the strain rate along the ice flow direction and the Von Mises stress and the square of the glacier width (hardcoded) divided by the height above buoyancy and the max of the ice velocity power 3 and the ice density (ignored here)*/
-		calvingrate[iv]=propcoeff*strainparallel*sigVM*25.e6/hAB/1e9;
-		if(calvingrate[iv]<0){
-			calvingrate[iv]=0;
-		}
-		calvingratex[iv]=calvingrate[iv]*vx/(sqrt(vel)+1.e-6);
-		calvingratey[iv]=calvingrate[iv]*vy/(sqrt(vel)+1.e-6);
-	}
-
-	/*Add input*/
-	this->inputs->AddInput(new PentaInput(CalvingratexEnum,&calvingratex[0],P1Enum));
-	this->inputs->AddInput(new PentaInput(CalvingrateyEnum,&calvingratey[0],P1Enum));
-	this->inputs->AddInput(new PentaInput(CalvingCalvingrateEnum,&calvingrate[0],P1Enum));
-
-	/*Clean up and return*/
-	delete gauss;
-
-}
-/*}}}*/
 void       Penta::ComputeBasalStress(Vector<IssmDouble>* sigma_b){/*{{{*/
 
 	int         i,j;
@@ -579,146 +520,6 @@
 	vector_gradient->SetValues(NUMVERTICES,&sidlist[0],&gradients[0],ADD_VAL);
 
 }/*}}}*/
-void       Penta::Delta18oParameterization(void){/*{{{*/
-
-	/*Are we on the base? If not, return*/
-	if(!IsOnBase()) return;
-
-	int        i;
-	IssmDouble monthlytemperatures[NUMVERTICES][12],monthlyprec[NUMVERTICES][12];
-	IssmDouble TemperaturesPresentday[NUMVERTICES][12],TemperaturesLgm[NUMVERTICES][12];
-	IssmDouble PrecipitationsPresentday[NUMVERTICES][12];
-	IssmDouble tmp[NUMVERTICES];
-	IssmDouble Delta18oPresent,Delta18oLgm,Delta18oTime;
-	IssmDouble Delta18oSurfacePresent,Delta18oSurfaceLgm,Delta18oSurfaceTime;
-	IssmDouble time,yts,finaltime;
-	this->parameters->FindParam(&time,TimeEnum);
-	this->parameters->FindParam(&yts,ConstantsYtsEnum);
-	this->parameters->FindParam(&finaltime,TimesteppingFinalTimeEnum);
-
-	/*Recover present day temperature and precipitation*/
-	Input*     input=inputs->GetInput(SurfaceforcingsTemperaturesPresentdayEnum);    _assert_(input);
-	Input*     input2=inputs->GetInput(SurfaceforcingsTemperaturesLgmEnum);          _assert_(input2);
-	Input*     input3=inputs->GetInput(SurfaceforcingsPrecipitationsPresentdayEnum); _assert_(input3);
-	GaussPenta* gauss=new GaussPenta();
-	for(int month=0;month<12;month++) {
-		for(int iv=0;iv<NUMVERTICES;iv++) {
-			gauss->GaussVertex(iv);
-			input->GetInputValue(&TemperaturesPresentday[iv][month],gauss,month/12.*yts);
-			input2->GetInputValue(&TemperaturesLgm[iv][month],gauss,month/12.*yts);
-			input3->GetInputValue(&PrecipitationsPresentday[iv][month],gauss,month/12.*yts);
-		}
-	}
-
-	/*Recover delta18o and Delta18oSurface at present day, lgm and at time t*/
-	this->parameters->FindParam(&Delta18oPresent,SurfaceforcingsDelta18oEnum,finaltime);
-	this->parameters->FindParam(&Delta18oLgm,SurfaceforcingsDelta18oEnum,finaltime-(21000*yts));
-	this->parameters->FindParam(&Delta18oTime,SurfaceforcingsDelta18oEnum,time);
-	this->parameters->FindParam(&Delta18oSurfacePresent,SurfaceforcingsDelta18oSurfaceEnum,finaltime);
-	this->parameters->FindParam(&Delta18oSurfaceLgm,SurfaceforcingsDelta18oSurfaceEnum,finaltime-(21000*yts));
-	this->parameters->FindParam(&Delta18oSurfaceTime,SurfaceforcingsDelta18oSurfaceEnum,time);
-
-	/*Compute the temperature and precipitation*/
-	for(int iv=0;iv<NUMVERTICES;iv++){
-		ComputeDelta18oTemperaturePrecipitation(Delta18oSurfacePresent, Delta18oSurfaceLgm, Delta18oSurfaceTime, 
-					Delta18oPresent, Delta18oLgm, Delta18oTime,
-					&PrecipitationsPresentday[iv][0], 
-					&TemperaturesLgm[iv][0], &TemperaturesPresentday[iv][0], 
-					&monthlytemperatures[iv][0], &monthlyprec[iv][0]);
-	}
-
-	/*Update inputs*/ 
-	TransientInput* NewTemperatureInput = new TransientInput(SurfaceforcingsMonthlytemperaturesEnum);
-	TransientInput* NewPrecipitationInput = new TransientInput(SurfaceforcingsPrecipitationEnum);
-	for (int imonth=0;imonth<12;imonth++) {
-		for(i=0;i<NUMVERTICES;i++) tmp[i]=monthlytemperatures[i][imonth];
-		PentaInput* newmonthinput1 = new PentaInput(SurfaceforcingsMonthlytemperaturesEnum,&tmp[0],P1Enum);
-		NewTemperatureInput->AddTimeInput(newmonthinput1,time+imonth/12.*yts);
-
-		for(i=0;i<NUMVERTICES;i++) tmp[i]=monthlyprec[i][imonth];
-		PentaInput* newmonthinput2 = new PentaInput(SurfaceforcingsPrecipitationEnum,&tmp[0],P1Enum);
-		NewPrecipitationInput->AddTimeInput(newmonthinput2,time+imonth/12.*yts);
-	}
-	NewTemperatureInput->Configure(this->parameters);
-	NewPrecipitationInput->Configure(this->parameters);
-
-	this->inputs->AddInput(NewTemperatureInput);
-	this->inputs->AddInput(NewPrecipitationInput);
-
-	this->InputExtrude(SurfaceforcingsMonthlytemperaturesEnum,-1);
-	this->InputExtrude(SurfaceforcingsPrecipitationEnum,-1);
-
-	/*clean-up*/
-	delete gauss;
-}
-/*}}}*/
-void       Penta::MungsmtpParameterization(void){/*{{{*/
-	/*Are we on the base? If not, return*/
-	if(!IsOnBase()) return;
-
-	int        i;
-	IssmDouble monthlytemperatures[NUMVERTICES][12],monthlyprec[NUMVERTICES][12];
-	IssmDouble TemperaturesPresentday[NUMVERTICES][12],TemperaturesLgm[NUMVERTICES][12];
-	IssmDouble PrecipitationsPresentday[NUMVERTICES][12],PrecipitationsLgm[NUMVERTICES][12];
-	IssmDouble tmp[NUMVERTICES];
-	IssmDouble TdiffTime,PfacTime;
-	IssmDouble time,yts;
-	this->parameters->FindParam(&time,TimeEnum);
-	this->parameters->FindParam(&yts,ConstantsYtsEnum);
-
-	/*Recover present day temperature and precipitation*/
-	Input*     input=inputs->GetInput(SurfaceforcingsTemperaturesPresentdayEnum);    _assert_(input);
-	Input*     input2=inputs->GetInput(SurfaceforcingsTemperaturesLgmEnum);          _assert_(input2);
-	Input*     input3=inputs->GetInput(SurfaceforcingsPrecipitationsPresentdayEnum); _assert_(input3);
-	Input*     input4=inputs->GetInput(SurfaceforcingsPrecipitationsLgmEnum);        _assert_(input4);
-	GaussPenta* gauss=new GaussPenta();
-	for(int month=0;month<12;month++) {
-		for(int iv=0;iv<NUMVERTICES;iv++) {
-			gauss->GaussVertex(iv);
-			input->GetInputValue(&TemperaturesPresentday[iv][month],gauss,month/12.*yts);
-			input2->GetInputValue(&TemperaturesLgm[iv][month],gauss,month/12.*yts);
-			input3->GetInputValue(&PrecipitationsPresentday[iv][month],gauss,month/12.*yts);
-			input4->GetInputValue(&PrecipitationsLgm[iv][month],gauss,month/12.*yts);
-		}
-	}
-
-	/*Recover interpolation parameters at time t*/
-	this->parameters->FindParam(&TdiffTime,SurfaceforcingsTdiffEnum,time);
-	this->parameters->FindParam(&PfacTime,SurfaceforcingsPfacEnum,time);
-
-	/*Compute the temperature and precipitation*/
-	for(int iv=0;iv<NUMVERTICES;iv++){
-	  ComputeMungsmTemperaturePrecipitation(TdiffTime,PfacTime,
-					&PrecipitationsLgm[iv][0],&PrecipitationsPresentday[iv][0], 
-					&TemperaturesLgm[iv][0], &TemperaturesPresentday[iv][0], 
-					&monthlytemperatures[iv][0], &monthlyprec[iv][0]);
-	}
-
-	/*Update inputs*/ 
-	TransientInput* NewTemperatureInput = new TransientInput(SurfaceforcingsMonthlytemperaturesEnum);
-	TransientInput* NewPrecipitationInput = new TransientInput(SurfaceforcingsPrecipitationEnum);
-	for (int imonth=0;imonth<12;imonth++) {
-		for(i=0;i<NUMVERTICES;i++) tmp[i]=monthlytemperatures[i][imonth];
-		PentaInput* newmonthinput1 = new PentaInput(SurfaceforcingsMonthlytemperaturesEnum,&tmp[0],P1Enum);
-		NewTemperatureInput->AddTimeInput(newmonthinput1,time+imonth/12.*yts);
-	
-		for(i=0;i<NUMVERTICES;i++) tmp[i]=monthlyprec[i][imonth];
-		PentaInput* newmonthinput2 = new PentaInput(SurfaceforcingsPrecipitationEnum,&tmp[0],P1Enum);
-		NewPrecipitationInput->AddTimeInput(newmonthinput2,time+imonth/12.*yts);
-	}
-	NewTemperatureInput->Configure(this->parameters);
-	NewPrecipitationInput->Configure(this->parameters);
-
-	this->inputs->AddInput(NewTemperatureInput);
-	this->inputs->AddInput(NewPrecipitationInput);
-	
-	this->InputExtrude(SurfaceforcingsMonthlytemperaturesEnum,-1);
-	this->InputExtrude(SurfaceforcingsPrecipitationEnum,-1);
-
-	/*clean-up*/
-	delete gauss;
-}
-/*}}}*/
 void       Penta::ElementResponse(IssmDouble* presponse,int response_enum){/*{{{*/
 
 	switch(response_enum){
@@ -778,6 +579,27 @@
 	return this->element_type;
 }
 /*}}}*/
+IssmDouble Penta::FloatingArea(void){/*{{{*/
+
+	/*Intermediaries*/
+	int         domaintype;
+	IssmDouble  phi,base_area;
+	IssmDouble  xyz_list[NUMVERTICES][3];
+
+	if(!IsIceInElement() || !IsOnBase())return 0.;
+
+	/*Get problem dimension*/
+	this->FindParam(&domaintype,DomainTypeEnum);
+	if(domaintype!=Domain3DEnum) _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+
+	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+	phi=this->GetGroundedPortion(&xyz_list[0][0]);
+	base_area= 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]));
+
+	/*Clean up and return*/
+	return (1-phi)*base_area;
+}
+/*}}}*/
 void       Penta::FSContactMigration(Vector<IssmDouble>* vertexgrounded,Vector<IssmDouble>* vertexfloating){/*{{{*/
 
 	if(!IsOnBase()) return;
@@ -1286,6 +1108,27 @@
 	*pxyz_list = xyz_list;
 
 }/*}}}*/
+IssmDouble Penta::GroundedArea(void){/*{{{*/
+
+	/*Intermediaries*/
+	int         domaintype;
+	IssmDouble  phi,base_area;
+	IssmDouble  xyz_list[NUMVERTICES][3];
+
+	if(!IsIceInElement() || !IsOnBase())return 0.;
+
+	/*Get problem dimension*/
+	this->FindParam(&domaintype,DomainTypeEnum);
+	if(domaintype!=Domain3DEnum) _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+
+	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+	phi=this->GetGroundedPortion(&xyz_list[0][0]);
+	base_area= 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]));
+
+	/*Clean up and return*/
+	return phi*base_area;
+}
+/*}}}*/
 IssmDouble Penta::IceMass(void){/*{{{*/
 
 	IssmDouble rho_ice; 
@@ -1969,6 +1812,10 @@
 	return new GaussPenta(area_coordinates,order_horiz,order_vert);
 }
 /*}}}*/
+Gauss*     Penta::NewGauss(int point1,IssmDouble fraction1,IssmDouble fraction2,bool mainlyfloating,int order){/*{{{*/
+	return new GaussPenta(point1,fraction1,fraction2,mainlyfloating,order);
+}
+/*}}}*/
 Gauss*     Penta::NewGaussBase(int order){/*{{{*/
 	return new GaussPenta(0,1,2,order);
 }
@@ -2160,98 +2007,6 @@
 
 }
 /*}}}*/
-void       Penta::PositiveDegreeDay(IssmDouble* pdds,IssmDouble* pds,IssmDouble signorm,bool ismungsm){/*{{{*/
-
-   int        i;
-   IssmDouble agd[NUMVERTICES];             // surface mass balance
-   IssmDouble monthlytemperatures[NUMVERTICES][12],monthlyprec[NUMVERTICES][12];
-   IssmDouble tmp[NUMVERTICES];
-   IssmDouble h[NUMVERTICES],s[NUMVERTICES];
-   IssmDouble rho_water,rho_ice,desfac,s0p,s0t,rlaps,rlapslgm;
-   IssmDouble PfacTime,TdiffTime,sealevTime;
-
-   /*Get material parameters :*/
-   rho_water=matpar->GetMaterialParameter(MaterialsRhoSeawaterEnum);
-   rho_ice=matpar->GetMaterialParameter(MaterialsRhoIceEnum);
-
-  /*Get some pdd parameters*/
-  desfac=matpar->GetMaterialParameter(SurfaceforcingsDesfacEnum);
-  s0p=matpar->GetMaterialParameter(SurfaceforcingsS0pEnum);
-  s0t=matpar->GetMaterialParameter(SurfaceforcingsS0tEnum);
-  rlaps=matpar->GetMaterialParameter(SurfaceforcingsRlapsEnum);
-  rlapslgm=matpar->GetMaterialParameter(SurfaceforcingsRlapslgmEnum);
-
-   /*Recover monthly temperatures and precipitation*/
-   Input*     input=inputs->GetInput(SurfaceforcingsMonthlytemperaturesEnum); _assert_(input);
-   Input*     input2=inputs->GetInput(SurfaceforcingsPrecipitationEnum); _assert_(input2);
-   GaussPenta* gauss=new GaussPenta();
-   IssmDouble time,yts;
-   this->parameters->FindParam(&time,TimeEnum);
-   this->parameters->FindParam(&yts,ConstantsYtsEnum);
-   
-   for(int month=0;month<12;month++) {
-     for(int iv=0;iv<NUMVERTICES;iv++) {
-       gauss->GaussVertex(iv);
-       input->GetInputValue(&monthlytemperatures[iv][month],gauss,time+month/12.*yts);
-       monthlytemperatures[iv][month]=monthlytemperatures[iv][month]-273.15; // conversion from Kelvin to celcius
-       input2->GetInputValue(&monthlyprec[iv][month],gauss,time+month/12.*yts);
-     }
-   } 
-
-  /*Recover Pfac, Tdiff and sealev at time t:
-    This parameters are used to interpolate the temperature 
-    and precipitaton between PD and LGM when ismungsm==1 */ 
-  if (ismungsm==1){  
-    this->parameters->FindParam(&TdiffTime,SurfaceforcingsTdiffEnum,time);
-    this->parameters->FindParam(&sealevTime,SurfaceforcingsSealevEnum,time);
-  }
-  else {
-    TdiffTime=0;
-    sealevTime=0;  
-  }
-
-  /*Recover info at the vertices: */
-  GetInputListOnVertices(&h[0],ThicknessEnum);
-  GetInputListOnVertices(&s[0],SurfaceEnum); 
-
-
-   /*measure the surface mass balance*/
-   for (int iv = 0; iv < NUMVERTICES; iv++){
-     agd[iv]=PddSurfaceMassBalance(&monthlytemperatures[iv][0], &monthlyprec[iv][0],  
-				  pdds,pds, signorm, yts, h[iv], s[iv],
-				  desfac, s0t, s0p,rlaps,rlapslgm,TdiffTime,sealevTime,
-				  rho_water,rho_ice);
-   }
-
-   /*Update inputs*/    
-   // TransientInput* NewTemperatureInput = new TransientInput(SurfaceforcingsMonthlytemperaturesEnum);
-   // TransientInput* NewPrecipitationInput = new TransientInput(SurfaceforcingsPrecipitationEnum);
-   // for (int imonth=0;imonth<12;imonth++) {
-   //   for(i=0;i<NUMVERTICES;i++) tmp[i]=monthlytemperatures[i][imonth];
-   //   PentaInput* newmonthinput1 = new PentaInput(SurfaceforcingsMonthlytemperaturesEnum,&tmp[0],P1Enum);
-   //   NewTemperatureInput->AddTimeInput(newmonthinput1,time+imonth/12.*yts);
-   // 
-   //   for(i=0;i<NUMVERTICES;i++) tmp[i]=monthlyprec[i][imonth];
-   //   PentaInput* newmonthinput2 = new PentaInput(SurfaceforcingsPrecipitationEnum,&tmp[0],P1Enum);
-   //   NewPrecipitationInput->AddTimeInput(newmonthinput2,time+imonth/12.*yts);
-   // }
-   // NewTemperatureInput->Configure(this->parameters);
-   // NewPrecipitationInput->Configure(this->parameters);
-
-
-
-   this->inputs->AddInput(new PentaInput(SurfaceforcingsMassBalanceEnum,&agd[0],P1Enum));
-   // this->inputs->AddInput(NewTemperatureInput);
-   // this->inputs->AddInput(NewPrecipitationInput);
-   // //this->inputs->AddInput(new PentaVertexInput(ThermalSpcTemperatureEnum,&Tsurf[0]));
-    this->InputExtrude(SurfaceforcingsMassBalanceEnum,-1);
-   // this->InputExtrude(SurfaceforcingsMonthlytemperaturesEnum,-1);
-   // this->InputExtrude(SurfaceforcingsPrecipitationEnum,-1);
-
-   /*clean-up*/
-   delete gauss;
-}
-/*}}}*/
 void       Penta::PotentialUngrounding(Vector<IssmDouble>* potential_ungrounding){/*{{{*/
 
 	IssmDouble  h[NUMVERTICES],r[NUMVERTICES],gl[NUMVERTICES];
@@ -2805,10 +2560,84 @@
 	dz=maxz-minz;
 
 	/*CFL criterion: */
-	dt=C/(maxabsvy/dx+maxabsvy/dy+maxabsvz/dz);
+	dt=C/(maxabsvx/dx+maxabsvy/dy+maxabsvz/dz);
 
 	return dt;
 }/*}}}*/
+IssmDouble Penta::TotalFloatingBmb(void){/*{{{*/
+
+	/*The fbmb[kg yr-1] of one element is area[m2] * melting_rate [kg m^-2 yr^-1]*/
+	int        point1;
+	bool       mainlyfloating;
+	IssmDouble fbmb=0;
+	IssmDouble rho_ice,fraction1,fraction2,floatingmelt,Jdet;
+	IssmDouble Total_Fbmb=0;
+	IssmDouble xyz_list[NUMVERTICES][3];
+	Gauss*     gauss     = NULL;
+
+   if(!IsIceInElement() || !IsOnBase())return 0;
+
+	/*Get material parameters :*/
+	rho_ice=matpar->GetMaterialParameter(MaterialsRhoIceEnum);
+	Input* floatingmelt_input = this->GetInput(BasalforcingsFloatingiceMeltingRateEnum); _assert_(floatingmelt_input); 
+	Input* gllevelset_input = this->GetInput(MaskGroundediceLevelsetEnum); _assert_(gllevelset_input);
+	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+
+	this->GetGroundedPart(&point1,&fraction1,&fraction2,&mainlyfloating);
+	/* Start  looping on the number of gaussian points: */
+	gauss = this->NewGauss(point1,fraction1,fraction2,1-mainlyfloating,3);
+	for(int ig=gauss->begin();ig<gauss->end();ig++){
+
+		gauss->GaussPoint(ig);
+		this->JacobianDeterminantBase(&Jdet,&xyz_list[0][0],gauss);
+		floatingmelt_input->GetInputValue(&floatingmelt,gauss);
+		fbmb+=floatingmelt*Jdet*gauss->weight;
+	}
+
+   Total_Fbmb=rho_ice*fbmb;	        // from volume to mass
+
+	/*Return: */
+	delete gauss;
+	return Total_Fbmb;
+}
+/*}}}*/
+IssmDouble Penta::TotalGroundedBmb(void){/*{{{*/
+
+	/*The gbmb[kg yr-1] of one element is area[m2] * gounded melting rate [kg m^-2 yr^-1]*/
+	int        point1;
+	bool       mainlyfloating;
+	IssmDouble gbmb=0;
+	IssmDouble rho_ice,fraction1,fraction2,groundedmelt,Jdet;
+	IssmDouble Total_Gbmb=0;
+	IssmDouble xyz_list[NUMVERTICES][3];
+	Gauss*     gauss     = NULL;
+
+   if(!IsIceInElement() || !IsOnBase())return 0;
+
+	/*Get material parameters :*/
+	rho_ice=matpar->GetMaterialParameter(MaterialsRhoIceEnum);
+	Input* groundedmelt_input = this->GetInput(BasalforcingsGroundediceMeltingRateEnum); _assert_(groundedmelt_input); 
+	Input* gllevelset_input = this->GetInput(MaskGroundediceLevelsetEnum); _assert_(gllevelset_input);
+	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+
+	this->GetGroundedPart(&point1,&fraction1,&fraction2,&mainlyfloating);
+	/* Start  looping on the number of gaussian points: */
+	gauss = this->NewGauss(point1,fraction1,fraction2,mainlyfloating,3);
+	for(int ig=gauss->begin();ig<gauss->end();ig++){
+
+		gauss->GaussPoint(ig);
+		this->JacobianDeterminantBase(&Jdet,&xyz_list[0][0],gauss);
+		groundedmelt_input->GetInputValue(&groundedmelt,gauss);
+		gbmb+=groundedmelt*Jdet*gauss->weight;
+	}
+
+   Total_Gbmb=rho_ice*gbmb;	        // from volume to mass
+
+	/*Return: */
+	delete gauss;
+	return Total_Gbmb;
+}
+/*}}}*/
 IssmDouble Penta::TotalSmb(void){/*{{{*/
 
 	/*The smb[Gt yr-1] of one element is area[m2] * smb [ m ice yr^-1] * rho_ice [kg m-3] / 1e+10^12 */
@@ -2829,7 +2658,7 @@
 	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]));
 
 	/*Now get the average SMB over the element*/
-	Input* smb_input = inputs->GetInput(SurfaceforcingsMassBalanceEnum); _assert_(smb_input);
+	Input* smb_input = inputs->GetInput(SmbMassBalanceEnum); _assert_(smb_input);
 
 	smb_input->GetInputAverage(&smb);
 	Total_Smb=rho_ice*base*smb;// smb on element in kg s-1

Modified: issm/trunk/src/c/classes/Elements/Penta.h
===================================================================
--- issm/trunk/src/c/classes/Elements/Penta.h	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/classes/Elements/Penta.h	2016-04-13 04:32:01 UTC (rev 20500)
@@ -41,6 +41,7 @@
 		/*Object virtual functions definitions: {{{*/
 		Object *copy();
 		int     ObjectEnum();
+		void    Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction);
 		/*}}}*/
 		/*Penta routines:{{{*/
 		void           AddBasalInput(int input_enum, IssmDouble* values, int interpolation_enum);
@@ -48,7 +49,6 @@
 		void           AverageOntoPartition(Vector<IssmDouble>* partition_contributions,Vector<IssmDouble>* partition_areas,IssmDouble* vertex_response,IssmDouble* qmu_part);
 		IssmDouble     CharacteristicLength(void){_error_("not implemented yet");};
 		void           CalvingRateLevermann();
-		void           CalvingRatePi();
 		void           ComputeBasalStress(Vector<IssmDouble>* sigma_b);
 		void           ComputeDeviatoricStressTensor();
 		void           ComputeSigmaNN(){_error_("not implemented yet");};
@@ -57,11 +57,10 @@
 		void           ControlInputSetGradient(IssmDouble* gradient,int enum_type,int control_index);
 		void           ControlToVectors(Vector<IssmPDouble>* vector_control, Vector<IssmPDouble>* vector_gradient,int control_enum);
 		ElementMatrix* CreateBasalMassMatrix(void);
-		void           Delta18oParameterization(void);
-		void           MungsmtpParameterization(void);
 		void           ElementResponse(IssmDouble* presponse,int response_enum);
 		void           ElementSizes(IssmDouble* hx,IssmDouble* hy,IssmDouble* hz);
 		int            FiniteElement(void);
+		IssmDouble     FloatingArea(void);
 		void           FSContactMigration(Vector<IssmDouble>* vertexgrounded,Vector<IssmDouble>* vertexfloating);
 		void           GetAreaCoordinates(IssmDouble *area_coordinates,IssmDouble* xyz_zero,IssmDouble* xyz_list,int numpoints);
 		Element*       GetBasalElement(void);
@@ -86,6 +85,7 @@
 		void           GetVectorFromControlInputs(Vector<IssmDouble>* gradient,int control_enum,int control_index,const char* data,bool onsid);
 		void           GetVerticesCoordinatesBase(IssmDouble** pxyz_list);
 		void           GetVerticesCoordinatesTop(IssmDouble** pxyz_list);
+		IssmDouble     GroundedArea(void);
 		IssmDouble     IceMass(void);
 		IssmDouble     IceVolume(void);
 		IssmDouble     IceVolumeAboveFloatation(void);
@@ -118,7 +118,7 @@
 		Gauss*         NewGauss(int order);
 		Gauss*         NewGauss(IssmDouble* xyz_list, IssmDouble* xyz_list_front,int order){_error_("not implemented yet");};
 		Gauss*         NewGauss(IssmDouble* xyz_list, IssmDouble* xyz_list_front,int order_horiz,int order_vert);
-		Gauss*         NewGauss(int point1,IssmDouble fraction1,IssmDouble fraction2,bool mainlyfloating,int order){_error_("not implemented yet");};
+		Gauss*         NewGauss(int point1,IssmDouble fraction1,IssmDouble fraction2,bool mainlyfloating,int order);
 		Gauss*         NewGaussBase(int order);
 		Gauss*         NewGaussLine(int vertex1,int vertex2,int order);
 		Gauss*         NewGaussTop(int order);
@@ -138,7 +138,6 @@
 		int            NodalValue(IssmDouble* pvalue, int index, int natureofdataenum);
 		int            NumberofNodesPressure(void);
 		int            NumberofNodesVelocity(void);
-		void           PositiveDegreeDay(IssmDouble* pdds,IssmDouble* pds,IssmDouble signorm,bool ismungsm);
 		void           PotentialUngrounding(Vector<IssmDouble>* potential_sheet_ungrounding);
 		int            PressureInterpolation();
 		void           ReduceMatrices(ElementMatrix* Ke,ElementVector* pe);
@@ -158,6 +157,8 @@
 		IssmDouble     SurfaceArea(void);
 		int            TensorInterpolation(){_error_("not implemented yet");};
 		IssmDouble     TimeAdapt();
+		IssmDouble     TotalFloatingBmb(void);
+		IssmDouble     TotalGroundedBmb(void);
 		IssmDouble     TotalSmb(void);
 		void           Update(int index, IoModel* iomodel,int analysis_counter,int analysis_type,int finitelement);
 		void           UpdateConstraintsExtrudeFromBase(void);
@@ -170,6 +171,7 @@
 		void           VerticalSegmentIndices(int** pindices,int* pnumseg);
 		void           ViscousHeating(IssmDouble* pphi,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input,Input* vz_input);
 		void           ZeroLevelsetCoordinates(IssmDouble** pxyz_zero,IssmDouble* xyz_list,int levelsetenum);
+		IssmDouble     GetArea3D(void){_error_("not implemented yet!");};
 
 		#ifdef _HAVE_DAKOTA_
 		void           InputUpdateFromVectorDakota(IssmDouble* vector, int name, int type);
@@ -179,6 +181,13 @@
 		#ifdef _HAVE_GIA_
 		void           GiaDeflection(Vector<IssmDouble>* wg,Vector<IssmDouble>* dwgdt,IssmDouble* x,IssmDouble* y);
 		#endif
+		#ifdef _HAVE_SEALEVELRISE_
+		void    SealevelriseEustatic(Vector<IssmDouble>* pSgi,IssmDouble* peustatic,IssmDouble* latitude,IssmDouble* longitude,IssmDouble* radius,IssmDouble oceanarea,IssmDouble eartharea){_error_("not implemented yet!");};
+		void    SealevelriseNonEustatic(Vector<IssmDouble>* pSgo,IssmDouble* Sg_old,IssmDouble* latitude,IssmDouble* longitude,IssmDouble* radius,IssmDouble oceanarea,IssmDouble eartharea){_error_("not implemented yet!");};
+		IssmDouble    OceanArea(void){_error_("not implemented yet!");};
+		IssmDouble    OceanAverage(IssmDouble* Sg){_error_("not implemented yet!");};
+		#endif
+
 		/*}}}*/
 };
 #endif  /* _PENTA_H */

Modified: issm/trunk/src/c/classes/Elements/PentaRef.h
===================================================================
--- issm/trunk/src/c/classes/Elements/PentaRef.h	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/classes/Elements/PentaRef.h	2016-04-13 04:32:01 UTC (rev 20500)
@@ -32,5 +32,6 @@
 		void SurfaceNodeIndices(int* pnumindices,int** pindices,int finiteelement);
 		int  TensorInterpolation(int fe_stokes);
 		int  VelocityInterpolation(int fe_stokes);
+		void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ /*do nothing */};
 };
 #endif

Modified: issm/trunk/src/c/classes/Elements/Seg.cpp
===================================================================
--- issm/trunk/src/c/classes/Elements/Seg.cpp	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/classes/Elements/Seg.cpp	2016-04-13 04:32:01 UTC (rev 20500)
@@ -46,10 +46,82 @@
 }
 /*}}}*/
 Object* Seg::copy(){/*{{{*/
-	_error_("not implemented yet");
+
+	int i;
+	Seg* seg=NULL;
+
+	seg=new Seg();
+
+	//deal with TriaRef mother class
+	int nanalyses = this->numanalyses;
+	if(nanalyses > 0){
+		seg->element_type_list=xNew<int>(nanalyses);
+		for(i=0;i<nanalyses;i++){
+			if (this->element_type_list[i]) seg->element_type_list[i]=this->element_type_list[i];
+			else seg->element_type_list[i] = 0;
+		}
+	}
+	else seg->element_type_list = NULL;
+	seg->element_type=this->element_type;
+	seg->numanalyses=nanalyses;
+
+	//deal with ElementHook mother class
+	if (this->hnodes){
+		seg->hnodes=xNew<Hook*>(seg->numanalyses);
+		for(i=0;i<seg->numanalyses;i++){
+			if (this->hnodes[i]) seg->hnodes[i] = (Hook*)(this->hnodes[i]->copy());
+			else seg->hnodes[i] = NULL;
+		}
+	}
+	else seg->hnodes = NULL;
+
+	seg->hvertices = (Hook*)this->hvertices->copy();
+	seg->hmaterial = (Hook*)this->hmaterial->copy();
+	seg->hmatpar   = (Hook*)this->hmatpar->copy();
+	seg->hneighbors = NULL;
+
+	/*deal with Element fields: */
+	seg->id  = this->id;
+	seg->sid = this->sid;
+	if(this->inputs) seg->inputs = (Inputs*)(this->inputs->Copy());
+	else seg->inputs=new Inputs();
+
+	/*point parameters: */
+	seg->parameters=this->parameters;
+
+	/*recover objects: */
+	if (this->nodes){
+		unsigned int num_nodes = 3;
+		seg->nodes = xNew<Node*>(num_nodes); //we cannot rely on an analysis_counter to tell us which analysis_type we are running, so we just copy the nodes.
+		for(i=0;i<num_nodes;i++) if(this->nodes[i]) seg->nodes[i]=this->nodes[i]; else seg->nodes[i] = NULL;
+	}
+	else seg->nodes = NULL;
+
+	seg->vertices = (Vertex**)this->hvertices->deliverp();
+	seg->material = (Material*)this->hmaterial->delivers();
+	seg->matpar   = (Matpar*)this->hmatpar->delivers();
+
+	return seg;
+
+
 }
 /*}}}*/
+void Seg::Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ /*{{{*/
 
+	MARSHALLING_ENUM(SegEnum);
+
+	/*Call parent classes: */
+	ElementHook::Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
+	Element::MarshallElement(pmarshalled_data,pmarshalled_data_size,marshall_direction,this->numanalyses);
+	SegRef::Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
+
+	vertices = (Vertex**)this->hvertices->deliverp();
+	material = (Material*)this->hmaterial->delivers();
+	matpar   = (Matpar*)this->hmatpar->delivers();
+
+}
+/*}}}*/
+
 IssmDouble Seg::CharacteristicLength(void){/*{{{*/
 
 	IssmDouble xyz_list[NUMVERTICES][3];

Modified: issm/trunk/src/c/classes/Elements/Seg.h
===================================================================
--- issm/trunk/src/c/classes/Elements/Seg.h	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/classes/Elements/Seg.h	2016-04-13 04:32:01 UTC (rev 20500)
@@ -37,6 +37,7 @@
 		/*Object virtual functions definitions:{{{ */
 		int     ObjectEnum();
 		Object *copy();
+		void    Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction);
 		/*}}}*/
 		/*Element virtual functions definitions: {{{*/
 		void        AddBasalInput(int input_enum, IssmDouble* values, int interpolation_enum){_error_("not implemented yet");};
@@ -48,16 +49,14 @@
 		void        ComputeDeviatoricStressTensor(){_error_("not implemented yet");};
 		void        ComputeSigmaNN(){_error_("not implemented yet");};
 		void        ComputeStressTensor(){_error_("not implemented yet");};
-		void        CalvingRatePi(void){_error_("not implemented yet");};
 		void        Configure(Elements* elements,Loads* loads,Nodes* nodesin,Vertices* verticesin,Materials* materials,Parameters* parameters){_error_("not implemented yet");};
 		void        ControlInputSetGradient(IssmDouble* gradient,int enum_type,int control_index){_error_("not implemented yet");};
 		void        ControlToVectors(Vector<IssmPDouble>* vector_control, Vector<IssmPDouble>* vector_gradient,int control_enum){_error_("not implemented yet");};
-		void        Delta18oParameterization(void){_error_("not implemented yet");};
-		void        MungsmtpParameterization(void){_error_("not implemented yet");};
 		void        ElementResponse(IssmDouble* presponse,int response_enum){_error_("not implemented yet");};
 		void        ElementSizes(IssmDouble* hx,IssmDouble* hy,IssmDouble* hz){_error_("not implemented yet");};
+		int         FiniteElement(void);
+		IssmDouble  FloatingArea(void){_error_("not implemented yet");};
 		void        FSContactMigration(Vector<IssmDouble>* vertexgrounded,Vector<IssmDouble>* vertexfloating){_error_("not implemented yet");};
-		int         FiniteElement(void);
 		Element*    GetBasalElement(void){_error_("not implemented yet");};
 		int         GetElementType(void){_error_("not implemented yet");};
 		void        GetGroundedPart(int* point1,IssmDouble* fraction1, IssmDouble* fraction2,bool* mainlyfloating){_error_("not implemented yet");};
@@ -77,6 +76,7 @@
 		void        GetVerticesCoordinates(IssmDouble** pxyz_list);
 		void        GetVerticesCoordinatesBase(IssmDouble** pxyz_list){_error_("not implemented yet");};
 		void        GetVerticesCoordinatesTop(IssmDouble** pxyz_list){_error_("not implemented yet");};
+		IssmDouble  GroundedArea(void){_error_("not implemented yet");};
 		IssmDouble  IceMass(void){_error_("not implemented yet");};
 		IssmDouble  IceVolume(void){_error_("not implemented yet");};
 		IssmDouble  IceVolumeAboveFloatation(void){_error_("not implemented yet");};
@@ -130,7 +130,6 @@
 		void        NormalTop(IssmDouble* normal,IssmDouble* xyz_list){_error_("not implemented yet");};
 		int         NumberofNodesPressure(void){_error_("not implemented yet");};
 		int         NumberofNodesVelocity(void){_error_("not implemented yet");};
-		void        PositiveDegreeDay(IssmDouble* pdds,IssmDouble* pds,IssmDouble signorm,bool ismungsm){_error_("not implemented yet");};
 		void        PotentialUngrounding(Vector<IssmDouble>* potential_sheet_ungrounding){_error_("not implemented yet");};
 		int         PressureInterpolation(void){_error_("not implemented yet");};
 		void        ReduceMatrices(ElementMatrix* Ke,ElementVector* pe){_error_("not implemented yet");};
@@ -148,6 +147,8 @@
 		IssmDouble  SurfaceArea(void){_error_("not implemented yet");};
 		int         TensorInterpolation(void){_error_("not implemented yet");};
 		IssmDouble  TimeAdapt(){_error_("not implemented yet");};
+		IssmDouble  TotalFloatingBmb(void){_error_("not implemented yet");};
+		IssmDouble  TotalGroundedBmb(void){_error_("not implemented yet");};
 		IssmDouble  TotalSmb(void){_error_("not implemented yet");};
 		void        Update(int index, IoModel* iomodel,int analysis_counter,int analysis_type,int finitelement){_error_("not implemented yet");};
 		void        UpdateConstraintsExtrudeFromBase(){_error_("not implemented");};
@@ -160,11 +161,19 @@
 		void        VerticalSegmentIndices(int** pindices,int* pnumseg){_error_("not implemented yet");};
 		void        ViscousHeating(IssmDouble* pphi,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input,Input* vz_input){_error_("not implemented yet");};
 		void        ZeroLevelsetCoordinates(IssmDouble** pxyz_zero,IssmDouble* xyz_list,int levelsetenum){_error_("not implemented");};
+		IssmDouble     GetArea3D(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
 
+#ifdef _HAVE_SEALEVELRISE_
+		void    SealevelriseEustatic(Vector<IssmDouble>* pSgi,IssmDouble* peustatic,IssmDouble* latitude,IssmDouble* longitude,IssmDouble* radius,IssmDouble oceanarea,IssmDouble eartharea){_error_("not implemented yet!");};
+		void    SealevelriseNonEustatic(Vector<IssmDouble>* pSgo,IssmDouble* Sg_old,IssmDouble* latitude,IssmDouble* longitude,IssmDouble* radius,IssmDouble oceanarea,IssmDouble eartharea){_error_("not implemented yet!");};
+		IssmDouble    OceanArea(void){_error_("not implemented yet!");};
+		IssmDouble    OceanAverage(IssmDouble* Sg){_error_("not implemented yet!");};
+#endif
+
 #ifdef _HAVE_DAKOTA_
 		void        InputUpdateFromMatrixDakota(IssmDouble* matrix, int nows, int ncols, int name, int type){_error_("not implemented yet");};
 		void        InputUpdateFromVectorDakota(IssmDouble* vector, int name, int type){_error_("not implemented yet");};

Modified: issm/trunk/src/c/classes/Elements/SegRef.h
===================================================================
--- issm/trunk/src/c/classes/Elements/SegRef.h	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/classes/Elements/SegRef.h	2016-04-13 04:32:01 UTC (rev 20500)
@@ -24,5 +24,6 @@
 		void GetNodalFunctionsDerivatives(IssmDouble* dbasis,IssmDouble* xyz_list, GaussSeg* gauss,int finiteelement);
 		void GetNodalFunctionsDerivativesReference(IssmDouble* dbasis,GaussSeg* gauss,int finiteelement);
 		int  NumberofNodes(int finiteelement);
+		void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ /*do nothing */};
 };
 #endif

Modified: issm/trunk/src/c/classes/Elements/Tetra.cpp
===================================================================
--- issm/trunk/src/c/classes/Elements/Tetra.cpp	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/classes/Elements/Tetra.cpp	2016-04-13 04:32:01 UTC (rev 20500)
@@ -91,7 +91,7 @@
 	tetra->parameters=this->parameters;
 
 	/*recover objects: */
-	unsigned int num_nodes = 3;
+	unsigned int num_nodes = 4;
 	tetra->nodes = xNew<Node*>(num_nodes); //we cannot rely on an analysis_counter to tell us which analysis_type we are running, so we just copy the nodes.
 	for(i=0;i<num_nodes;i++) if(this->nodes[i]) tetra->nodes[i]=this->nodes[i]; else tetra->nodes[i] = NULL;
 
@@ -102,7 +102,22 @@
 	return tetra;
 }
 /*}}}*/
+void Tetra::Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ /*{{{*/
 
+	MARSHALLING_ENUM(TetraEnum);
+
+	/*Call parent classes: */
+	ElementHook::Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
+	Element::MarshallElement(pmarshalled_data,pmarshalled_data_size,marshall_direction,this->numanalyses);
+	TetraRef::Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
+
+	vertices = (Vertex**)this->hvertices->deliverp();
+	material = (Material*)this->hmaterial->delivers();
+	matpar   = (Matpar*)this->hmatpar->delivers();
+
+}
+/*}}}*/
+
 void     Tetra::AddInput(int input_enum,IssmDouble* values, int interpolation_enum){/*{{{*/
 
 	/*Call inputs method*/

Modified: issm/trunk/src/c/classes/Elements/Tetra.h
===================================================================
--- issm/trunk/src/c/classes/Elements/Tetra.h	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/classes/Elements/Tetra.h	2016-04-13 04:32:01 UTC (rev 20500)
@@ -37,6 +37,7 @@
 		/*Object virtual functions definitions:{{{ */
 		int     ObjectEnum();
 		Object *copy();
+		void    Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction);
 		/*}}}*/
 		/*Element virtual functions definitions: {{{*/
 		void        AddBasalInput(int input_enum, IssmDouble* values, int interpolation_enum){_error_("not implemented yet");};
@@ -48,12 +49,9 @@
 		void        ComputeSigmaNN(){_error_("not implemented yet");};
 		void        ComputeStressTensor(){_error_("not implemented yet");};
 		void        ComputeDeviatoricStressTensor(){_error_("not implemented yet");};
-		void        CalvingRatePi(void){_error_("not implemented yet");};
 		void        Configure(Elements* elements,Loads* loads,Nodes* nodesin,Vertices* verticesin,Materials* materials,Parameters* parameters);
 		void        ControlInputSetGradient(IssmDouble* gradient,int enum_type,int control_index){_error_("not implemented yet");};
 		void        ControlToVectors(Vector<IssmPDouble>* vector_control, Vector<IssmPDouble>* vector_gradient,int control_enum){_error_("not implemented yet");};
-		void        Delta18oParameterization(void){_error_("not implemented yet");};
-		void        MungsmtpParameterization(void){_error_("not implemented yet");};
 		IssmDouble  DragCoefficientAbsGradient(void){_error_("not implemented yet");};
 		void        ElementResponse(IssmDouble* presponse,int response_enum){_error_("not implemented yet");};
 		void        ElementSizes(IssmDouble* hx,IssmDouble* hy,IssmDouble* hz);
@@ -61,6 +59,7 @@
 		void        FaceOnFrontIndices(int* pindex1,int* pindex2,int* pindex3);
 		void        FaceOnSurfaceIndices(int* pindex1,int* pindex2,int* pindex3);
 		int         FiniteElement(void);
+		IssmDouble  FloatingArea(void){_error_("not implemented yet");};
 		void        FSContactMigration(Vector<IssmDouble>* vertexgrounded,Vector<IssmDouble>* vertexfloating){_error_("not implemented yet");};
 		Element*    GetBasalElement(void){_error_("not implemented yet");};
 		int         GetElementType(void);
@@ -81,6 +80,7 @@
 		void        GetVerticesCoordinatesBase(IssmDouble** pxyz_list);
 		void        GetVerticesCoordinatesTop(IssmDouble** pxyz_list);
 		void        GradientIndexing(int* indexing,int control_index){_error_("not implemented yet");};
+		IssmDouble  GroundedArea(void){_error_("not implemented yet");};
 		bool        HasFaceOnBase();
 		bool        HasFaceOnSurface();
 		IssmDouble  IceMass(void){_error_("not implemented yet");};
@@ -136,7 +136,6 @@
 		void        NormalTop(IssmDouble* normal,IssmDouble* xyz_list);
 		int         NumberofNodesPressure(void);
 		int         NumberofNodesVelocity(void);
-		void        PositiveDegreeDay(IssmDouble* pdds,IssmDouble* pds,IssmDouble signorm,bool ismungsm){_error_("not implemented yet");};
 		void        PotentialUngrounding(Vector<IssmDouble>* potential_sheet_ungrounding){_error_("not implemented yet");};
 		int         PressureInterpolation(void);
 		void        ResetFSBasalBoundaryCondition(void);
@@ -155,6 +154,8 @@
 		IssmDouble  SurfaceArea(void){_error_("not implemented yet");};
 		int         TensorInterpolation(void);
 		IssmDouble  TimeAdapt(){_error_("not implemented yet");};
+		IssmDouble  TotalFloatingBmb(void){_error_("not implemented yet");};
+		IssmDouble  TotalGroundedBmb(void){_error_("not implemented yet");};
 		IssmDouble  TotalSmb(void){_error_("not implemented yet");};
 		void        Update(int index, IoModel* iomodel,int analysis_counter,int analysis_type,int finitelement);
 		void        UpdateConstraintsExtrudeFromBase(){_error_("not implemented");};
@@ -167,10 +168,17 @@
 		void        VerticalSegmentIndices(int** pindices,int* pnumseg){_error_("not implemented yet");};
 		void        ViscousHeating(IssmDouble* pphi,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input,Input* vz_input);
 		void        ZeroLevelsetCoordinates(IssmDouble** pxyz_zero,IssmDouble* xyz_list,int levelsetenum);
+		IssmDouble     GetArea3D(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
+#ifdef _HAVE_SEALEVELRISE_
+		void    SealevelriseEustatic(Vector<IssmDouble>* pSgi,IssmDouble* peustatic,IssmDouble* latitude,IssmDouble* longitude,IssmDouble* radius,IssmDouble oceanarea,IssmDouble eartharea){_error_("not implemented yet!");};
+		void    SealevelriseNonEustatic(Vector<IssmDouble>* pSgo,IssmDouble* Sg_old,IssmDouble* latitude,IssmDouble* longitude,IssmDouble* radius,IssmDouble oceanarea,IssmDouble eartharea){_error_("not implemented yet!");};
+		IssmDouble    OceanArea(void){_error_("not implemented yet!");};
+		IssmDouble    OceanAverage(IssmDouble* Sg){_error_("not implemented yet!");};
+#endif
 
 #ifdef _HAVE_DAKOTA_
 		void        InputUpdateFromVectorDakota(IssmDouble* vector, int name, int type){_error_("not implemented yet");};

Modified: issm/trunk/src/c/classes/Elements/TetraRef.h
===================================================================
--- issm/trunk/src/c/classes/Elements/TetraRef.h	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/classes/Elements/TetraRef.h	2016-04-13 04:32:01 UTC (rev 20500)
@@ -28,5 +28,6 @@
 		int  PressureInterpolation(int fe_stokes);
 		int  TensorInterpolation(int fe_stokes);
 		int  VelocityInterpolation(int fe_stokes);
+		void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ /*do nothing */};
 };
 #endif

Modified: issm/trunk/src/c/classes/Elements/Tria.cpp
===================================================================
--- issm/trunk/src/c/classes/Elements/Tria.cpp	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/classes/Elements/Tria.cpp	2016-04-13 04:32:01 UTC (rev 20500)
@@ -106,7 +106,6 @@
 	}
 	else tria->nodes = NULL;
 	
-
 	tria->vertices = (Vertex**)this->hvertices->deliverp();
 	tria->material = (Material*)this->hmaterial->delivers();
 	tria->matpar   = (Matpar*)this->hmatpar->delivers();
@@ -114,7 +113,22 @@
 	return tria;
 }
 /*}}}*/
+void Tria::Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ /*{{{*/
+	
+	MARSHALLING_ENUM(TriaEnum);
+	
+	/*Call parent classes: */
+	ElementHook::Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
+	Element::MarshallElement(pmarshalled_data,pmarshalled_data_size,marshall_direction,this->numanalyses);
+	TriaRef::Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
 
+	vertices = (Vertex**)this->hvertices->deliverp();
+	material = (Material*)this->hmaterial->delivers();
+	matpar   = (Matpar*)this->hmatpar->delivers();
+
+}
+/*}}}*/
+
 /*Other*/
 void       Tria::AddBasalInput(int input_enum,IssmDouble* values, int interpolation_enum){/*{{{*/
 
@@ -248,85 +262,6 @@
 
 }
 /*}}}*/
-void       Tria::CalvingRatePi(){/*{{{*/
-
-	IssmDouble  xyz_list[NUMVERTICES][3];
-	GaussTria* gauss=NULL;
-	IssmDouble  vx,vy,vel;
-	IssmDouble  strainparallel;
-	IssmDouble  sxx;
-	IssmDouble  sxy;
-	IssmDouble  syy;
-	IssmDouble  sigVM;
-	IssmDouble  thickness;
-	IssmDouble  base;
-	IssmDouble  hAB;
-	IssmDouble  propcoeff;
-	IssmDouble  calvingratex[NUMVERTICES];
-	IssmDouble  calvingratey[NUMVERTICES];
-	IssmDouble  calvingrate[NUMVERTICES];
-
-
-	/* Get node coordinates and dof list: */
-	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
-
-	/*Retrieve all inputs and parameters we will need*/
-	Input* vx_input=inputs->GetInput(VxEnum);                                                    _assert_(vx_input);
-	Input* vy_input=inputs->GetInput(VyEnum);                                                    _assert_(vy_input);
-	Input* strainparallel_input=inputs->GetInput(StrainRateparallelEnum);                        _assert_(strainparallel_input);
-	Input* sxx_input=inputs->GetInput(DeviatoricStressxxEnum);                                   _assert_(sxx_input);
-	Input* sxy_input=inputs->GetInput(DeviatoricStressxyEnum);                                   _assert_(sxy_input);
-	Input* syy_input=inputs->GetInput(DeviatoricStressyyEnum);                                   _assert_(syy_input);
-	Input* thickness_input=inputs->GetInput(ThicknessEnum);                                      _assert_(thickness_input);
-	Input* base_input=inputs->GetInput(BaseEnum);                                                _assert_(base_input);
-	Input* picoeff_input=inputs->GetInput(CalvingpiCoeffEnum);                                   _assert_(picoeff_input);
-
-
-
-	/* Start looping on the number of vertices: */
-	gauss=new GaussTria();
-	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);
-		vel=vx*vx+vy*vy;
-		strainparallel_input->GetInputValue(&strainparallel,gauss);
-		sxx_input->GetInputValue(&sxx,gauss);
-		sxy_input->GetInputValue(&sxy,gauss);
-		syy_input->GetInputValue(&syy,gauss);
-		thickness_input->GetInputValue(&thickness,gauss);
-		base_input->GetInputValue(&base,gauss);
-		picoeff_input->GetInputValue(&propcoeff,gauss);
-
-		/* Computing sigma Von Mises*/
-		sigVM=sqrt(sxx*sxx+syy*syy+3*sxy*sxy-sxx*syy);
-
-		/* Computing heigth above buoyancy*/
-		hAB=thickness+1028/920*base;
-
-		/*Calving rate for Pi criterion proportionnal to the product of the strain rate along the ice flow direction and the Von Mises stress and the square of the glacier width (hardcoded) divided by the height above buoyancy and the max of the ice velocity power 3 and the ice density (ignored here)*/
-
-		calvingrate[iv]=propcoeff*strainparallel*sigVM*25.e6/hAB/1e9;
-		if(calvingrate[iv]<0){
-			calvingrate[iv]=0;
-		}
-		calvingrate[iv]=pow(calvingrate[iv],0.3);
-		calvingratex[iv]=calvingrate[iv]*vx/(sqrt(vel)+1.e-14);
-		calvingratey[iv]=calvingrate[iv]*vy/(sqrt(vel)+1.e-14);
-	}
-
-	/*Add input*/
-	this->inputs->AddInput(new TriaInput(CalvingratexEnum,&calvingratex[0],P1Enum));
-	this->inputs->AddInput(new TriaInput(CalvingrateyEnum,&calvingratey[0],P1Enum));
-	this->inputs->AddInput(new TriaInput(CalvingCalvingrateEnum,&calvingrate[0],P1Enum));
-
-	/*Clean up and return*/
-	delete gauss;
-
-}
-/*}}}*/
 void       Tria::CalvingRateDev(){/*{{{*/
 
 	IssmDouble  xyz_list[NUMVERTICES][3];
@@ -335,13 +270,17 @@
 	IssmDouble  calvingratey[NUMVERTICES];
 	IssmDouble  calvingrate[NUMVERTICES];
 	IssmDouble  lambda1,lambda2,ex,ey,vx,vy,vel;
+	IssmDouble  sigma_vm,sigma_max,epse_2,groundedice;
 
 	/* Get node coordinates and dof list: */
 	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
 
 	/*Retrieve all inputs and parameters we will need*/
-	Input* vx_input=inputs->GetInput(VxEnum);        _assert_(vx_input);
-	Input* vy_input=inputs->GetInput(VyEnum);        _assert_(vy_input);
+	Input* vx_input = inputs->GetInput(VxEnum); _assert_(vx_input);
+	Input* vy_input = inputs->GetInput(VyEnum); _assert_(vy_input);
+	Input* gr_input = inputs->GetInput(MaskGroundediceLevelsetEnum); _assert_(gr_input);
+	IssmDouble  B   = this->GetMaterialParameter(MaterialsRheologyBbarEnum);
+	IssmDouble  n   = this->GetMaterialParameter(MaterialsRheologyNEnum);
 
 	/* Start looping on the number of vertices: */
 	GaussTria* gauss=new GaussTria();
@@ -351,6 +290,7 @@
 		/*Get velocity components and thickness*/
 		vx_input->GetInputValue(&vx,gauss);
 		vy_input->GetInputValue(&vy,gauss);
+		gr_input->GetInputValue(&groundedice,gauss);
 		vel=sqrt(vx*vx+vy*vy)+1.e-14;
 
 		/*Compute strain rate and viscosity: */
@@ -365,9 +305,26 @@
 		lambda1 = max(lambda1,0.);
 		lambda2 = max(lambda2,0.);
 
+		/*Calculate sigma_vm*/
+		epse_2    = 1./2. *(lambda1*lambda1 + lambda2*lambda2);
+		sigma_vm  = sqrt(3.) * B * pow(epse_2,1./(2.*n));
+		//sigma_max = 125.e+3;
+		sigma_max = 350.e+3;
+		sigma_max = 450.e+3;
+		sigma_max = 800.e+3; //too much
+		//sigma_max = 700.e+3;
+		//sigma_max = 670.e+3;
+		//sigma_max = 550.e+3;
+		sigma_max = 750.e+3; //too high
+		sigma_max = 850.e+3; //too low
+		sigma_max = 800.e+3; //IUGG previous test
+		sigma_max = 1000.e+3; //850 seems small
+
+		if(groundedice<0) sigma_max=200.e+3;
+
 		/*Assign values*/
-		calvingratex[iv]=vx*pow(lambda1 + lambda2,1./3.)*3.e+2;
-		calvingratey[iv]=vy*pow(lambda1 + lambda2,1./3.)*3.e+2;
+		calvingratex[iv]=vx*sigma_vm/sigma_max;
+		calvingratey[iv]=vy*sigma_vm/sigma_max;
 		calvingrate[iv]=sqrt(calvingratex[iv]*calvingratex[iv] + calvingratey[iv]*calvingratey[iv]);
 	}
 
@@ -380,6 +337,126 @@
 	delete gauss;
 }
 /*}}}*/
+void       Tria::WriteLevelsetSegment(DataSet* segments){/*{{{*/
+
+	if(!this->IsZeroLevelset(MaskIceLevelsetEnum)) return;
+
+	IssmDouble* xyz_list_zero = NULL;
+	IssmDouble  xyz_list[NUMVERTICES][3];
+	::GetVerticesCoordinates(&xyz_list[0][0],this->vertices,NUMVERTICES);
+	this->ZeroLevelsetCoordinates(&xyz_list_zero,&xyz_list[0][0], MaskIceLevelsetEnum);
+	if(xyz_list_zero){
+		IssmDouble x[2];
+		IssmDouble y[2];
+		x[0] = xyz_list_zero[0*3 + 0]; x[1] = xyz_list_zero[1*3 + 0];
+		y[0] = xyz_list_zero[0*3 + 1]; y[1] = xyz_list_zero[1*3 + 1];
+		segments->AddObject(new Contour<IssmDouble>(segments->Size()+1,2,&x[0],&y[0],false));
+	}
+	xDelete<IssmDouble>(xyz_list_zero);
+
+//	IssmDouble ls[NUMVERTICES];
+//	IssmDouble  xyz_list[NUMVERTICES][3];
+//
+//	if(IsIceInElement()){
+//
+//		/*Retrieve all inputs and parameters*/
+//		GetInputListOnVertices(&ls[0],levelset_enum);
+//
+//		/*If the level set is awlays <0, there is no ice front here*/
+//		bool iszerols= false;
+//		if(IsIceInElement()){
+//			if(ls[0]*ls[1]<0. || ls[0]*ls[2]<0. || (ls[0]*ls[1]*ls[2]==0. && ls[0]*ls[1]+ls[0]*ls[2]+ls[1]*ls[2]<=0.)){
+//				iszerols = true;
+//			}
+//		}
+//
+//		if(iszerols){
+//			/*OK we have one segment!*/
+//			::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+//			int count = 0;
+//			IssmDouble x[2];
+//			IssmDouble y[2];
+//
+//			for(int i=0;i<NUMVERTICES,i++){
+//				int index1 = i;
+//				int index1 = (i+1)%3;
+//				if(ls[index1]<=0 && ls[index2]>=0){
+//
+//				}
+//
+//			}
+//			Contour* segment = new Contour<IssmDouble>(segment->Size()+1,2,x,y,false);
+//		}
+//
+//	}
+//
+//	_error_("STOP");
+}
+/*}}}*/
+void       Tria::ResetLevelsetFromSegmentlist(IssmDouble* segments,int numsegments){/*{{{*/
+
+	/*Intermediaries*/
+	IssmDouble d,xn,yn;
+
+	/*Get current levelset and vertex coordinates*/
+	IssmDouble ls[NUMVERTICES];
+	IssmDouble  xyz_list[NUMVERTICES][3];
+	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+	GetInputListOnVertices(&ls[0],MaskIceLevelsetEnum);
+	InputDuplicate(MaskIceLevelsetEnum,PressureEnum);
+
+	/*Get distance from list of segments and reset ls*/
+	for(int j=0;j<NUMVERTICES;j++){
+		IssmDouble dmin = 1.e+50;
+		for(int i=0;i<numsegments;i++){
+			IssmDouble x = xyz_list[j][0];
+			IssmDouble y = xyz_list[j][1];
+			IssmDouble l2 = (segments[4*i+2]-segments[4*i+0])*(segments[4*i+2]-segments[4*i+0]) + (segments[4*i+3]-segments[4*i+1])*(segments[4*i+3]-segments[4*i+1]);
+
+			/*Segment has a length of 0*/
+			if(l2==0.){
+				d = (x-segments[4*i+0])*(x-segments[4*i+0])+(y-segments[4*i+1])*(y-segments[4*i+1]);
+				if(d<dmin) dmin = d;
+				continue;
+			}
+
+			/*Consider the line extending the segment, parameterized as v + t (w - v).
+			 *We find projection of point p onto the line.
+			 *It falls where t = [(p-v) . (w-v)] / |w-v|^2*/
+			IssmDouble t = ((x-segments[4*i+0])*(segments[4*i+2]-segments[4*i+0]) + (y-segments[4*i+1])*(segments[4*i+3]-segments[4*i+1]))/l2;
+			if(t < 0.0){
+				// Beyond the 'v' end of the segment
+				d = (x-segments[4*i+0])*(x-segments[4*i+0])+(y-segments[4*i+1])*(y-segments[4*i+1]);
+			}
+			else if (t > 1.0){
+				// Beyond the 'w' end of the segment
+				d = (x-segments[4*i+2])*(x-segments[4*i+2])+(y-segments[4*i+3])*(y-segments[4*i+3]);
+			}
+			else{
+				// Projection falls on the segment
+				xn = segments[4*i+0] + t * (segments[4*i+2] - segments[4*i+0]);
+				yn = segments[4*i+1] + t * (segments[4*i+3] - segments[4*i+1]);
+				d = (x-xn)*(x-xn)+(y-yn)*(y-yn);
+			}
+
+			if(d<dmin) dmin = d;
+		}
+
+		/*Update signed distance*/
+		dmin = sqrt(dmin);
+		if(dmin>10000) dmin=10000;
+		if(ls[j]>0){
+			ls[j] = dmin;
+		}
+		else{
+			ls[j] = - dmin;
+		}
+	}
+
+	/*Update Levelset*/
+	this->inputs->AddInput(new TriaInput(MaskIceLevelsetEnum,&ls[0],P1Enum));
+}
+/*}}}*/
 IssmDouble Tria::CharacteristicLength(void){/*{{{*/
 
 	return sqrt(2*this->GetArea());
@@ -400,6 +477,7 @@
 	IssmDouble  tau_xy[NUMVERTICES];
 	IssmDouble	tau_xz[NUMVERTICES]={0,0,0};
 	IssmDouble	tau_yz[NUMVERTICES]={0,0,0};
+	IssmDouble  tau_e[NUMVERTICES];
 	GaussTria*  gauss=NULL;
 	int domaintype,dim=2;
 
@@ -425,6 +503,7 @@
 		tau_xx[iv]=2*viscosity*epsilon[0]; // tau = nu eps
 		tau_yy[iv]=2*viscosity*epsilon[1];
 		tau_xy[iv]=2*viscosity*epsilon[2];
+		tau_e[iv]=1/sqrt(2)*sqrt(pow(tau_xx[iv],2)+pow(tau_yy[iv],2)+2*pow(tau_xy[iv],2));
 	}
 
 	/*Add Stress tensor components into inputs*/
@@ -434,6 +513,7 @@
 	this->inputs->AddInput(new TriaInput(DeviatoricStressyyEnum,&tau_yy[0],P1Enum));
 	this->inputs->AddInput(new TriaInput(DeviatoricStressyzEnum,&tau_yz[0],P1Enum));
 	this->inputs->AddInput(new TriaInput(DeviatoricStresszzEnum,&tau_zz[0],P1Enum));
+	this->inputs->AddInput(new TriaInput(DeviatoricStresseffectiveEnum,&tau_e[0],P1Enum));
 
 	/*Clean up and return*/
 	delete gauss;
@@ -634,139 +714,6 @@
 	vector_gradient->SetValues(NUMVERTICES,&sidlist[0],&gradients[0],ADD_VAL);
 
 }/*}}}*/
-void       Tria::Delta18oParameterization(void){/*{{{*/
-
-	int        i;
-	IssmDouble monthlytemperatures[NUMVERTICES][12],monthlyprec[NUMVERTICES][12];
-	IssmDouble TemperaturesPresentday[NUMVERTICES][12],TemperaturesLgm[NUMVERTICES][12];
-	IssmDouble PrecipitationsPresentday[NUMVERTICES][12];
-	IssmDouble tmp[NUMVERTICES];
-	IssmDouble Delta18oPresent,Delta18oLgm,Delta18oTime;
-	IssmDouble Delta18oSurfacePresent,Delta18oSurfaceLgm,Delta18oSurfaceTime;
-	IssmDouble time,yts,finaltime;
-
-	/*Recover parameters*/
-	this->parameters->FindParam(&time,TimeEnum);
-	this->parameters->FindParam(&yts,ConstantsYtsEnum);
-	this->parameters->FindParam(&finaltime,TimesteppingFinalTimeEnum);
-
-	/*Recover present day temperature and precipitation*/
-	Input* input=inputs->GetInput(SurfaceforcingsTemperaturesPresentdayEnum);    _assert_(input);
-	Input* input2=inputs->GetInput(SurfaceforcingsTemperaturesLgmEnum);          _assert_(input2);
-	Input* input3=inputs->GetInput(SurfaceforcingsPrecipitationsPresentdayEnum); _assert_(input3);
-	GaussTria* gauss=new GaussTria();
-	for(int month=0;month<12;month++){
-		for(int iv=0;iv<NUMVERTICES;iv++){
-			gauss->GaussVertex(iv);
-			input->GetInputValue(&TemperaturesPresentday[iv][month],gauss,month/12.*yts);
-			input2->GetInputValue(&TemperaturesLgm[iv][month],gauss,month/12.*yts);
-			input3->GetInputValue(&PrecipitationsPresentday[iv][month],gauss,month/12.*yts);
-		}
-	}
-
-	/*Recover delta18o and Delta18oSurface at present day, lgm and at time t*/
-	this->parameters->FindParam(&Delta18oPresent,SurfaceforcingsDelta18oEnum,finaltime);
-	this->parameters->FindParam(&Delta18oLgm,SurfaceforcingsDelta18oEnum,(finaltime-(21000*yts)));
-	this->parameters->FindParam(&Delta18oTime,SurfaceforcingsDelta18oEnum,time);
-	this->parameters->FindParam(&Delta18oSurfacePresent,SurfaceforcingsDelta18oSurfaceEnum,finaltime);
-	this->parameters->FindParam(&Delta18oSurfaceLgm,SurfaceforcingsDelta18oSurfaceEnum,(finaltime-(21000*yts)));
-	this->parameters->FindParam(&Delta18oSurfaceTime,SurfaceforcingsDelta18oSurfaceEnum,time);
-
-	/*Compute the temperature and precipitation*/
-	for(int iv=0;iv<NUMVERTICES;iv++){
-		ComputeDelta18oTemperaturePrecipitation(Delta18oSurfacePresent, Delta18oSurfaceLgm, Delta18oSurfaceTime, 
-					Delta18oPresent, Delta18oLgm, Delta18oTime,
-					&PrecipitationsPresentday[iv][0], 
-					&TemperaturesLgm[iv][0], &TemperaturesPresentday[iv][0], 
-					&monthlytemperatures[iv][0], &monthlyprec[iv][0]);
-	}
-
-	/*Update inputs*/ 
-	TransientInput* NewTemperatureInput = new TransientInput(SurfaceforcingsMonthlytemperaturesEnum);
-	TransientInput* NewPrecipitationInput = new TransientInput(SurfaceforcingsPrecipitationEnum);
-	for (int imonth=0;imonth<12;imonth++) {
-		for(i=0;i<NUMVERTICES;i++) tmp[i]=monthlytemperatures[i][imonth];
-		TriaInput* newmonthinput1 = new TriaInput(SurfaceforcingsMonthlytemperaturesEnum,&tmp[0],P1Enum);
-		NewTemperatureInput->AddTimeInput(newmonthinput1,time+imonth/12.*yts);
-
-		for(i=0;i<NUMVERTICES;i++) tmp[i]=monthlyprec[i][imonth];
-		TriaInput* newmonthinput2 = new TriaInput(SurfaceforcingsPrecipitationEnum,&tmp[0],P1Enum);
-		NewPrecipitationInput->AddTimeInput(newmonthinput2,time+imonth/12.*yts);
-	}
-	NewTemperatureInput->Configure(this->parameters);
-	NewPrecipitationInput->Configure(this->parameters);
-
-	this->inputs->AddInput(NewTemperatureInput);
-	this->inputs->AddInput(NewPrecipitationInput);
-
-	/*clean-up*/
-	delete gauss;
-}
-/*}}}*/
-void       Tria::MungsmtpParameterization(void){/*{{{*/
-	/*Are we on the base? If not, return*/
-	if(!IsOnBase()) return;
-
-	int        i;
-	IssmDouble monthlytemperatures[NUMVERTICES][12],monthlyprec[NUMVERTICES][12];
-	IssmDouble TemperaturesPresentday[NUMVERTICES][12],TemperaturesLgm[NUMVERTICES][12];
-	IssmDouble PrecipitationsPresentday[NUMVERTICES][12],PrecipitationsLgm[NUMVERTICES][12];
-	IssmDouble tmp[NUMVERTICES];
-	IssmDouble TdiffTime,PfacTime;
-	IssmDouble time,yts;
-	this->parameters->FindParam(&time,TimeEnum);
-	this->parameters->FindParam(&yts,ConstantsYtsEnum);
-
-	/*Recover present day temperature and precipitation*/
-	Input*     input=inputs->GetInput(SurfaceforcingsTemperaturesPresentdayEnum);    _assert_(input);
-	Input*     input2=inputs->GetInput(SurfaceforcingsTemperaturesLgmEnum);          _assert_(input2);
-	Input*     input3=inputs->GetInput(SurfaceforcingsPrecipitationsPresentdayEnum); _assert_(input3);
-	Input*     input4=inputs->GetInput(SurfaceforcingsPrecipitationsLgmEnum);        _assert_(input4);
-	GaussTria* gauss=new GaussTria();
-	for(int month=0;month<12;month++) {
-		for(int iv=0;iv<NUMVERTICES;iv++) {
-			gauss->GaussVertex(iv);
-			input->GetInputValue(&TemperaturesPresentday[iv][month],gauss,month/12.*yts);
-			input2->GetInputValue(&TemperaturesLgm[iv][month],gauss,month/12.*yts);
-			input3->GetInputValue(&PrecipitationsPresentday[iv][month],gauss,month/12.*yts);
-			input4->GetInputValue(&PrecipitationsLgm[iv][month],gauss,month/12.*yts);
-		}
-	}
-
-	/*Recover interpolation parameters at time t*/
-	this->parameters->FindParam(&TdiffTime,SurfaceforcingsTdiffEnum,time);
-	this->parameters->FindParam(&PfacTime,SurfaceforcingsPfacEnum,time);
-
-	/*Compute the temperature and precipitation*/
-	for(int iv=0;iv<NUMVERTICES;iv++){
-	  ComputeMungsmTemperaturePrecipitation(TdiffTime,PfacTime,
-					&PrecipitationsLgm[iv][0],&PrecipitationsPresentday[iv][0], 
-					&TemperaturesLgm[iv][0], &TemperaturesPresentday[iv][0], 
-					&monthlytemperatures[iv][0], &monthlyprec[iv][0]);
-	}
-
-	/*Update inputs*/ 
-	TransientInput* NewTemperatureInput = new TransientInput(SurfaceforcingsMonthlytemperaturesEnum);
-	TransientInput* NewPrecipitationInput = new TransientInput(SurfaceforcingsPrecipitationEnum);
-	for (int imonth=0;imonth<12;imonth++) {
-		for(i=0;i<NUMVERTICES;i++) tmp[i]=monthlytemperatures[i][imonth];
-		TriaInput* newmonthinput1 = new TriaInput(SurfaceforcingsMonthlytemperaturesEnum,&tmp[0],P1Enum);
-		NewTemperatureInput->AddTimeInput(newmonthinput1,time+imonth/12.*yts);
-
-		for(i=0;i<NUMVERTICES;i++) tmp[i]=monthlyprec[i][imonth];
-		TriaInput* newmonthinput2 = new TriaInput(SurfaceforcingsPrecipitationEnum,&tmp[0],P1Enum);
-		NewPrecipitationInput->AddTimeInput(newmonthinput2,time+imonth/12.*yts);
-	}
-	NewTemperatureInput->Configure(this->parameters);
-	NewPrecipitationInput->Configure(this->parameters);
-
-	this->inputs->AddInput(NewTemperatureInput);
-	this->inputs->AddInput(NewPrecipitationInput);
-
-	/*clean-up*/
-	delete gauss;
-}
-/*}}}*/
 int        Tria::EdgeOnBaseIndex(void){/*{{{*/
 
 	IssmDouble values[NUMVERTICES];
@@ -895,6 +842,27 @@
 	return this->element_type;
 }
 /*}}}*/
+IssmDouble Tria::FloatingArea(void){/*{{{*/
+
+	/*Intermediaries*/
+	int         domaintype;
+	IssmDouble  phi;
+	IssmDouble *xyz_list  = NULL;
+
+	if(!IsIceInElement())return 0.;
+
+	/*Get problem dimension*/
+	this->FindParam(&domaintype,DomainTypeEnum);
+	if(domaintype!=Domain2DhorizontalEnum && domaintype!=Domain3DEnum) _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+
+	this->GetVerticesCoordinates(&xyz_list);
+	phi=this->GetGroundedPortion(xyz_list);
+
+	/*Clean up and return*/
+	xDelete<IssmDouble>(xyz_list);
+	return (1-phi)*this->GetArea();
+}
+/*}}}*/
 void       Tria::FSContactMigration(Vector<IssmDouble>* vertexgrounded,Vector<IssmDouble>* vertexfloating){/*{{{*/
 
 	if(!IsOnBase()) return;
@@ -996,6 +964,25 @@
 	return (x2*y3 - y2*x3 + x1*y2 - y1*x2 + x3*y1 - y3*x1)/2;
 }
 /*}}}*/
+IssmDouble Tria::GetArea3D(void){/*{{{*/
+
+	IssmDouble xyz_list[NUMVERTICES][3];
+	IssmDouble x1,y1,z1,x2,y2,z2,x3,y3,z3;
+	IssmDouble detm1,detm2,detm3;
+
+	/*Get xyz list: */
+	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+	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];
+
+	detm1=x1*y2 - x2*y1 - x1*y3 + x3*y1 + x2*y3 - x3*y2;
+	detm2=y1*z2 - y2*z1 - y1*z3 + y3*z1 + y2*z3 - y3*z2;
+	detm3=x2*z1 - x1*z2 + x1*z3 - x3*z1 - x2*z3 + x3*z2;
+
+	return sqrt(pow(detm1,2) + pow(detm2,2) + pow(detm3,2))/2;
+}
+/*}}}*/
 IssmDouble Tria::GetAreaIce(void){/*{{{*/
 
 	/*return area of element covered by ice*/
@@ -1577,6 +1564,27 @@
 	*pxyz_list = xyz_list_edge;
 
 }/*}}}*/
+IssmDouble Tria::GroundedArea(void){/*{{{*/
+
+	/*Intermediaries*/
+	int         domaintype;
+	IssmDouble  phi;
+	IssmDouble *xyz_list  = NULL;
+
+	if(!IsIceInElement())return 0.;
+
+	/*Get problem dimension*/
+	this->FindParam(&domaintype,DomainTypeEnum);
+	if(domaintype!=Domain2DhorizontalEnum && domaintype!=Domain3DEnum) _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+
+	this->GetVerticesCoordinates(&xyz_list);
+	phi=this->GetGroundedPortion(xyz_list);
+
+	/*Clean up and return*/
+	xDelete<IssmDouble>(xyz_list);
+	return phi*this->GetArea();
+}
+/*}}}*/
 bool       Tria::HasEdgeOnBase(){/*{{{*/
 
 	IssmDouble values[NUMVERTICES];
@@ -2482,7 +2490,7 @@
 	/*figure out if we have the vertex id: */
 	found=0;
 	for(int i=0;i<NUMVERTICES;i++){
-		if(index==vertices[i]->Id()){
+		if(index==vertices[i]->Sid()){
 			/*Do we have natureofdataenum in our inputs? :*/
 			if(data){
 				/*ok, we are good. retrieve value of input at vertex :*/
@@ -2556,10 +2564,6 @@
 
 }
 /*}}}*/
-int        Tria::PressureInterpolation(void){/*{{{*/
-	return TriaRef::PressureInterpolation(this->element_type);
-}
-/*}}}*/
 int        Tria::NumberofNodesPressure(void){/*{{{*/
 	return TriaRef::NumberofNodes(this->PressureInterpolation());
 }
@@ -2568,98 +2572,6 @@
 	return TriaRef::NumberofNodes(this->VelocityInterpolation());
 }
 /*}}}*/
-void       Tria::PositiveDegreeDay(IssmDouble* pdds,IssmDouble* pds,IssmDouble signorm,bool ismungsm){/*{{{*/
- 
-   int        i;
-   IssmDouble agd[NUMVERTICES];             // surface mass balance
-   IssmDouble monthlytemperatures[NUMVERTICES][12],monthlyprec[NUMVERTICES][12];
-   IssmDouble tmp[NUMVERTICES];
-   IssmDouble h[NUMVERTICES],s[NUMVERTICES];
-   IssmDouble rho_water,rho_ice,desfac,s0p,s0t,rlaps,rlapslgm;
-   IssmDouble PfacTime,TdiffTime,sealevTime;
-   
-   /*Get material parameters :*/
-   rho_water=matpar->GetMaterialParameter(MaterialsRhoSeawaterEnum);
-   rho_ice=matpar->GetMaterialParameter(MaterialsRhoIceEnum);
-
-  /*Get some pdd parameters*/
-  desfac=matpar->GetMaterialParameter(SurfaceforcingsDesfacEnum);
-  s0p=matpar->GetMaterialParameter(SurfaceforcingsS0pEnum);
-  s0t=matpar->GetMaterialParameter(SurfaceforcingsS0tEnum);
-  rlaps=matpar->GetMaterialParameter(SurfaceforcingsRlapsEnum);
-  rlapslgm=matpar->GetMaterialParameter(SurfaceforcingsRlapslgmEnum);
-
-   /*Recover monthly temperatures and precipitation and Present day and LGm ones*/
-   Input*     input=inputs->GetInput(SurfaceforcingsMonthlytemperaturesEnum); _assert_(input);
-   Input*     input2=inputs->GetInput(SurfaceforcingsPrecipitationEnum); _assert_(input2);
-   GaussTria* gauss=new GaussTria();
-   IssmDouble time,yts;
-   this->parameters->FindParam(&time,TimeEnum);
-   this->parameters->FindParam(&yts,ConstantsYtsEnum);
-
-
-   for(int month=0;month<12;month++) {
-     for(int iv=0;iv<NUMVERTICES;iv++) {
-       gauss->GaussVertex(iv);
-       input->GetInputValue(&monthlytemperatures[iv][month],gauss,time+month/12.*yts);
-       monthlytemperatures[iv][month]=monthlytemperatures[iv][month]-273.15; // conversion from Kelvin to celcius
-       input2->GetInputValue(&monthlyprec[iv][month],gauss,time+month/12.*yts);
-     }
-   }
-
-  /*Recover Pfac, Tdiff and sealev at time t:
-    This parameters are used to interpolate the temperature 
-    and precipitaton between PD and LGM when ismungsm==1 */ 
-  if (ismungsm==1){  
-    this->parameters->FindParam(&TdiffTime,SurfaceforcingsTdiffEnum,time);
-    this->parameters->FindParam(&sealevTime,SurfaceforcingsSealevEnum,time);
-  }
-  else {
-    TdiffTime=0;
-    sealevTime=0;  
-  }
-
-  /*Recover info at the vertices: */
-  GetInputListOnVertices(&h[0],ThicknessEnum);
-  GetInputListOnVertices(&s[0],SurfaceEnum);
-     
-   /*measure the surface mass balance*/
-  for (int iv = 0; iv<NUMVERTICES; iv++){
-     agd[iv]=PddSurfaceMassBalance(&monthlytemperatures[iv][0], &monthlyprec[iv][0],
-				  pdds, pds, signorm, yts, h[iv], s[iv],
-				  desfac, s0t, s0p,rlaps,rlapslgm,TdiffTime,sealevTime,
-				  rho_water,rho_ice);
-   }
-
-   /*Update inputs*/    
-   // TransientInput* NewTemperatureInput = new TransientInput(SurfaceforcingsMonthlytemperaturesEnum);
-   // TransientInput* NewPrecipitationInput = new TransientInput(SurfaceforcingsPrecipitationEnum);
-   // for (int imonth=0;imonth<12;imonth++) {
-   //   for(i=0;i<NUMVERTICES;i++) tmp[i]=monthlytemperatures[i][imonth];
-   //   TriaInput* newmonthinput1 = new TriaInput(SurfaceforcingsMonthlytemperaturesEnum,&tmp[0],P1Enum);
-   //   NewTemperatureInput->AddTimeInput(newmonthinput1,time+imonth/12.*yts);
-   // 
-   //   for(i=0;i<NUMVERTICES;i++) tmp[i]=monthlyprec[i][imonth];
-   //   TriaInput* newmonthinput2 = new TriaInput(SurfaceforcingsPrecipitationEnum,&tmp[0],P1Enum);
-   //   NewPrecipitationInput->AddTimeInput(newmonthinput2,time+imonth/12.*yts);
-   // }
-   // NewTemperatureInput->Configure(this->parameters);
-   // NewPrecipitationInput->Configure(this->parameters);
-
-
-   this->inputs->AddInput(new TriaInput(SurfaceforcingsMassBalanceEnum,&agd[0],P1Enum));
-   // this->inputs->AddInput(NewTemperatureInput);
-   // this->inputs->AddInput(NewPrecipitationInput);
-   // this->inputs->AddInput(new TriaVertexInput(ThermalSpcTemperatureEnum,&Tsurf[0]));
-
-   //this->InputExtrude(SurfaceforcingsMassBalanceEnum,-1);
-   // this->InputExtrude(SurfaceforcingsMonthlytemperaturesEnum,-1);
-   // this->InputExtrude(SurfaceforcingsPrecipitationEnum,-1);
-
-	/*clean-up*/
-	delete gauss;
-}
-/*}}}*/
 void       Tria::PotentialUngrounding(Vector<IssmDouble>* potential_ungrounding){/*{{{*/
 
 	IssmDouble  h[NUMVERTICES],r[NUMVERTICES],gl[NUMVERTICES];
@@ -2687,6 +2599,10 @@
 	}
 }
 /*}}}*/
+int        Tria::PressureInterpolation(void){/*{{{*/
+	return TriaRef::PressureInterpolation(this->element_type);
+}
+/*}}}*/
 void       Tria::ReduceMatrices(ElementMatrix* Ke,ElementVector* pe){/*{{{*/
 
 	/*Static condensation if requested*/
@@ -3077,11 +2993,85 @@
 	dy=maxy-miny;
 
 	/*CFL criterion: */
-	dt=C/(maxabsvy/dx+maxabsvy/dy);
+	dt=C/(maxabsvx/dx+maxabsvy/dy);
 
 	return dt;
 }
 /*}}}*/
+IssmDouble Tria::TotalFloatingBmb(void){/*{{{*/
+
+	/*The fbmb[kg yr-1] of one element is area[m2] * melting_rate [kg m^-2 yr^-1]*/
+	int        point1;
+	bool       mainlyfloating;
+	IssmDouble fbmb=0;
+	IssmDouble rho_ice,fraction1,fraction2,floatingmelt,Jdet;
+	IssmDouble Total_Fbmb=0;
+	IssmDouble xyz_list[NUMVERTICES][3];
+	Gauss*     gauss     = NULL;
+
+   if(!IsIceInElement())return 0;
+
+	/*Get material parameters :*/
+	rho_ice=matpar->GetMaterialParameter(MaterialsRhoIceEnum);
+	Input* floatingmelt_input = this->GetInput(BasalforcingsFloatingiceMeltingRateEnum); _assert_(floatingmelt_input); 
+	Input* gllevelset_input = this->GetInput(MaskGroundediceLevelsetEnum); _assert_(gllevelset_input);
+	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+
+	this->GetGroundedPart(&point1,&fraction1,&fraction2,&mainlyfloating);
+	/* Start  looping on the number of gaussian points: */
+	gauss = this->NewGauss(point1,fraction1,fraction2,1-mainlyfloating,3);
+	for(int ig=gauss->begin();ig<gauss->end();ig++){
+
+		gauss->GaussPoint(ig);
+		this->JacobianDeterminant(&Jdet,&xyz_list[0][0],gauss);
+		floatingmelt_input->GetInputValue(&floatingmelt,gauss);
+		fbmb+=floatingmelt*Jdet*gauss->weight;
+	}
+
+   Total_Fbmb=rho_ice*fbmb;	        // from volume to mass
+
+	/*Return: */
+	delete gauss;
+	return Total_Fbmb;
+}
+/*}}}*/
+IssmDouble Tria::TotalGroundedBmb(void){/*{{{*/
+
+	/*The gbmb[kg yr-1] of one element is area[m2] * gounded melting rate [kg m^-2 yr^-1]*/
+	int        point1;
+	bool       mainlyfloating;
+	IssmDouble gbmb=0;
+	IssmDouble rho_ice,fraction1,fraction2,groundedmelt,Jdet;
+	IssmDouble Total_Gbmb=0;
+	IssmDouble xyz_list[NUMVERTICES][3];
+	Gauss*     gauss     = NULL;
+
+   if(!IsIceInElement())return 0;
+
+	/*Get material parameters :*/
+	rho_ice=matpar->GetMaterialParameter(MaterialsRhoIceEnum);
+	Input* groundedmelt_input = this->GetInput(BasalforcingsGroundediceMeltingRateEnum); _assert_(groundedmelt_input); 
+	Input* gllevelset_input = this->GetInput(MaskGroundediceLevelsetEnum); _assert_(gllevelset_input);
+	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+
+	this->GetGroundedPart(&point1,&fraction1,&fraction2,&mainlyfloating);
+	/* Start  looping on the number of gaussian points: */
+	gauss = this->NewGauss(point1,fraction1,fraction2,mainlyfloating,2);
+	for(int ig=gauss->begin();ig<gauss->end();ig++){
+
+		gauss->GaussPoint(ig);
+		this->JacobianDeterminant(&Jdet,&xyz_list[0][0],gauss);
+		groundedmelt_input->GetInputValue(&groundedmelt,gauss);
+		gbmb+=groundedmelt*Jdet*gauss->weight;
+	}
+
+   Total_Gbmb=rho_ice*gbmb;	        // from volume to mass
+
+	/*Return: */
+	delete gauss;
+	return Total_Gbmb;
+}
+/*}}}*/
 IssmDouble Tria::TotalSmb(void){/*{{{*/
 
 	/*The smb[kg yr-1] of one element is area[m2] * smb [kg m^-2 yr^-1]*/
@@ -3102,7 +3092,7 @@
 	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 = inputs->GetInput(SurfaceforcingsMassBalanceEnum); _assert_(smb_input);
+	Input* smb_input = inputs->GetInput(SmbMassBalanceEnum); _assert_(smb_input);
 	smb_input->GetInputAverage(&smb);																								// average smb on element in m ice s-1
    Total_Smb=rho_ice*base*smb;																											// smb on element in kg s-1
 
@@ -3347,7 +3337,7 @@
 	int* indices=NULL;
 	IssmDouble* xyz_zero=NULL;
 
-	this->GetLevelsetIntersection(&indices, &numiceverts, s, MaskIceLevelsetEnum, 0.);
+	this->GetLevelsetIntersection(&indices, &numiceverts, s,levelsetenum,0.);
 	
 	//TODO: check if for 2 iceverts front segment is oriented in CCW way
 	
@@ -3368,7 +3358,7 @@
 	}
 	else if(numiceverts==NUMVERTICES){ //NUMVERTICES ice vertices: calving front lies on element edge
 		IssmDouble lsf[NUMVERTICES];
-		this->GetInputListOnVertices(&lsf[0],MaskIceLevelsetEnum);
+		this->GetInputListOnVertices(&lsf[0],levelsetenum);
 		counter=0;
 		for(i=0;i<NUMVERTICES;i++){
 			if(lsf[indices[i]]==0.){
@@ -3514,6 +3504,324 @@
 /*}}}*/
 #endif
 
+#ifdef _HAVE_SEALEVELRISE_
+void    Tria::SealevelriseEustatic(Vector<IssmDouble>* pSgi,IssmDouble* peustatic,IssmDouble* latitude,IssmDouble* longitude,IssmDouble* radius,IssmDouble oceanarea,IssmDouble eartharea){ /*{{{*/
+
+	/*diverse:*/
+	int gsize;
+	bool spherical=true;
+	IssmDouble llr_list[NUMVERTICES][3];
+	IssmDouble area;
+	IssmDouble I;  //change in ice thickness or water level(Farrel and Clarke, Equ. 4)
+	IssmDouble rho;
+	IssmDouble late,longe,re;
+	IssmDouble lati,longi,ri;
+
+	/*elastic green function:*/
+	IssmDouble* G_elastic_precomputed=NULL;
+	int         M;
+
+	/*ice properties: */
+	IssmDouble rho_ice,rho_water,rho_earth;
+
+	/*Initialize eustatic component: do not skip this step :):*/
+	IssmDouble eustatic = 0;
+
+	/*Computational flags:*/
+	bool computerigid = true;
+	bool computeelastic= true;
+	
+	/*early return if we are not on an ice cap:*/
+	if(!(this->inputs->Max(MaskIceLevelsetEnum)<0)){
+		*peustatic=0; //do not forget to assign this pointer, otherwise, global eustatic will be garbage!
+		return;
+	}
+
+	/*recover material parameters: */
+	rho_ice=matpar->GetMaterialParameter(MaterialsRhoIceEnum);
+	rho_water=matpar->GetMaterialParameter(MaterialsRhoFreshwaterEnum);
+	rho_earth=matpar->GetMaterialParameter(MaterialsEarthDensityEnum);
+
+	/*recover love numbers and computational flags: */
+	this->parameters->FindParam(&computerigid,SealevelriseRigidEnum);
+	this->parameters->FindParam(&computeelastic,SealevelriseElasticEnum);
+
+	/*recover elastic green function:*/
+	if(computeelastic){
+		DoubleVecParam* parameter = static_cast<DoubleVecParam*>(this->parameters->FindParamObject(SealevelriseGElasticEnum)); 
+		_assert_(parameter);
+		parameter->GetParameterValueByPointer(&G_elastic_precomputed,&M);
+	}
+
+	/*how many dofs are we working with here? */
+	this->parameters->FindParam(&gsize,MeshNumberofverticesEnum);
+
+	/* Where is the centroid of this element?:{{{*/
+	
+	/*retrieve coordinates: */
+	::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;
+	/*}}}*/
+
+	/*Compute area of element:*/
+	area=GetArea3D();
+
+	/*Compute ice thickness change: */
+	Input*	deltathickness_input=inputs->GetInput(SealevelriseDeltathicknessEnum); 
+	if (!deltathickness_input)_error_("delta thickness input needed to compute sea level rise!");
+	deltathickness_input->GetInputAverage(&I);
+
+	/*Compute eustatic compoent:*/
+	eustatic += rho_ice*area*I/(oceanarea*rho_water); 
+
+	if(computeelastic | computerigid){
+		int* indices=xNew<int>(gsize);
+		IssmDouble* values=xNew<IssmDouble>(gsize);
+		for(int i=0;i<gsize;i++){
+			indices[i]=i;
+
+			IssmDouble alpha;
+			IssmDouble G_rigid=0;  //do not remove =0!
+			IssmDouble G_elastic=0;  //do not remove =0!
+			IssmDouble delPhi,delLambda;
+
+			/*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)));
+
+			//Rigid earth gravitational perturbation:
+			if(computerigid)G_rigid=1.0/2.0/sin(alpha/2.0);
+
+			//Elastic component  (from Eq 17 in Adhikari et al, GMD 2015)
+			if(computeelastic){
+				int index=reCast<int,IssmDouble>(alpha/PI*reCast<IssmDouble,int>(M-1));
+				G_elastic += G_elastic_precomputed[index];
+			}
+
+			/*Add all components to the pSgi or pSgo solution vectors:*/
+			values[i]=3*rho_ice/rho_earth*area/eartharea*I*(G_rigid+G_elastic);
+		}
+		pSgi->SetValues(gsize,indices,values,ADD_VAL);
+		
+		/*free ressources:*/
+		xDelete<IssmDouble>(values);
+		xDelete<int>(indices);
+	}
+	
+	/*Assign output pointer:*/
+	*peustatic=eustatic;
+	return;
+}
+/*}}}*/
+void    Tria::SealevelriseNonEustatic(Vector<IssmDouble>* pSgo,IssmDouble* Sg_old,IssmDouble* latitude,IssmDouble* longitude,IssmDouble* radius,IssmDouble oceanarea,IssmDouble eartharea){ /*{{{*/
+
+	/*diverse:*/
+	int gsize;
+	bool spherical=true;
+	IssmDouble llr_list[NUMVERTICES][3];
+	IssmDouble area;
+	IssmDouble I;  //change in water water level(Farrel and Clarke, Equ. 4)
+	IssmDouble late,longe,re;
+	IssmDouble lati,longi,ri;
+	IssmDouble minlong=400;
+	IssmDouble maxlong=-20;
+
+	/*precomputed elastic green functions:*/
+	IssmDouble* G_elastic_precomputed = NULL;
+	int         M;
+	
+	/*computation of Green functions:*/
+	IssmDouble* G_elastic= NULL;
+	IssmDouble* G_rigid= NULL;
+
+	/*optimization:*/
+	bool store_green_functions=false;
+
+	/*ice properties: */
+	IssmDouble rho_ice,rho_water,rho_earth;
+
+	/*Computational flags:*/
+	bool computerigid = true;
+	bool computeelastic= true;
+
+	/*early return if we are not on the ocean:*/
+	if (!IsWaterInElement())return;
+
+	/*recover computational flags: */
+	this->parameters->FindParam(&computerigid,SealevelriseRigidEnum);
+	this->parameters->FindParam(&computeelastic,SealevelriseElasticEnum);
+	
+	/*early return if rigid or elastic not requested:*/
+	if(!computerigid && !computeelastic) return;
+
+	/*recover material parameters: */
+	rho_water=matpar->GetMaterialParameter(MaterialsRhoFreshwaterEnum);
+	rho_earth=matpar->GetMaterialParameter(MaterialsEarthDensityEnum);
+
+	/*how many dofs are we working with here? */
+	this->parameters->FindParam(&gsize,MeshNumberofverticesEnum);
+
+	/*From Sg_old, recover water sea level rise:*/
+	I=0; for(int i=0;i<NUMVERTICES;i++) I+=Sg_old[this->vertices[i]->Sid()]/NUMVERTICES;
+
+	/*Compute area of element:*/
+	area=GetArea3D();
+
+	/* 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
+	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;
+	/*}}}*/
+	
+	if(computeelastic){
+	
+		/*recover elastic green function:*/
+		DoubleVecParam* parameter = static_cast<DoubleVecParam*>(this->parameters->FindParamObject(SealevelriseGElasticEnum)); _assert_(parameter);
+		parameter->GetParameterValueByPointer(&G_elastic_precomputed,&M);
+
+		/*initialize G_elastic:*/
+		G_elastic=xNewZeroInit<IssmDouble>(gsize);
+	}
+	if(computerigid) G_rigid=xNewZeroInit<IssmDouble>(gsize);
+
+	int* indices=xNew<int>(gsize);
+	IssmDouble* values=xNewZeroInit<IssmDouble>(gsize);
+
+	for(int i=0;i<gsize;i++){
+
+		indices[i]=i; 
+		if(computeelastic | computerigid){
+	
+			IssmDouble alpha;
+			IssmDouble delPhi,delLambda;
+
+			/*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)));
+
+			//Rigid earth gravitational perturbation:
+			if(computerigid)G_rigid[i]=1.0/2.0/sin(alpha/2.0);
+
+			//Elastic component  (from Eq 17 in Adhikari et al, GMD 2015)
+			if(computeelastic){
+				int index=reCast<int,IssmDouble>(alpha/PI*(M-1));
+				G_elastic[i] += G_elastic_precomputed[index];
+			}
+		}
+
+		/*Add all components to the pSgo solution vectors:*/
+		if(computerigid)values[i]+=3*rho_water/rho_earth*area/eartharea*I*G_rigid[i];
+		if(computeelastic)values[i]+=3*rho_water/rho_earth*area/eartharea*I*G_elastic[i];
+	}
+	
+	pSgo->SetValues(gsize,indices,values,ADD_VAL);
+
+	/*free ressources:*/
+	xDelete<IssmDouble>(values);
+	xDelete<int>(indices);
+
+	/*Free ressources:*/
+	if(computeelastic) xDelete<IssmDouble>(G_elastic);
+	if(computerigid) xDelete<IssmDouble>(G_rigid);
+
+	return;
+}
+/*}}}*/
+IssmDouble Tria::OceanAverage(IssmDouble* Sg){ /*{{{*/
+
+	if(IsWaterInElement()){
+		
+		IssmDouble area;
+
+		/*Compute area of element:*/
+		area=GetArea3D();
+
+		/*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;
+
+}
+/*}}}*/
+IssmDouble    Tria::OceanArea(void){ /*{{{*/
+
+	if(IsWaterInElement()) return GetArea3D();
+	else return 0;
+
+}
+/*}}}*/
+#endif
+
+
 #ifdef _HAVE_DAKOTA_
 void       Tria::InputUpdateFromMatrixDakota(IssmDouble* matrix, int nrows, int ncols, int name, int type){/*{{{*/
 

Modified: issm/trunk/src/c/classes/Elements/Tria.h
===================================================================
--- issm/trunk/src/c/classes/Elements/Tria.h	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/classes/Elements/Tria.h	2016-04-13 04:32:01 UTC (rev 20500)
@@ -39,6 +39,7 @@
 		/*Object virtual functions definitions:{{{ */
 		int     ObjectEnum();
 		Object *copy();
+		void    Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction);
 		/*}}}*/
 		/*Update virtual functions resolution: {{{*/
 		#ifdef _HAVE_DAKOTA_
@@ -51,8 +52,9 @@
 		/*Element virtual functions definitions: {{{*/
 		void        AverageOntoPartition(Vector<IssmDouble>* partition_contributions,Vector<IssmDouble>* partition_areas,IssmDouble* vertex_response,IssmDouble* qmu_part);
 		void			CalvingRateLevermann();
-		void			CalvingRatePi();
 		void			CalvingRateDev();
+		void			WriteLevelsetSegment(DataSet* segments);
+		void        ResetLevelsetFromSegmentlist(IssmDouble* segments,int numsegments);
 		IssmDouble  CharacteristicLength(void);
 		void        ComputeBasalStress(Vector<IssmDouble>* sigma_b);
 		void        ComputeDeviatoricStressTensor();
@@ -62,8 +64,6 @@
 		void        Configure(Elements* elements,Loads* loads,Nodes* nodesin,Vertices* verticesin,Materials* materials,Parameters* parameters);
 		void        ControlInputSetGradient(IssmDouble* gradient,int enum_type,int control_index);
 		void        ControlToVectors(Vector<IssmPDouble>* vector_control, Vector<IssmPDouble>* vector_gradient,int control_enum);
-		void        Delta18oParameterization(void);
-		void        MungsmtpParameterization(void);
 		int         EdgeOnBaseIndex();
 		void        EdgeOnBaseIndices(int* pindex1,int* pindex);
 		int         EdgeOnSurfaceIndex();
@@ -71,6 +71,7 @@
 		void        ElementResponse(IssmDouble* presponse,int response_enum);
 		void        ElementSizes(IssmDouble* hx,IssmDouble* hy,IssmDouble* hz);
 		int         FiniteElement(void);
+		IssmDouble  FloatingArea(void);
 		void        FSContactMigration(Vector<IssmDouble>* vertexgrounded,Vector<IssmDouble>* vertexfloating);
 		Element*    GetBasalElement(void){_error_("not implemented yet");};
 		void        GetLevelsetPositivePart(int* point1,IssmDouble* fraction1,IssmDouble* fraction2, bool* mainlynegative,IssmDouble* levelsetvalues);
@@ -87,6 +88,7 @@
 		void        GetVectorFromControlInputs(Vector<IssmDouble>* gradient,int control_enum,int control_index,const char* data,bool onsid);
 		void        GetVerticesCoordinatesBase(IssmDouble** pxyz_list);
 		void        GetVerticesCoordinatesTop(IssmDouble** pxyz_list);
+		IssmDouble  GroundedArea(void);
 		bool        HasEdgeOnBase();
 		bool        HasEdgeOnSurface();
 		IssmDouble  IceMass(void);
@@ -111,7 +113,6 @@
 		int         NodalValue(IssmDouble* pvalue, int index, int natureofdataenum);
 		int         NumberofNodesPressure(void);
 		int         NumberofNodesVelocity(void);
-		void        PositiveDegreeDay(IssmDouble* pdds,IssmDouble* pds,IssmDouble signorm,bool ismungsm);
 		void        PotentialUngrounding(Vector<IssmDouble>* potential_sheet_ungrounding);
 		int         PressureInterpolation();
 		void        ReduceMatrices(ElementMatrix* Ke,ElementVector* pe);
@@ -127,6 +128,8 @@
 		IssmDouble  SurfaceArea(void);
 		int         TensorInterpolation();
 		IssmDouble  TimeAdapt();
+		IssmDouble  TotalFloatingBmb(void);
+		IssmDouble  TotalGroundedBmb(void);
 		IssmDouble  TotalSmb(void);
 		void        Update(int index, IoModel* iomodel,int analysis_counter,int analysis_type,int finitelement);
 		int         UpdatePotentialUngrounding(IssmDouble* vertices_potentially_ungrounding,Vector<IssmDouble>* vec_nodes_on_iceshelf,IssmDouble* nodes_on_iceshelf);
@@ -140,12 +143,19 @@
 		#ifdef _HAVE_GIA_
 		void   GiaDeflection(Vector<IssmDouble>* wg,Vector<IssmDouble>* dwgdt,IssmDouble* x,IssmDouble* y);
 		#endif
+		#ifdef _HAVE_SEALEVELRISE_
+		void    SealevelriseEustatic(Vector<IssmDouble>* pSgi,IssmDouble* peustatic,IssmDouble* latitude,IssmDouble* longitude,IssmDouble* radius,IssmDouble oceanarea,IssmDouble eartharea);
+		void    SealevelriseNonEustatic(Vector<IssmDouble>* pSgo,IssmDouble* Sg_old,IssmDouble* latitude,IssmDouble* longitude,IssmDouble* radius,IssmDouble oceanarea,IssmDouble eartharea);
+		IssmDouble OceanAverage(IssmDouble* Sg);
+		IssmDouble OceanArea(void);
+		#endif
 		/*}}}*/
 		/*Tria specific routines:{{{*/
 		void           AddBasalInput(int input_enum, IssmDouble* values, int interpolation_enum);
 		void           AddInput(int input_enum, IssmDouble* values, int interpolation_enum);
 		IssmDouble     GetArea(void);
-		IssmDouble 	GetAreaIce(void);
+		IssmDouble 	   GetArea3D(void);
+		IssmDouble 	   GetAreaIce(void);
 		void           GetAreaCoordinates(IssmDouble *area_coordinates,IssmDouble* xyz_zero,IssmDouble* xyz_list,int numpoints);
 		void		GetLevelsetIntersection(int** pindices, int* pnumiceverts, IssmDouble* fraction, int levelset_enum, IssmDouble level);
 		int            GetElementType(void);

Modified: issm/trunk/src/c/classes/Elements/TriaRef.h
===================================================================
--- issm/trunk/src/c/classes/Elements/TriaRef.h	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/classes/Elements/TriaRef.h	2016-04-13 04:32:01 UTC (rev 20500)
@@ -32,5 +32,7 @@
 		int  PressureInterpolation(int fe_stokes);
 		int  TensorInterpolation(int fe_stokes);
 		int  VelocityInterpolation(int fe_stokes);
+		void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ /*do nothing */};
+
 };
 #endif

Modified: issm/trunk/src/c/classes/ExternalResults/GenericExternalResult.h
===================================================================
--- issm/trunk/src/c/classes/ExternalResults/GenericExternalResult.h	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/classes/ExternalResults/GenericExternalResult.h	2016-04-13 04:32:01 UTC (rev 20500)
@@ -52,7 +52,22 @@
 			fwrite(&passiveDouble,sizeof(IssmPDouble),1,fid);
 			fwrite(&step,sizeof(int),1,fid);
 		} /*}}}*/
+		void GenericMarshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){/*{{{*/
 
+			MARSHALLING_ENUM(this->ObjectEnum());
+
+			bool isnull=true;
+			if(marshall_direction==MARSHALLING_FORWARD || marshall_direction == MARSHALLING_SIZE) if(value) isnull=false;
+
+			MARSHALLING(id);
+			MARSHALLING(result_name);
+			MARSHALLING(isnull)
+			if (!isnull) MARSHALLING(value) else value=0;
+			MARSHALLING(step);
+			MARSHALLING(time);
+
+		}  /*}}}*/
+
 		/*GenericExternalResult constructors and  destructors*/
 		GenericExternalResult(){ /*{{{*/
 			id          = 0;
@@ -61,6 +76,7 @@
 			N           = 0;
 			step        = 0;
 			time        = 0;
+			value       = NULL;
 		} /*}}}*/
 		GenericExternalResult(int in_id, int in_enum_type,ResultType in_values, int in_M,int in_N,int in_step,IssmDouble in_time){/*{{{*/
 			id          = 0;
@@ -69,6 +85,7 @@
 			N           = 0;
 			step        = 0;
 			time        = 0;
+			value       = in_values;
 			_error_("template GenericExternalResult(int in_id, int in_enum_type,double* in_values, int in_M,int in_N,int in_step,IssmDouble in_time) not implemented for this ResultType\n");
 		}
 /*}}}*/
@@ -77,16 +94,20 @@
 			value     = in_value;
 			step      = in_step;
 			time      = in_time;
+			M         = 1;
+			N         = 1;
 
 			/*Convert enum to name*/
 			EnumToStringx(&this->result_name,in_enum_type);
 		}
 		/*}}}*/
-		GenericExternalResult(int in_id, int in_enum_type,ResultType in_value,int in_step){ /*{{{*/
+		GenericExternalResult(int in_id, int in_enum_type,ResultType in_value){ /*{{{*/
 			id        = in_id;
 			value     = in_value;
-			step      = in_step;
+			step      = UNDEF;
 			time      = UNDEF;
+			M         = 1;
+			N         = 1;
 
 			/*Convert enum to name*/
 			EnumToStringx(&this->result_name,in_enum_type);
@@ -97,6 +118,8 @@
 			value     = in_value;
 			step      = in_step;
 			time      = in_time;
+			M         = 1;
+			N         = 1;
 
 			/*Copy name*/
 			this->result_name = xNew<char>(strlen(in_result_name)+1);
@@ -125,6 +148,10 @@
 		Object* copy(void) { /*{{{*/
 			return new GenericExternalResult<ResultType>(this->id,this->result_name,this->value,this->step,this->time);
 		} /*}}}*/
+		void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){/*{{{*/
+			_error_("not implemented yet!"); 
+		} 
+		/*}}}*/
 
 		/*GenericExternalResult management: */
 void  WriteData(FILE* fid,bool io_gather){ /*{{{*/
@@ -186,7 +213,12 @@
 template <> inline int GenericExternalResult<bool>::ObjectEnum(void){ /*{{{*/
 	return BoolExternalResultEnum;
 } /*}}}*/
+template <> inline void GenericExternalResult<bool>::Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){/*{{{*/
 
+	this->GenericMarshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
+
+}  /*}}}*/
+
 /*Specific instantiations for int: */
 template <> inline void GenericExternalResult<int>::DeepEcho(void){ /*{{{*/
 
@@ -198,7 +230,12 @@
 template <> inline int GenericExternalResult<int>::ObjectEnum(void){ /*{{{*/
 	return IntExternalResultEnum;
 } /*}}}*/
+template <> inline void GenericExternalResult<int>::Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){/*{{{*/
 
+	this->GenericMarshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
+
+}  /*}}}*/
+
 /*Specific instantiations for double: */
 template <> inline void GenericExternalResult<double>::DeepEcho(void){ /*{{{*/
 
@@ -213,7 +250,12 @@
 template <> inline double GenericExternalResult<double>::GetValue(void){ /*{{{*/
 	return value;
 } /*}}}*/
+template <> inline void GenericExternalResult<double>::Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){/*{{{*/
 
+	this->GenericMarshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
+
+}  /*}}}*/
+
 /*Specific instantiations for char*: */
 template <> inline GenericExternalResult<char*>::GenericExternalResult(int in_id, int in_enum_type,char* in_value,int in_step, IssmDouble in_time){ /*{{{*/
 
@@ -222,17 +264,19 @@
 	xMemCpy<char>(value,in_value,(strlen(in_value)+1));
 	step  = in_step;
 	time  = in_time;
+	M     = 1;
+	N     = 1;
 
 	/*Convert enum to name*/
 	EnumToStringx(&this->result_name,in_enum_type);
 
 } /*}}}*/
-template <> inline GenericExternalResult<char*>::GenericExternalResult(int in_id, int in_enum_type,char* in_value,int in_step){ /*{{{*/
+template <> inline GenericExternalResult<char*>::GenericExternalResult(int in_id, int in_enum_type,char* in_value){ /*{{{*/
 
 	id = in_id;
 	value = xNew<char>(strlen(in_value)+1);
 	xMemCpy<char>(value,in_value,(strlen(in_value)+1));
-	step  = in_step;
+	step = UNDEF;  
 	time  = UNDEF;
 
 	/*Convert enum to name*/
@@ -277,7 +321,21 @@
 template <> inline int GenericExternalResult<char*>::ObjectEnum(void){ /*{{{*/
 	return StringExternalResultEnum;
 } /*}}}*/
+template <> inline void GenericExternalResult<char*>::Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){/*{{{*/
 
+	int size;
+
+	if(marshall_direction==MARSHALLING_FORWARD || marshall_direction == MARSHALLING_SIZE)size=strlen(value)+1;
+
+	MARSHALLING(id);
+	MARSHALLING(result_name);
+	MARSHALLING(size);
+	MARSHALLING_DYNAMIC(value,char,size);
+	MARSHALLING(step);
+	MARSHALLING(time);
+
+}  /*}}}*/
+
 /*Specific instantiations for IssmPDouble*: */
 template <> inline GenericExternalResult<IssmPDouble*>::GenericExternalResult(int in_id, int in_enum_type,IssmPDouble* in_values, int in_M,int in_N,int in_step,IssmDouble in_time){/*{{{*/
 
@@ -375,7 +433,20 @@
 template <> inline double* GenericExternalResult<IssmPDouble*>::GetValues(void){ /*{{{*/
 	return value;
 } /*}}}*/
+template <> inline void GenericExternalResult<IssmPDouble*>::Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){/*{{{*/
 
+	MARSHALLING_ENUM(this->ObjectEnum());
+
+	MARSHALLING(id);
+	MARSHALLING(result_name);
+	MARSHALLING(M);
+	MARSHALLING(N);
+	MARSHALLING_DYNAMIC(value,IssmPDouble,M*N);
+	MARSHALLING(step);
+	MARSHALLING(time);
+
+}  /*}}}*/
+
 /*Specific instantiations for IssmDouble*: */
 #if defined(_HAVE_ADOLC_) && !defined(_WRAPPERS_)  //We hook off this specific specialization when not running ADOLC, otherwise we get a redeclaration with the next specialization. 
 template <> inline void GenericExternalResult<IssmDouble*>::WriteData(FILE* fid,bool io_gather){ /*{{{*/
@@ -549,5 +620,10 @@
 
 }
 /*}}}*/
+template <> inline void GenericExternalResult<Vector<IssmDouble>*>::Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){/*{{{*/
 
+	_error_("GenericExternalResult instantiated for type Vector<IssmDouble>* called " << result_name << " not implemented yet");
+
+}  /*}}}*/
+
 #endif  /* _EXTERNAL_RESULTOBJECT_H */

Modified: issm/trunk/src/c/classes/FemModel.cpp
===================================================================
--- issm/trunk/src/c/classes/FemModel.cpp	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/classes/FemModel.cpp	2016-04-13 04:32:01 UTC (rev 20500)
@@ -53,15 +53,15 @@
 	char *binfilename    = NULL;
 	char *outbinfilename = NULL;
 	char *petscfilename  = NULL;
+	char *restartfilename  = NULL;
 	char *rootpath       = NULL;
 
 	/*First things first, store the communicator, and set it as a global variable: */
-	this->comm=incomm;
-	this->SetStaticComm();
+	IssmComm::SetComm(incomm);
 
 	/*Now, initialize PETSC: */
 	#ifdef _HAVE_PETSC_
-	PETSC_COMM_WORLD=this->comm;
+	PETSC_COMM_WORLD=incomm;
 	ierr=PetscInitialize(&argc,&argv,(char*)0,"");  if(ierr) _error_("Could not initialize Petsc");
 	#endif
 
@@ -70,34 +70,41 @@
 	profiler->Tag(Start);
 
 	/*From command line arguments, retrieve different filenames needed to create the FemModel: */
-	ProcessArguments(&solution_type,&binfilename,&outbinfilename,&petscfilename,&lockfilename,&rootpath,argc,argv);
+	ProcessArguments(&solution_type,&binfilename,&outbinfilename,&petscfilename,&lockfilename,&restartfilename,&rootpath,argc,argv);
 
 	/*Create femmodel from input files: */
 	profiler->Tag(StartInit);
-	this->InitFromFiles(rootpath,binfilename,outbinfilename,petscfilename,lockfilename,solution_type,trace,NULL);
+	this->InitFromFiles(rootpath,binfilename,outbinfilename,petscfilename,lockfilename,restartfilename, solution_type,trace,NULL);
 	profiler->Tag(FinishInit);
 
+	/*Save communicator in the parameters dataset: */
+	this->parameters->AddObject(new GenericParam<ISSM_MPI_Comm>(incomm,FemModelCommEnum));
+
+
 	/*Free resources */
 	xDelete<char>(lockfilename);
 	xDelete<char>(binfilename);
 	xDelete<char>(outbinfilename);
 	xDelete<char>(petscfilename);
+	xDelete<char>(restartfilename);
 	xDelete<char>(rootpath);
 
 }
 /*}}}*/
-FemModel::FemModel(char* rootpath, char* inputfilename, char* outputfilename, char* toolkitsfilename, char* lockfilename, ISSM_MPI_Comm incomm, int solution_type,IssmPDouble* X){ /*{{{*/
+FemModel::FemModel(char* rootpath, char* inputfilename, char* outputfilename, char* toolkitsfilename, char* lockfilename, char* restartfilename, ISSM_MPI_Comm incomm, int solution_type,IssmPDouble* X){ /*{{{*/
 
 	bool traceon=true;
 	this->profiler=NULL; /*avoid leak, as we are not using the profiler ever in ad control run. */
 	
 	/*Store the communicator, but do not set it as a global variable, as this has already 
 	 * been done by the FemModel that called this copy constructor: */
-	this->comm=incomm;
-	this->SetStaticComm();
+	IssmComm::SetComm(incomm);
 
 	/*Create femmodel from input files, with trace activated: */
-	this->InitFromFiles(rootpath,inputfilename,outputfilename,toolkitsfilename,lockfilename,solution_type,traceon,X);
+	this->InitFromFiles(rootpath,inputfilename,outputfilename,toolkitsfilename,lockfilename,restartfilename, solution_type,traceon,X);
+	
+	/*Save communicator in the parameters dataset: */
+	this->parameters->AddObject(new GenericParam<ISSM_MPI_Comm>(incomm,FemModelCommEnum));
 
 }
 /*}}}*/
@@ -108,8 +115,10 @@
 	char *outbinfilename = NULL;
 	char *lockfilename   = NULL;
 
-	this->parameters->FindParam(&outbinfilename,OutputFileNameEnum);
-	this->parameters->FindParam(&lockfilename,LockFileNameEnum);
+	#ifndef _HAVE_JAVASCRIPT_
+	if(this->parameters->Exist(OutputFileNameEnum)) this->parameters->FindParam(&outbinfilename,OutputFileNameEnum);
+	if(this-parameters->Exist(LockFileNameEnum)) this->parameters->FindParam(&lockfilename,LockFileNameEnum);
+	#endif
 
 	/*Delete all the datasets: */
 	if(analysis_type_list)xDelete<int>(analysis_type_list);
@@ -126,6 +135,8 @@
 
 	/*Now delete: */
 	if(profiler)delete profiler;
+	
+	
 }
 /*}}}*/
 
@@ -141,7 +152,7 @@
 
 }
 /*}}}*/
-void FemModel::InitFromFiles(char* rootpath, char* inputfilename, char* outputfilename, char* toolkitsfilename, char* lockfilename, const int in_solution_type,bool trace,IssmPDouble* X){/*{{{*/
+void FemModel::InitFromFiles(char* rootpath, char* inputfilename, char* outputfilename, char* toolkitsfilename, char* lockfilename, char* restartfilename, const int in_solution_type,bool trace,IssmPDouble* X){/*{{{*/
 
 	/*intermediary*/
 	int         i;
@@ -160,7 +171,7 @@
 	this->results          = new Results(); //not initialized by CreateDataSets
 	/*Open input file on cpu 0 and create IoModel */
 	if(my_rank==0) IOMODEL = pfopen0(inputfilename ,"rb");
-	IoModel* iomodel = new IoModel(IOMODEL,trace,X);
+	IoModel* iomodel = new IoModel(IOMODEL,in_solution_type,trace,X);
 
 	/*Figure out what analyses are activated for this solution*/
 	SolutionAnalysesList(&this->analysis_type_list,&this->nummodels,iomodel,this->solution_type);
@@ -171,6 +182,7 @@
 	/*create datasets for all analyses*/
 	ModelProcessorx(&this->elements,&this->nodes,&this->vertices,&this->materials,&this->constraints,&this->loads,&this->parameters,iomodel,toolkitsoptionsfid,rootpath,this->solution_type,this->nummodels,this->analysis_type_list);
 
+
 	/*do the post-processing of the datasets to get an FemModel that can actually run analyses: */
 	for(i=0;i<nummodels;i++){
 
@@ -178,9 +190,15 @@
 		analysis_type=analysis_type_list[i];
 		this->SetCurrentConfiguration(analysis_type);
 
+		if(VerboseMProcessor()) _printf0_("      configuring element and loads\n");
+		ConfigureObjectsx(elements, loads, nodes, vertices, materials,parameters);
+
 		if(i==0){
 			if(VerboseMProcessor()) _printf0_("      creating vertex PIDs\n");
-			VerticesDofx(vertices,parameters); //only call once, we only have one set of vertices
+			VerticesDofx(vertices,parameters); 
+
+			if(VerboseMProcessor()) _printf0_("      detecting active vertices\n");
+			GetMaskOfIceVerticesLSMx(this);
 		}
 
 		if(VerboseMProcessor()) _printf0_("      resolving node constraints\n");
@@ -188,9 +206,6 @@
 
 		if(VerboseMProcessor()) _printf0_("      creating nodal degrees of freedom\n");
 		NodesDofx(nodes,parameters,analysis_type);
-
-		if(VerboseMProcessor()) _printf0_("      configuring element and loads\n");
-		ConfigureObjectsx(elements, loads, nodes, vertices, materials,parameters);
 	}
 
 	/*Close input file and toolkits file descriptors: */
@@ -207,6 +222,7 @@
 	this->parameters->AddObject(new StringParam(InputFileNameEnum,inputfilename));
 	this->parameters->AddObject(new StringParam(OutputFileNameEnum,outputfilename));
 	this->parameters->AddObject(new StringParam(LockFileNameEnum,lockfilename));
+	this->parameters->AddObject(new StringParam(RestartFileNameEnum,restartfilename));
 
 	/*Clean up*/
 	delete iomodel;
@@ -251,21 +267,12 @@
 	PetscFinalize();
 	#endif
 
-
 	/*Clean up*/
 	xDelete<char>(outbinfilename);
 	xDelete<char>(lockfilename);
 
 }
 /*}}}*/
-void FemModel::SetStaticComm(void){/*{{{*/
-
-	/*This routine sets the global communicator variable hidden inside the IssmComm 
-	 *class: */
-	IssmComm::SetComm(this->comm);
-
-}
-/*}}}*/
 void FemModel::SetCurrentConfiguration(int configuration_type,int analysis_type){/*{{{*/
 
 	/*Use configuration_type to setup the analysis counter, the configurations of objects etc ... but use 
@@ -373,7 +380,6 @@
 
 	output=new FemModel(*this); //Use default copy constructor.
 
-	output->comm = this->comm;
 	output->nummodels = this->nummodels;
 	output->solution_type = this->solution_type;
 	output->analysis_counter = this->analysis_counter;
@@ -409,6 +415,10 @@
 		ConfigureObjectsx(output->elements,output->loads,output->nodes,output->vertices,output->materials,output->parameters);
 	}
 
+	/*Reset current configuration: */
+	analysis_type=output->analysis_type_list[analysis_counter];
+	output->SetCurrentConfiguration(analysis_type);
+
 	return output;
 }
 /*}}}*/
@@ -488,6 +498,7 @@
 
 		case MasstransportSolutionEnum:
 			analyses_temp[numanalyses++]=MasstransportAnalysisEnum;
+			analyses_temp[numanalyses++]=SmbAnalysisEnum;
 			break;
 
 		case BalancethicknessSolutionEnum:
@@ -521,22 +532,32 @@
 			analyses_temp[numanalyses++]=GiaAnalysisEnum;
 			break;
 		
+		case SealevelriseSolutionEnum:
+			analyses_temp[numanalyses++]=SealevelriseAnalysisEnum;
+			break;
+
+		case SmbSolutionEnum:
+			analyses_temp[numanalyses++]=SmbAnalysisEnum;
+			break;
+
 		case DamageEvolutionSolutionEnum:
 			analyses_temp[numanalyses++]=DamageEvolutionAnalysisEnum;
 			break;
 
 		case TransientSolutionEnum:{
-			bool isSIA,isFS,isthermal,isenthalpy,ismasstransport,isgroundingline,isstressbalance,islevelset,ishydrology,isdamage;
+			bool isSIA,isFS,isthermal,isenthalpy,ismasstransport,isgroundingline,isstressbalance,ismovingfront,ishydrology,isdamage,issmb,isslr;
 			iomodel->Constant(&isSIA,FlowequationIsSIAEnum);
 			iomodel->Constant(&isFS,FlowequationIsFSEnum);
 			iomodel->Constant(&isthermal,TransientIsthermalEnum);
 			iomodel->Constant(&isenthalpy,ThermalIsenthalpyEnum);
-			iomodel->Constant(&islevelset,TransientIslevelsetEnum);
+			iomodel->Constant(&ismovingfront,TransientIsmovingfrontEnum);
 			iomodel->Constant(&ismasstransport,TransientIsmasstransportEnum);
 			iomodel->Constant(&isstressbalance,TransientIsstressbalanceEnum);
 			iomodel->Constant(&isgroundingline,TransientIsgroundinglineEnum);
 			iomodel->Constant(&isdamage,TransientIsdamageevolutionEnum);
 			iomodel->Constant(&ishydrology,TransientIshydrologyEnum);
+			iomodel->Constant(&issmb,TransientIssmbEnum);
+			iomodel->Constant(&isslr,TransientIsslrEnum);
 			if(isstressbalance){
 				int  fe_FS;
 				iomodel->Constant(&fe_FS,FlowequationFeFSEnum);
@@ -562,13 +583,15 @@
 			if(ismasstransport || isgroundingline){
 				analyses_temp[numanalyses++]=MasstransportAnalysisEnum;
 			}
-			if(islevelset){
+			if(issmb) analyses_temp[numanalyses++]=SmbAnalysisEnum;
+			if(ismovingfront){
 				analyses_temp[numanalyses++]=LevelsetAnalysisEnum;
 				analyses_temp[numanalyses++]=ExtrapolationAnalysisEnum;
 				analyses_temp[numanalyses++]=LsfReinitializationAnalysisEnum;
 			}
 			if(ishydrology){
 				analyses_temp[numanalyses++]=HydrologyShreveAnalysisEnum;
+				analyses_temp[numanalyses++]=HydrologySommersAnalysisEnum;
 				analyses_temp[numanalyses++]=HydrologyDCInefficientAnalysisEnum;
 				analyses_temp[numanalyses++]=HydrologyDCEfficientAnalysisEnum;
 				analyses_temp[numanalyses++]=L2ProjectionEPLAnalysisEnum;
@@ -576,6 +599,9 @@
 			if(isdamage){
 				analyses_temp[numanalyses++]=DamageEvolutionAnalysisEnum;
 			}
+			if(isslr){
+				analyses_temp[numanalyses++]=SealevelriseAnalysisEnum;
+			}
 
 			if(iomodel->domaintype==Domain2DverticalEnum || iomodel->domaintype==Domain3DEnum){
 				analyses_temp[numanalyses++]=ExtrudeFromBaseAnalysisEnum;
@@ -602,12 +628,175 @@
 	if(panalyses)    *panalyses=analyses;
 	else              xDelete<int>(analyses);
 }/*}}}*/
+void FemModel::CheckPoint(void){/*{{{*/
 
+	FILE* restartfid=NULL;
+	char* restartfilename = NULL;
+	int   femmodel_size;
+	char* femmodel_buffer=NULL;
+	char* femmodel_buffer_ini=NULL;
+
+	/*First, recover the name of the restart file: */
+	parameters->FindParam(&restartfilename,RestartFileNameEnum);
+	
+	/*Open file for writing: */
+	restartfid=pfopen(restartfilename,"wb");
+
+	/*Initialize: */
+	femmodel_size=0;
+
+	/*Create buffer to hold marshalled femmodel: */
+	this->Marshall(NULL,&femmodel_size,MARSHALLING_SIZE);
+	femmodel_buffer=xNew<char>(femmodel_size); 
+	/*Keep track of initial position of femmodel_buffer: */
+	femmodel_buffer_ini=femmodel_buffer;
+	
+	/*Marshall:*/
+	this->Marshall(&femmodel_buffer,NULL,MARSHALLING_FORWARD);
+
+	/*Reset position of buffer: */
+	femmodel_buffer=femmodel_buffer_ini;
+
+	/*write buffer: */
+	fwrite(femmodel_buffer,femmodel_size,sizeof(char),restartfid);
+
+	/*Done, close file :*/
+	pfclose(restartfid,restartfilename);
+
+	/*Free ressources: */
+	xDelete<char>(femmodel_buffer);
+	xDelete<char>(restartfilename);
+
+}
+/*}}}*/
+void FemModel::Restart(){ /*{{{*/
+
+	FILE* restartfid=NULL;
+	FILE* output_fid=NULL;
+	char* restartfilename = NULL;
+	int   femmodel_size=0; 
+	int   fread_return=0; 
+	char* femmodel_buffer=NULL;
+	char* femmodel_buffer_ini=NULL;
+
+	/*First, recover the name of the restart file: */
+	parameters->FindParam(&restartfilename,RestartFileNameEnum);
+
+	/*Now, figure out whether this file actually exists!: */
+	restartfid=pfopen(restartfilename,"r",false);
+
+	if(restartfid==NULL){
+		xDelete<char>(restartfilename);
+		return; //could not find the file, so no restart possible.
+	}
+
+	/*Figure out size of buffer to be read: */
+	fseek(restartfid, 0L, SEEK_END); 
+	femmodel_size = ftell(restartfid);
+	fseek(restartfid, 0L, SEEK_SET);
+
+	/*Allocate buffer: */
+	femmodel_buffer=xNew<char>(femmodel_size); 
+
+	/*Read buffer from file: */
+	fread_return=fread(femmodel_buffer,femmodel_size,sizeof(char),restartfid); if(fread_return!=1)_error_("error reading the buffer from marshalled file!");
+	femmodel_buffer_ini=femmodel_buffer; //keep track of the initial position, so as to free later.
+
+	this->parameters->FindParam(&output_fid,OutputFilePointerEnum);
+
+	/*Create new FemModel by demarshalling the buffer: */
+	this->Marshall(&femmodel_buffer,NULL,MARSHALLING_BACKWARD);
+
+	this->parameters->SetParam(output_fid,OutputFilePointerEnum);
+
+	/*Reset position of buffer: */
+	femmodel_buffer=femmodel_buffer_ini;
+
+	/*Done, close file :*/
+	pfclose(restartfid,restartfilename);
+
+	/*Free ressources: */
+	xDelete<char>(restartfilename);
+	xDelete<char>(femmodel_buffer);
+	
+}
+/*}}}*/
+void FemModel::Marshall(char** pmarshalled_data, int* pmarshalled_data_size, int marshall_direction){ /*{{{*/
+
+	int       i;
+	int       analysis_type;
+
+	if(marshall_direction==MARSHALLING_BACKWARD){
+		delete this->profiler;
+		delete this->loads;
+		delete this->materials;
+		delete this->parameters;
+		delete this->constraints;
+		delete this->results;
+		delete this->nodes;
+		delete this->vertices;
+		delete this->elements;
+		xDelete<int>(this->analysis_type_list);
+
+		this->profiler    = new Profiler();
+		this->loads       = new Loads();
+		this->materials   = new Materials();
+		this->parameters  = new Parameters();
+		this->constraints = new Constraints();
+		this->results     = new Results();
+		this->nodes       = new Nodes();
+		this->vertices    = new Vertices();
+		this->elements    = new Elements();
+	}
+
+	MARSHALLING_ENUM(FemModelEnum);
+
+	MARSHALLING(solution_type);
+	MARSHALLING(analysis_counter);
+	MARSHALLING(nummodels);
+	MARSHALLING_DYNAMIC(analysis_type_list,int,nummodels);
+
+	this->profiler->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
+	this->loads->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
+	this->materials->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
+	this->parameters->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
+	this->constraints->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
+	this->results->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
+	this->nodes->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
+	this->vertices->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
+	this->elements->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
+
+	if(marshall_direction==MARSHALLING_BACKWARD){
+		//reset hooks for elements, loads and nodes:
+		this->elements->ResetHooks();
+		this->loads->ResetHooks();
+		this->materials->ResetHooks();
+
+		//do the post-processing of the datasets to get an FemModel that can actually run analyses:
+		for(i=0;i<nummodels;i++){
+			analysis_type=this->analysis_type_list[i];
+			SetCurrentConfiguration(analysis_type);
+			if(i==0) VerticesDofx(this->vertices,this->parameters); //only call once, we only have one set of vertices
+			SpcNodesx(this->nodes,this->constraints,this->parameters,analysis_type);
+			NodesDofx(this->nodes,this->parameters,analysis_type);
+			ConfigureObjectsx(this->elements,this->loads,this->nodes,this->vertices,this->materials,this->parameters);
+		}
+
+		//Reset current configuration:
+		analysis_type=this->analysis_type_list[analysis_counter];
+		SetCurrentConfiguration(analysis_type);
+	}
+
+}
+/*}}}*/
+
 /*Modules:*/
 int  FemModel::UpdateVertexPositionsx(void){ /*{{{*/
 
 	IssmDouble         *surface = NULL;
 	IssmDouble         *bed     = NULL;
+			
+	if(VerboseSolution()) _printf0_("   updating vertices positions\n");
 
 	/*get vertex vectors for bed and thickness: */
 	GetVectorFromInputsx(&surface  ,this, SurfaceEnum,VertexPIdEnum);
@@ -676,6 +865,57 @@
 
 }
 /*}}}*/
+void FemModel::ResetLevelset(void){/*{{{*/
+
+	/*recover my_rank:*/
+	int my_rank   = IssmComm::GetRank();
+	int num_procs = IssmComm::GetSize();
+
+	/*1: go throug all elements of this partition and figure out how many
+	 * segments we have (corresopnding to levelset = 0)*/
+	DataSet* segments=new DataSet();
+	for(int i=0;i<elements->Size();i++){
+		Element* element=dynamic_cast<Element*>(this->elements->GetObjectByOffset(i));
+		element->WriteLevelsetSegment(segments);
+	}
+
+	/*2: now get the segments from all partitions*/
+	int  segcount=segments->Size();
+	int* allsegcount=xNew<int>(num_procs);
+	ISSM_MPI_Gather(&segcount,1,ISSM_MPI_INT,allsegcount,1,ISSM_MPI_INT,0,IssmComm::GetComm());
+	ISSM_MPI_Bcast(allsegcount,num_procs,ISSM_MPI_INT,0,IssmComm::GetComm());
+
+	/* Every cpu should start its own dof count at the end of the dofcount from cpu-1*/
+	int numseg_offset=0;
+	int numseg=0;
+	for(int i=0;i<my_rank;  i++) numseg_offset+=allsegcount[i];
+	for(int i=0;i<num_procs;i++) numseg+=allsegcount[i];
+	IssmDouble* segmentlist    = xNewZeroInit<IssmDouble>(4*numseg);
+	IssmDouble* allsegmentlist = xNewZeroInit<IssmDouble>(4*numseg);
+	for(int i=0;i<segments->Size();i++){
+		Contour<IssmDouble>* segment=(Contour<IssmDouble>*)segments->GetObjectByOffset(i);
+		_assert_(segment->nods == 2);
+		segmentlist[(numseg_offset+i)*4 + 0] = segment->x[0];
+		segmentlist[(numseg_offset+i)*4 + 1] = segment->y[0];
+		segmentlist[(numseg_offset+i)*4 + 2] = segment->x[1];
+		segmentlist[(numseg_offset+i)*4 + 3] = segment->y[1];
+	}
+	ISSM_MPI_Allreduce((void*)segmentlist,(void*)allsegmentlist,4*numseg,ISSM_MPI_DOUBLE,ISSM_MPI_SUM,IssmComm::GetComm());
+	delete segments;
+	xDelete<IssmDouble>(segmentlist);
+	xDelete<int>(allsegcount);
+
+	/*3: update levelset for all elements*/
+	for(int i=0;i<elements->Size();i++){
+		Element* element=dynamic_cast<Element*>(this->elements->GetObjectByOffset(i));
+		element->ResetLevelsetFromSegmentlist(allsegmentlist,numseg);
+	}
+
+	/*Clean up and return*/
+	xDelete<IssmDouble>(allsegmentlist);
+
+}
+/*}}}*/
 void FemModel::Responsex(IssmDouble* responses,const char* response_descriptor){/*{{{*/
 
 	int response_descriptor_enum=StringToEnumx(response_descriptor);
@@ -692,6 +932,8 @@
 		case IceMassEnum:                  this->IceMassx(responses); break;
 		case IceVolumeEnum:                this->IceVolumex(responses); break;
 		case IceVolumeAboveFloatationEnum: this->IceVolumeAboveFloatationx(responses); break;
+		case GroundedAreaEnum:             this->GroundedAreax(responses); break;
+		case FloatingAreaEnum:             this->FloatingAreax(responses); break;
 		case MinVelEnum:                   this->MinVelx(responses); break;
 		case MaxVelEnum:                   this->MaxVelx(responses); break;
 		case MinVxEnum:                    this->MinVxx(responses); break;
@@ -716,6 +958,8 @@
 		case RheologyBbarAbsGradientEnum:  RheologyBbarAbsGradientx(responses, elements,nodes, vertices, loads, materials, parameters); break;
 		case DragCoefficientAbsGradientEnum:DragCoefficientAbsGradientx(responses, elements,nodes, vertices, loads, materials, parameters); break;
 		case BalancethicknessMisfitEnum:   BalancethicknessMisfitx(responses); break;
+		case TotalFloatingBmbEnum:			  this->TotalFloatingBmbx(responses); break;
+		case TotalGroundedBmbEnum:			  this->TotalGroundedBmbx(responses); break;
 		case TotalSmbEnum:					  this->TotalSmbx(responses); break;
 		case MaterialsRheologyBbarEnum:    this->ElementResponsex(responses,MaterialsRheologyBbarEnum); break;
 		case VelEnum:                      this->ElementResponsex(responses,VelEnum); break;
@@ -773,9 +1017,11 @@
 					/*Scalar output*/
 					case DivergenceEnum:               this->Divergencex(&double_result);               break;
 					case MaxDivergenceEnum:            this->MaxDivergencex(&double_result);            break;
-					case IceMassEnum:                this->IceMassx(&double_result);                break;
+					case IceMassEnum:                  this->IceMassx(&double_result);                  break;
 					case IceVolumeEnum:                this->IceVolumex(&double_result);                break;
 					case IceVolumeAboveFloatationEnum: this->IceVolumeAboveFloatationx(&double_result); break;
+					case GroundedAreaEnum:             this->GroundedAreax(&double_result);             break;
+					case FloatingAreaEnum:             this->FloatingAreax(&double_result);             break;
 					case MinVelEnum:                   this->MinVelx(&double_result);                   break;
 					case MaxVelEnum:                   this->MaxVelx(&double_result);                   break;
 					case MinVxEnum:                    this->MinVxx(&double_result);                    break;
@@ -788,6 +1034,8 @@
 					case MaxVzEnum:                    this->MaxVzx(&double_result);                    break;
 					case MaxAbsVzEnum:                 this->MaxAbsVzx(&double_result);                 break;
 					case MassFluxEnum:                 this->MassFluxx(&double_result);                 break;
+					case TotalFloatingBmbEnum:         this->TotalFloatingBmbx(&double_result);         break;
+					case TotalGroundedBmbEnum:         this->TotalGroundedBmbx(&double_result);         break;
 					case TotalSmbEnum:                 this->TotalSmbx(&double_result);                 break;
 
 			   /*Scalar control output*/
@@ -800,8 +1048,9 @@
 				case ThicknessAbsGradientEnum:      this->ThicknessAbsGradientx(&double_result);                                                    break;
 				case ThicknessAlongGradientEnum:    ThicknessAlongGradientx(&double_result,elements,nodes,vertices,loads,materials,parameters);     break;
 				case ThicknessAcrossGradientEnum:   ThicknessAcrossGradientx(&double_result,elements,nodes,vertices,loads,materials,parameters);    break;
+				case ThicknessPositiveEnum:         this->ThicknessPositivex(&double_result);                                                       break;
 				case RheologyBbarAbsGradientEnum:   RheologyBbarAbsGradientx(&double_result,elements,nodes,vertices,loads,materials,parameters);    break;
-				case RheologyBAbsGradientEnum:      RheologyBAbsGradientx(&double_result,elements,nodes,vertices,loads,materials,parameters);  break;
+				case RheologyBAbsGradientEnum:      RheologyBAbsGradientx(&double_result,elements,nodes,vertices,loads,materials,parameters);       break;
 				case DragCoefficientAbsGradientEnum:DragCoefficientAbsGradientx(&double_result,elements,nodes,vertices,loads,materials,parameters); break;
 				case BalancethicknessMisfitEnum:    BalancethicknessMisfitx(&double_result);                                                        break;
 				case SurfaceAbsMisfitEnum:          SurfaceAbsMisfitx(&double_result); break;
@@ -810,21 +1059,26 @@
 					default:
 
 						/*Vector layout*/
-						int interpolation,nodesperelement,size;
-						int rank_interpolation=-1,rank_nodesperelement=-1;
+						int interpolation,nodesperelement,size,nlines,ncols,array_size;
+						int rank_interpolation=-1,rank_nodesperelement=-1,rank_arraysize=-1,max_rank_arraysize=0;
+						bool isarray=false;
 
 						/*Get interpolation (and compute input if necessary)*/
 						for(int j=0;j<elements->Size();j++){
 							Element* element=xDynamicCast<Element*>(this->elements->GetObjectByOffset(j));
-							element->ResultInterpolation(&rank_interpolation,&rank_nodesperelement,output_enum);
+							element->ResultInterpolation(&rank_interpolation,&rank_nodesperelement,&rank_arraysize,output_enum);
+							if (rank_arraysize>max_rank_arraysize)max_rank_arraysize=rank_arraysize;
 						}
+						rank_arraysize=max_rank_arraysize;
 
 						/*Broadcast for cpus that do not have any elements*/
 						ISSM_MPI_Reduce(&rank_interpolation,&interpolation,1,ISSM_MPI_INT,ISSM_MPI_MAX,0,IssmComm::GetComm());
 						ISSM_MPI_Reduce(&rank_nodesperelement,&nodesperelement,1,ISSM_MPI_INT,ISSM_MPI_MAX,0,IssmComm::GetComm());
+						ISSM_MPI_Reduce(&rank_arraysize,&array_size,1,ISSM_MPI_INT,ISSM_MPI_MAX,0,IssmComm::GetComm());
 						ISSM_MPI_Bcast(&interpolation,1,ISSM_MPI_INT,0,IssmComm::GetComm());
 						ISSM_MPI_Bcast(&nodesperelement,1,ISSM_MPI_INT,0,IssmComm::GetComm());
-
+						ISSM_MPI_Bcast(&array_size,1,ISSM_MPI_INT,0,IssmComm::GetComm());
+						
 						if(results_on_nodes){
 
 							/*Allocate matrices*/
@@ -850,21 +1104,40 @@
 
 							/*Allocate vector depending on interpolation*/
 							switch(interpolation){
-								case P0Enum: size = this->elements->NumberOfElements(); break;
-								case P1Enum: size = this->vertices->NumberOfVertices(); break;
+								case P0Enum: isarray = false; size = this->elements->NumberOfElements(); break;
+								case P1Enum: isarray = false; size = this->vertices->NumberOfVertices(); break;
+								case P0ArrayEnum: isarray = true; nlines = this->elements->NumberOfElements(); ncols= array_size; break;
 								default:     _error_("Interpolation "<<EnumToStringx(interpolation)<<" not supported yet");
 
 							}
-							Vector<IssmDouble> *vector_result = new Vector<IssmDouble>(size);
+							if (!isarray){
+								Vector<IssmDouble> *vector_result = new Vector<IssmDouble>(size);
 
-							/*Fill in vector*/
-							for(int j=0;j<elements->Size();j++){
-								Element* element=(Element*)elements->GetObjectByOffset(j);
-								element->ResultToVector(vector_result,output_enum);
+								/*Fill in vector*/
+								for(int j=0;j<elements->Size();j++){
+									Element* element=(Element*)elements->GetObjectByOffset(j);
+									element->ResultToVector(vector_result,output_enum);
+								}
+								vector_result->Assemble();
+
+								if(save_results)results->AddResult(new GenericExternalResult<Vector<IssmDouble>*>(results->Size()+1,output_enum,vector_result,step,time));
 							}
-							vector_result->Assemble();
-
-							if(save_results)results->AddResult(new GenericExternalResult<Vector<IssmDouble>*>(results->Size()+1,output_enum,vector_result,step,time));
+							else{
+								IssmDouble* values    = xNewZeroInit<IssmDouble>(nlines*ncols);
+								IssmDouble* allvalues = xNew<IssmDouble>(nlines*ncols);
+								
+								/*Fill-in matrix*/
+								for(int j=0;j<elements->Size();j++){
+									Element* element=xDynamicCast<Element*>(this->elements->GetObjectByOffset(j));
+									element->ResultToMatrix(values,ncols, output_enum);
+								}
+								/*Gather from all cpus*/
+								ISSM_MPI_Allreduce((void*)values,(void*)allvalues,ncols*nlines,ISSM_MPI_PDOUBLE,ISSM_MPI_SUM,IssmComm::GetComm());
+								xDelete<IssmDouble>(values);
+								
+								if(save_results)results->AddResult(new GenericExternalResult<IssmDouble*>(results->Size()+1,output_enum,allvalues,nlines,ncols,step,time));
+								xDelete<IssmDouble>(allvalues);
+							}
 						}
 						isvec = true;
 						break;
@@ -1307,6 +1580,38 @@
 	*pminvz=minvz;
 
 }/*}}}*/
+void FemModel::TotalFloatingBmbx(IssmDouble* pFbmb){/*{{{*/
+
+	IssmDouble local_fbmb = 0;
+	IssmDouble total_fbmb;
+
+	for(int i=0;i<this->elements->Size();i++){
+		Element* element=xDynamicCast<Element*>(this->elements->GetObjectByOffset(i));
+		local_fbmb+=element->TotalFloatingBmb();
+	}
+	ISSM_MPI_Reduce(&local_fbmb,&total_fbmb,1,ISSM_MPI_DOUBLE,ISSM_MPI_SUM,0,IssmComm::GetComm() );
+	ISSM_MPI_Bcast(&total_fbmb,1,ISSM_MPI_DOUBLE,0,IssmComm::GetComm());
+
+	/*Assign output pointers: */
+	*pFbmb=total_fbmb;
+
+}/*}}}*/
+void FemModel::TotalGroundedBmbx(IssmDouble* pGbmb){/*{{{*/
+
+	IssmDouble local_gbmb = 0;
+	IssmDouble total_gbmb;
+
+	for(int i=0;i<this->elements->Size();i++){
+		Element* element=xDynamicCast<Element*>(this->elements->GetObjectByOffset(i));
+		local_gbmb+=element->TotalGroundedBmb();
+	}
+	ISSM_MPI_Reduce(&local_gbmb,&total_gbmb,1,ISSM_MPI_DOUBLE,ISSM_MPI_SUM,0,IssmComm::GetComm() );
+	ISSM_MPI_Bcast(&total_gbmb,1,ISSM_MPI_DOUBLE,0,IssmComm::GetComm());
+
+	/*Assign output pointers: */
+	*pGbmb=total_gbmb;
+
+}/*}}}*/
 void FemModel::TotalSmbx(IssmDouble* pSmb){/*{{{*/
 
 	IssmDouble local_smb = 0;
@@ -1358,6 +1663,22 @@
 	*pdiv=max_divergence;
 
 }/*}}}*/
+void FemModel::FloatingAreax(IssmDouble* pV){/*{{{*/
+
+	IssmDouble local_floating_area= 0;
+	IssmDouble total_floating_area;
+
+	for(int i=0;i<this->elements->Size();i++){
+		Element* element=xDynamicCast<Element*>(this->elements->GetObjectByOffset(i));
+		local_floating_area+=element->FloatingArea();
+	}
+	ISSM_MPI_Reduce(&local_floating_area,&total_floating_area,1,ISSM_MPI_DOUBLE,ISSM_MPI_SUM,0,IssmComm::GetComm() );
+	ISSM_MPI_Bcast(&total_floating_area,1,ISSM_MPI_DOUBLE,0,IssmComm::GetComm());
+
+	/*Assign output pointers: */
+	*pV=total_floating_area;
+
+}/*}}}*/
 void FemModel::GetInputLocalMinMaxOnNodesx(IssmDouble** pmin,IssmDouble** pmax,IssmDouble* ug){/*{{{*/
 
 	/*Get vector sizes for current configuration*/
@@ -1391,6 +1712,22 @@
 	*pmax=uLmax;
 
 }/*}}}*/
+void FemModel::GroundedAreax(IssmDouble* pV){/*{{{*/
+
+	IssmDouble local_grounded_area= 0;
+	IssmDouble total_grounded_area;
+
+	for(int i=0;i<this->elements->Size();i++){
+		Element* element=xDynamicCast<Element*>(this->elements->GetObjectByOffset(i));
+		local_grounded_area+=element->GroundedArea();
+	}
+	ISSM_MPI_Reduce(&local_grounded_area,&total_grounded_area,1,ISSM_MPI_DOUBLE,ISSM_MPI_SUM,0,IssmComm::GetComm() );
+	ISSM_MPI_Bcast(&total_grounded_area,1,ISSM_MPI_DOUBLE,0,IssmComm::GetComm());
+
+	/*Assign output pointers: */
+	*pV=total_grounded_area;
+
+}/*}}}*/
 void FemModel::IceMassx(IssmDouble* pM){/*{{{*/
 
 	IssmDouble local_ice_mass = 0;
@@ -1503,7 +1840,7 @@
 		Input* thickness_input                 = element->GetInput(ThicknessEnum); _assert_(thickness_input);
 		Input* vx_input                        = element->GetInput(VxEnum);                                  _assert_(vx_input);
 		Input* vy_input                        = element->GetInput(VyEnum);                                  _assert_(vy_input);
-		Input* surface_mass_balance_input      = element->GetInput(SurfaceforcingsMassBalanceEnum);          _assert_(surface_mass_balance_input);
+		Input* surface_mass_balance_input      = element->GetInput(SmbMassBalanceEnum);          _assert_(surface_mass_balance_input);
 		Input* groundedice_melting_input       = element->GetInput(BasalforcingsGroundediceMeltingRateEnum); _assert_(groundedice_melting_input);
 		Input* dhdt_input                      = element->GetInput(BalancethicknessThickeningRateEnum);      _assert_(dhdt_input);
 
@@ -1658,6 +1995,64 @@
 	*pJ=J;
 }
 /*}}}*/
+void FemModel::ThicknessPositivex(IssmDouble* pJ){/*{{{*/
+
+	/*output: */
+	IssmDouble J=0.;
+	IssmDouble J_sum;
+
+	IssmDouble  thickness,weight;
+	IssmDouble  Jdet;
+	IssmDouble* xyz_list = NULL;
+	IssmDouble  H;
+
+	/*Compute Misfit: */
+	for(int i=0;i<elements->Size();i++){
+		Element* element=xDynamicCast<Element*>(elements->GetObjectByOffset(i));
+
+		/*If on water, return 0: */
+		if(!element->IsIceInElement()) continue;
+
+		/* Get node coordinates*/
+		element->GetVerticesCoordinates(&xyz_list);
+
+		/*Retrieve all inputs we will be needing: */
+		Input* weights_input   =element->GetInput(InversionCostFunctionsCoefficientsEnum); _assert_(weights_input);
+		Input* thickness_input =element->GetInput(ThicknessEnum);                          _assert_(thickness_input);
+
+		/* Start  looping on the number of gaussian points: */
+		Gauss* gauss=element->NewGauss(2);
+		for(int ig=gauss->begin();ig<gauss->end();ig++){
+
+			gauss->GaussPoint(ig);
+
+			/* Get Jacobian determinant: */
+			element->JacobianDeterminant(&Jdet,xyz_list,gauss);
+
+			/*Get all parameters at gaussian point*/
+			weights_input->GetInputValue(&weight,gauss,ThicknessPositiveEnum);
+			thickness_input->GetInputValue(&H,gauss);
+
+			/*int min(H,0)^2 */
+			if(H<=0){
+				J+=weight*H*H*Jdet*gauss->weight;
+			}
+		}
+
+		/*clean up and Return: */
+		xDelete<IssmDouble>(xyz_list);
+		delete gauss;
+	}
+
+	/*Sum all J from all cpus of the cluster:*/
+	ISSM_MPI_Reduce (&J,&J_sum,1,ISSM_MPI_DOUBLE,ISSM_MPI_SUM,0,IssmComm::GetComm() );
+	ISSM_MPI_Bcast(&J_sum,1,ISSM_MPI_DOUBLE,0,IssmComm::GetComm());
+	J=J_sum;
+
+	/*Assign output pointers: */
+	*pJ=J;
+}
+/*}}}*/
 void FemModel::CostFunctionx(IssmDouble* pJ,IssmDouble** pJlist,int* pn){/*{{{*/
 
 	/*Intermediary*/
@@ -1757,14 +2152,6 @@
 	}
 }
 /*}}}*/
-void FemModel::CalvingRatePix(){/*{{{*/
-
-	for(int i=0;i<elements->Size();i++){
-		Element* element=dynamic_cast<Element*>(this->elements->GetObjectByOffset(i));
-		element->CalvingRatePi();
-	}
-}
-/*}}}*/
 void FemModel::CalvingRateDevx(){/*{{{*/
 
 	for(int i=0;i<elements->Size();i++){
@@ -1909,6 +2296,149 @@
 }
 /*}}}*/
 #endif
+#ifdef _HAVE_SEALEVELRISE_
+void FemModel::SealevelriseEustatic(Vector<IssmDouble>* pSgi, IssmDouble* peustatic, IssmDouble* latitude, IssmDouble* longitude, IssmDouble* radius) { /*{{{*/
+
+	/*serialized vectors:*/
+	IssmDouble  eustatic=0;
+	IssmDouble  eustatic_cpu=0;
+	IssmDouble  eustatic_cpu_e=0;
+	IssmDouble  oceanarea=0;
+	IssmDouble  oceanarea_cpu=0;
+	IssmDouble  eartharea=0;
+	IssmDouble  eartharea_cpu=0;
+	int         ns,nsmax;
+	
+	/*Go through elements, and add contribution from each element to the deflection vector wg:*/
+	ns = elements->Size();
+
+	/*First, figure out the area of the ocean, which is needed to compute the eustatic component: */
+	for(int i=0;i<ns;i++){
+		Element* element=xDynamicCast<Element*>(elements->GetObjectByOffset(i));
+		oceanarea_cpu += element->OceanArea();
+		eartharea_cpu+= element->GetArea3D();
+	}
+	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());
+
+	ISSM_MPI_Reduce (&eartharea_cpu,&eartharea,1,ISSM_MPI_DOUBLE,ISSM_MPI_SUM,0,IssmComm::GetComm() );
+	ISSM_MPI_Bcast(&eartharea,1,ISSM_MPI_DOUBLE,0,IssmComm::GetComm());
+
+	/*Figure out max of ns: */
+	ISSM_MPI_Reduce(&ns,&nsmax,1,ISSM_MPI_INT,ISSM_MPI_MAX,0,IssmComm::GetComm());
+	ISSM_MPI_Bcast(&nsmax,1,ISSM_MPI_INT,0,IssmComm::GetComm());
+
+	/*Call the sea level rise core: */
+	for(int i=0;i<nsmax;i++){
+		if(i<ns){
+		
+			if(IssmComm::GetRank()==0)if(VerboseConvergence())if(i%100==0)_printf_("\r" << "      convolution progress: " << (float)i/(float)ns*100 << "\%");
+		
+			Element* element=xDynamicCast<Element*>(elements->GetObjectByOffset(i));
+			element->SealevelriseEustatic(pSgi,&eustatic_cpu_e,latitude,longitude,radius,oceanarea,eartharea);
+			eustatic_cpu+=eustatic_cpu_e;
+		}
+		if(i%100==0)pSgi->Assemble();
+	}
+	if(IssmComm::GetRank()==0)if(VerboseConvergence())_printf_("\n");
+		
+	/*One last time: */
+	pSgi->Assemble();
+
+	/*Sum all eustatic components from all cpus:*/
+	ISSM_MPI_Reduce (&eustatic_cpu,&eustatic,1,ISSM_MPI_DOUBLE,ISSM_MPI_SUM,0,IssmComm::GetComm() );
+	ISSM_MPI_Bcast(&eustatic,1,ISSM_MPI_DOUBLE,0,IssmComm::GetComm());
+
+	/*Assign output pointers:*/
+	*peustatic=eustatic;
+
+}
+/*}}}*/
+void FemModel::SealevelriseNonEustatic(Vector<IssmDouble>* pSgo, Vector<IssmDouble>* pSg_old, IssmDouble* latitude, IssmDouble* longitude, IssmDouble* radius, bool verboseconvolution){/*{{{*/
+
+	/*serialized vectors:*/
+	IssmDouble* Sg_old=NULL;
+	
+	IssmDouble  oceanarea=0;
+	IssmDouble  oceanarea_cpu=0;
+	IssmDouble  eartharea=0;
+	IssmDouble  eartharea_cpu=0;
+
+	int         ns,nsmax;
+	
+	/*Serialize vectors from previous iteration:*/
+	Sg_old=pSg_old->ToMPISerial();
+
+	/*Go through elements, and add contribution from each element to the deflection vector wg:*/
+	ns = elements->Size();
+	
+	/*First, figure out the area of the ocean, which is needed to compute the eustatic component: */
+	for(int i=0;i<ns;i++){
+		Element* element=xDynamicCast<Element*>(elements->GetObjectByOffset(i));
+		oceanarea_cpu += element->OceanArea();
+		eartharea_cpu+= element->GetArea3D();
+	}
+	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());
+	
+	ISSM_MPI_Reduce (&eartharea_cpu,&eartharea,1,ISSM_MPI_DOUBLE,ISSM_MPI_SUM,0,IssmComm::GetComm() );
+	ISSM_MPI_Bcast(&eartharea,1,ISSM_MPI_DOUBLE,0,IssmComm::GetComm());
+
+	/*Figure out max of ns: */
+	ISSM_MPI_Reduce(&ns,&nsmax,1,ISSM_MPI_INT,ISSM_MPI_MAX,0,IssmComm::GetComm());
+	ISSM_MPI_Bcast(&nsmax,1,ISSM_MPI_INT,0,IssmComm::GetComm());
+
+	/*Call the sea level rise core: */
+	for(int i=0;i<nsmax;i++){
+		if(i<ns){
+
+			if(verboseconvolution)if(IssmComm::GetRank()==0)if(VerboseConvergence())if(i%100==0)_printf_("\r" << "      convolution progress: " << (float)i/(float)ns*100 << "\%");
+
+			Element* element=xDynamicCast<Element*>(elements->GetObjectByOffset(i));
+			element->SealevelriseNonEustatic(pSgo, Sg_old,latitude,longitude,radius,oceanarea,eartharea);
+		}
+		if(i%100==0)pSgo->Assemble();
+	}
+	if(verboseconvolution)if(IssmComm::GetRank()==0)if(VerboseConvergence())_printf_("\n");
+
+	/*Free ressources:*/
+	xDelete<IssmDouble>(Sg_old);
+}
+/*}}}*/
+IssmDouble FemModel::SealevelriseOceanAverage(Vector<IssmDouble>* Sg) { /*{{{*/
+
+	IssmDouble* Sg_serial=NULL;
+	IssmDouble  oceanvalue,oceanvalue_cpu;
+	IssmDouble  oceanarea,oceanarea_cpu;
+
+	/*Serialize vectors from previous iteration:*/
+	Sg_serial=Sg->ToMPISerial();
+
+	/*Initialize:*/
+	oceanvalue_cpu=0;
+	oceanarea_cpu=0;
+
+	/*Go through elements, and add contribution from each element and divide by overall ocean area:*/
+	for(int i=0;i<elements->Size();i++){
+		Element* element=xDynamicCast<Element*>(elements->GetObjectByOffset(i));
+		oceanarea_cpu += element->OceanArea();
+		oceanvalue_cpu += element->OceanAverage(Sg_serial);
+	}
+	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());
+	
+	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>(Sg_serial);
+	
+	return oceanvalue/oceanarea;
+}
+/*}}}*/
+#endif
+
 void FemModel::HydrologyEPLupdateDomainx(IssmDouble* pEplcount){ /*{{{*/
 
 	Vector<IssmDouble>* mask							= NULL;
@@ -2045,3 +2575,140 @@
 	if(VerboseSolution()) _printf0_("   Number of active nodes L2 Projection: "<< counter <<"\n");
 }
 /*}}}*/
+
+#ifdef _HAVE_JAVASCRIPT_ 
+FemModel::FemModel(IssmDouble* buffer, int buffersize, char* toolkits, char* solution, char* modelname,ISSM_MPI_Comm incomm, bool trace){ /*{{{*/
+	/*configuration: */
+	int  solution_type;
+	int  ierr;
+
+	/*First things first, store the communicator, and set it as a global variable: */
+	IssmComm::SetComm(incomm);
+
+	/*Start profiler: */
+	this->profiler=new Profiler();
+	profiler->Tag(Start);
+
+	/*From command line arguments, retrieve different filenames needed to create the FemModel: */
+	solution_type=StringToEnumx(solution);
+	
+	/*Create femmodel from input files: */
+	profiler->Tag(StartInit);
+	this->InitFromBuffers((char*)buffer,buffersize,toolkits, solution_type,trace,NULL);
+	profiler->Tag(FinishInit);
+	
+	/*Save communicator in the parameters dataset: */
+	this->parameters->AddObject(new GenericParam<ISSM_MPI_Comm>(incomm,FemModelCommEnum));
+
+}
+/*}}}*/
+void FemModel::InitFromBuffers(char* buffer, int buffersize, char* toolkits, int in_solution_type, bool trace, IssmPDouble* X){/*{{{*/
+
+	/*intermediary*/
+	int         i;
+	int         analysis_type;
+	FILE       *IOMODEL = NULL;
+	FILE       *toolkitsoptionsfid = NULL;
+	FILE       *output_fid = NULL;
+	int         my_rank;
+	size_t      outputsize;
+	char       *outputbuffer;
+	const char* rootpath=""; //needed for Dakota runs only, which we won't do here.
+
+	/*recover my_rank:*/
+	my_rank=IssmComm::GetRank();
+
+	/*Initialize internal data: */
+	this->solution_type    = in_solution_type;
+	this->analysis_counter = nummodels-1;   //point to last analysis_type carried out.
+	this->results          = new Results(); //not initialized by CreateDataSets
+	
+	/*Open input file on cpu 0 and create IoModel */
+	if(my_rank==0) IOMODEL = fmemopen((void*)buffer, buffersize, "rb");
+	IoModel* iomodel = new IoModel(IOMODEL,in_solution_type,trace,X);
+
+	/*Figure out what analyses are activated for this solution*/
+	SolutionAnalysesList(&this->analysis_type_list,&this->nummodels,iomodel,this->solution_type);
+
+	/*Open toolkits file: */
+	toolkitsoptionsfid=fmemopen((void*)toolkits, strlen(toolkits)+1, "r");
+
+	/*create datasets for all analyses*/
+	ModelProcessorx(&this->elements,&this->nodes,&this->vertices,&this->materials,&this->constraints,&this->loads,&this->parameters,iomodel,toolkitsoptionsfid,(char*)rootpath,this->solution_type,this->nummodels,this->analysis_type_list);
+
+	/*do the post-processing of the datasets to get an FemModel that can actually run analyses: */
+	for(i=0;i<nummodels;i++){
+
+		if(VerboseMProcessor()) _printf0_("   Processing finite element model of analysis " << EnumToStringx(analysis_type_list[i]) << ":\n");
+		analysis_type=analysis_type_list[i];
+		this->SetCurrentConfiguration(analysis_type);
+
+		if(i==0){
+			if(VerboseMProcessor()) _printf0_("      creating vertex PIDs\n");
+			VerticesDofx(vertices,parameters); //only call once, we only have one set of vertices
+		}
+
+		if(VerboseMProcessor()) _printf0_("      resolving node constraints\n");
+		SpcNodesx(nodes,constraints,parameters,analysis_type); 
+
+		if(VerboseMProcessor()) _printf0_("      creating nodal degrees of freedom\n");
+		NodesDofx(nodes,parameters,analysis_type);
+
+		if(VerboseMProcessor()) _printf0_("      configuring element and loads\n");
+		ConfigureObjectsx(elements, loads, nodes, vertices, materials,parameters);
+	}
+
+	/*Close input file and toolkits file descriptors: */
+	if(my_rank==0) fclose(IOMODEL);
+	fclose(toolkitsoptionsfid);
+
+	/*Open output file once for all and add output file descriptor to parameters*/
+	output_fid=open_memstream(&outputbuffer,&outputsize); 
+	if(output_fid==NULL)_error_("FemModel::InitFromBuffers error message: could not initialize output stream");
+	this->parameters->SetParam(output_fid,OutputFilePointerEnum);
+	this->parameters->AddObject(new GenericParam<char**>(&outputbuffer,OutputBufferPointerEnum));
+	this->parameters->AddObject(new GenericParam<size_t*>(&outputsize,OutputBufferSizePointerEnum));
+
+	/*Clean up*/
+	delete iomodel;
+}/*}}}*/
+void FemModel::CleanUpJs(char** poutput, size_t* psize){/*{{{*/
+
+	/*Intermediary*/
+	FILE *output_fid;
+	GenericParam<char**>* outputbufferparam=NULL;
+	GenericParam<size_t*>* outputbuffersizeparam=NULL;
+	char** poutputbuffer;
+	size_t* poutputbuffersize;
+
+	
+	/*Before we delete the profiler, report statistics for this run: */
+	profiler->Tag(Finish);  //final tagging
+	_printf0_("\n");
+	_printf0_("   "<<setw(40)<<left<<"FemModel initialization elapsed time:"<<profiler->DeltaTime(StartInit,FinishInit) << "\n");
+	_printf0_("   "<<setw(40)<<left<<"Core solution elapsed time:"<<profiler->DeltaTime(StartCore,FinishCore) << "\n");
+	_printf0_("\n");
+	_printf0_("   Total elapsed time: "
+				<<profiler->DeltaTimeModHour(Start,Finish)<<" hrs "
+				<<profiler->DeltaTimeModMin(Start,Finish)<<" min "
+				<<profiler->DeltaTimeModSec(Start,Finish)<<" sec"
+				);
+	_printf0_("\n");
+	
+	/*Before we close the output file, recover the buffer and size:*/
+	outputbufferparam = xDynamicCast<GenericParam<char**>*>(this->parameters->FindParamObject(OutputBufferPointerEnum));
+	poutputbuffer=outputbufferparam->GetParameterValue();
+	outputbuffersizeparam = xDynamicCast<GenericParam<size_t*>*>(this->parameters->FindParamObject(OutputBufferSizePointerEnum));
+	poutputbuffersize=outputbuffersizeparam->GetParameterValue();
+
+	/*Close output file. Watch out, only close the output file after recovering the buffer pointers. Not sure 
+	 * why, but otherwise, the buffers are garbage: */
+	this->parameters->FindParam(&output_fid,OutputFilePointerEnum);
+	fclose(output_fid);
+
+	/*Assign output values: */
+	*poutput=*poutputbuffer;
+	*psize=*poutputbuffersize;
+}
+/*}}}*/
+#endif

Modified: issm/trunk/src/c/classes/FemModel.h
===================================================================
--- issm/trunk/src/c/classes/FemModel.h	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/classes/FemModel.h	2016-04-13 04:32:01 UTC (rev 20500)
@@ -42,23 +42,24 @@
 		Materials   *materials;            //one set of materials, for each element
 		Parameters  *parameters;           //one set of parameters, independent of the analysis_type
 		Results     *results;              //results that cannot be fit into the elements 
-		ISSM_MPI_Comm        comm;                  //communicator for this particular model
 
 		/*constructors, destructors: */
 		FemModel(int argc,char** argv,ISSM_MPI_Comm comm_init,bool trace=false);
-		FemModel(char* rootpath, char* inputfilename, char* outputfilename, char* toolkitsfilename, char* lockfilename, ISSM_MPI_Comm incomm, int solution_type,IssmPDouble* X);
+		FemModel(char* rootpath, char* inputfilename, char* outputfilename, char* toolkitsfilename, char* lockfilename, char* restartfilename, ISSM_MPI_Comm incomm, int solution_type,IssmPDouble* X);
 		~FemModel();
 
 		/*Methods:*/
 		void Echo();
 		FemModel* copy();
-		void InitFromFiles(char* rootpath, char* inputfilename, char* outputfilename, char* petscfilename, char* lockfilename, const int solution_type,bool trace,IssmPDouble* X=NULL);
+		void InitFromFiles(char* rootpath, char* inputfilename, char* outputfilename, char* petscfilename, char* lockfilename, char* restartfilename, const int solution_type,bool trace,IssmPDouble* X=NULL);
 		void SolutionAnalysesList(int** panalyses,int* pnumanalyses,IoModel* iomodel,int solutiontype);
 		void CleanUp(void);
 		void Solve(void);
-		void SetStaticComm();
 		void SetCurrentConfiguration(int configuration_type);
 		void SetCurrentConfiguration(int configuration_type,int analysis_type);
+		void CheckPoint(void);
+		void Marshall(char** pmarshalled_data, int* pmarshalled_data_size, int marshall_direction);
+		void Restart(void);
 
 		/*Modules*/ 
 		void ElementOperationx(void (Element::*function)(void));
@@ -75,9 +76,13 @@
 		void MinVxx(IssmDouble* presponse);
 		void MinVyx(IssmDouble* presponse);
 		void MinVzx(IssmDouble* presponse);
+		void TotalFloatingBmbx(IssmDouble* pFbmb);
+		void TotalGroundedBmbx(IssmDouble* pGbmb);
 		void TotalSmbx(IssmDouble* pSmb);
 		void Divergencex(IssmDouble* pdiv);
 		void MaxDivergencex(IssmDouble* pdiv);
+		void FloatingAreax(IssmDouble* pV);
+		void GroundedAreax(IssmDouble* pV);
 		void IceMassx(IssmDouble* pV);
 		void IceVolumex(IssmDouble* pV);
 		void IceVolumeAboveFloatationx(IssmDouble* pV);
@@ -88,8 +93,8 @@
 		void StrainRateperpendicularx();
 		void DeviatoricStressx();
 		void CalvingRateLevermannx();
-		void CalvingRatePix();
 		void CalvingRateDevx();
+		void ResetLevelset();
 		#ifdef  _HAVE_DAKOTA_
 		void DakotaResponsesx(double* d_responses,char** responses_descriptors,int numresponsedescriptors,int d_numresponses);
 		#endif
@@ -101,10 +106,16 @@
 		void OutputControlsx(Results **presults);
 		void CostFunctionx(IssmDouble* pJ,IssmDouble** pJlist,int* pn);
 		void ThicknessAbsGradientx( IssmDouble* pJ);
+		void ThicknessPositivex(IssmDouble* pJ);
 		void SurfaceAbsMisfitx( IssmDouble* pJ);
 		#ifdef _HAVE_GIA_
 		void Deflection(Vector<IssmDouble>* wg,Vector<IssmDouble>* dwgdt, IssmDouble* x, IssmDouble* y);
 		#endif
+		#ifdef _HAVE_SEALEVELRISE_
+		void SealevelriseEustatic(Vector<IssmDouble>* pSgi, IssmDouble* peustatic, IssmDouble* latitude, IssmDouble* longitude, IssmDouble* radius);
+		void SealevelriseNonEustatic(Vector<IssmDouble>* pSgo, Vector<IssmDouble>* pSg_old, IssmDouble* latitude, IssmDouble* longitude, IssmDouble* radius,bool verboseconvolution);
+		IssmDouble SealevelriseOceanAverage(Vector<IssmDouble>* Sg);
+		#endif
 		void TimeAdaptx(IssmDouble* pdt);
 		void UpdateConstraintsx(void);
 		int  UpdateVertexPositionsx(void);
@@ -112,6 +123,13 @@
 		void UpdateConstraintsExtrudeFromTopx();
 		void HydrologyEPLupdateDomainx(IssmDouble* pEplcount);
 		void UpdateConstraintsL2ProjectionEPLx(IssmDouble* pL2count);
+
+		#ifdef _HAVE_JAVASCRIPT_
+		FemModel(IssmDouble* buffer, int buffersize, char* toolkits, char* solution, char* modelname,ISSM_MPI_Comm incomm, bool trace=false);
+		void InitFromBuffers(char* buffer, int buffersize, char* toolkits, int solution_type,bool trace,IssmPDouble* X=NULL);
+		void CleanUpJs(char** poutput, size_t* psize);
+		#endif
 };
+		
 
 #endif

Modified: issm/trunk/src/c/classes/Hook.cpp
===================================================================
--- issm/trunk/src/c/classes/Hook.cpp	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/classes/Hook.cpp	2016-04-13 04:32:01 UTC (rev 20500)
@@ -119,7 +119,28 @@
 	return (Object*)output;
 }
 /*}}}*/
+void Hook::Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ /*{{{*/
 
+	if(marshall_direction==MARSHALLING_BACKWARD) reset();
+
+	MARSHALLING_ENUM(HookEnum);
+	MARSHALLING(num);
+	if (num<=0){
+		/*Empty hook*/
+		this->ids     = NULL;
+		this->objects = NULL;
+		this->offsets = NULL;
+		this->num = 0;
+	}
+	else{
+		MARSHALLING_DYNAMIC(ids,int,num);
+		MARSHALLING_DYNAMIC(offsets,int,num);
+		MARSHALLING_DYNAMIC(objects,Object*,num);
+	}
+
+}
+/*}}}*/
+
 /*Hook management: */
 void Hook::reset(){/*{{{*/
 

Modified: issm/trunk/src/c/classes/Hook.h
===================================================================
--- issm/trunk/src/c/classes/Hook.h	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/classes/Hook.h	2016-04-13 04:32:01 UTC (rev 20500)
@@ -33,6 +33,7 @@
 		void       Echo(void);
 		void       DeepEcho(void);
 		Object*    copy(void);
+		void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction);
 		/*}}}*/
 		/*Hook management: {{{*/
 		Object*    delivers(void); //single object deliver

Modified: issm/trunk/src/c/classes/IndependentObject.h
===================================================================
--- issm/trunk/src/c/classes/IndependentObject.h	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/classes/IndependentObject.h	2016-04-13 04:32:01 UTC (rev 20500)
@@ -30,6 +30,7 @@
 		int   Id(); 
 		int   ObjectEnum();
 		Object* copy(void);
+		void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ _error_("not implemented yet!");};
 		/*}}}*/
 		/*IndependentObject methods: {{{*/
 		void FetchIndependent(IoModel* iomodel,int* pXcount,IssmPDouble* X);

Modified: issm/trunk/src/c/classes/Inputs/BoolInput.cpp
===================================================================
--- issm/trunk/src/c/classes/Inputs/BoolInput.cpp	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/classes/Inputs/BoolInput.cpp	2016-04-13 04:32:01 UTC (rev 20500)
@@ -37,9 +37,9 @@
 	_printf_(setw(15)<<"   BoolInput "<<setw(25)<<left<<EnumToStringx(this->enum_type)<<" "<<(value?"true":"false") << "\n");
 }
 /*}}}*/
-int    BoolInput::Id(void){ return -1; }/*{{{*/
+int  BoolInput::Id(void){ return -1; }/*{{{*/
 /*}}}*/
-int BoolInput::ObjectEnum(void){/*{{{*/
+int  BoolInput::ObjectEnum(void){/*{{{*/
 
 	return BoolInputEnum;
 
@@ -51,7 +51,16 @@
 
 }
 /*}}}*/
+void BoolInput::Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ /*{{{*/
 
+	MARSHALLING_ENUM(BoolInputEnum);
+
+	MARSHALLING(enum_type);
+	MARSHALLING(value);
+
+}
+/*}}}*/
+
 /*BoolInput management*/
 int BoolInput::InstanceEnum(void){/*{{{*/
 

Modified: issm/trunk/src/c/classes/Inputs/BoolInput.h
===================================================================
--- issm/trunk/src/c/classes/Inputs/BoolInput.h	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/classes/Inputs/BoolInput.h	2016-04-13 04:32:01 UTC (rev 20500)
@@ -26,6 +26,7 @@
 		int     Id();
 		int     ObjectEnum();
 		Object *copy();
+		void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction);
 		/*}}}*/
 		/*BoolInput management: {{{*/
 		int   InstanceEnum();
@@ -36,6 +37,7 @@
 		Input* PointwiseMax(Input* inputB){_error_("not implemented yet");};
 		int  GetResultInterpolation(void){return P0Enum;};
 		int  GetResultNumberOfNodes(void){return 1;};
+		int  GetResultArraySize(void){return 1;};
 		void ResultToPatch(IssmDouble* values,int nodesperelement,int sid){_error_("not supported yet");};
 		void Configure(Parameters* parameters);
 		void AddTimeValues(IssmDouble* values,int step,IssmDouble time){_error_("not supported yet");};
@@ -49,6 +51,7 @@
 		void GetInputValue(IssmDouble* pvalue,Gauss* gauss ,int index){_error_("not implemented yet");};
 		void GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, Gauss* gauss){_error_("not implemented yet");};
 		void GetInputAverage(IssmDouble* pvalue){_error_("not implemented yet");};
+		void GetInputDerivativeAverageValue(IssmDouble* derivativevalues, IssmDouble* xyz_list){_error_("not implemented yet");};
 		void GetInputAllTimeAverages(IssmDouble** pvalues,IssmDouble** ptimes, int* pnumtimes){_error_("not implemented yet");};
 		void GetInputUpToCurrentTimeAverages(IssmDouble** pvalues, IssmDouble** ptimes, int* pnumtimes, IssmDouble currenttime){_error_("not implemented yet");};
 		void ChangeEnum(int newenumtype);

Modified: issm/trunk/src/c/classes/Inputs/ControlInput.cpp
===================================================================
--- issm/trunk/src/c/classes/Inputs/ControlInput.cpp	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/classes/Inputs/ControlInput.cpp	2016-04-13 04:32:01 UTC (rev 20500)
@@ -70,9 +70,9 @@
 	_printf_("---gradient: \n");   if (gradient)    gradient->Echo();
 }
 /*}}}*/
-int    ControlInput::Id(void){ return -1; }/*{{{*/
+int  ControlInput::Id(void){ return -1; }/*{{{*/
 /*}}}*/
-int ControlInput::ObjectEnum(void){/*{{{*/
+int  ControlInput::ObjectEnum(void){/*{{{*/
 
 	return ControlInputEnum;
 
@@ -95,7 +95,41 @@
 	return output;
 }
 /*}}}*/
+void ControlInput::Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ /*{{{*/
 
+	MARSHALLING_ENUM(ControlInputEnum);
+
+	MARSHALLING(enum_type);
+	MARSHALLING(control_id);
+
+	if (marshall_direction == MARSHALLING_BACKWARD){
+		switch(enum_type){
+			case TriaInputEnum:
+				values     =new TriaInput();
+				savedvalues=new TriaInput();
+				minvalues  =new TriaInput();
+				maxvalues  =new TriaInput();
+				gradient   =new TriaInput();
+				break;
+			case PentaInputEnum:
+				values     =new PentaInput();
+				savedvalues=new PentaInput();
+				minvalues  =new PentaInput();
+				maxvalues  =new PentaInput();
+				gradient   =new PentaInput();
+				break;
+			default:
+				_error_("Input of Enum " << EnumToStringx(enum_type) << " not supported yet by ControlInput");
+		}
+	}
+	if(values) this->values->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
+	if(savedvalues) this->savedvalues->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
+	if(minvalues) this->minvalues->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
+	if(maxvalues) this->maxvalues->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
+	if(gradient) this->gradient->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
+}
+/*}}}*/
+
 /*ControlInput management*/
 int ControlInput::InstanceEnum(void){/*{{{*/
 

Modified: issm/trunk/src/c/classes/Inputs/ControlInput.h
===================================================================
--- issm/trunk/src/c/classes/Inputs/ControlInput.h	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/classes/Inputs/ControlInput.h	2016-04-13 04:32:01 UTC (rev 20500)
@@ -34,6 +34,7 @@
 		int   Id(); 
 		int   ObjectEnum();
 		Object* copy();
+		void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction);
 		/*}}}*/
 		/*ControlInput management: {{{*/
 		int    InstanceEnum();
@@ -56,6 +57,7 @@
 		void GetInputValue(IssmDouble* pvalue,Gauss* gauss ,int index){_error_("not implemented yet");};
 		void GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list,Gauss* gauss);
 		void GetInputAverage(IssmDouble* pvalue);
+		void GetInputDerivativeAverageValue(IssmDouble* derivativevalues, IssmDouble* xyz_list){_error_("not implemented yet");};
 		void GetInputAllTimeAverages(IssmDouble** pvalues,IssmDouble** ptimes, int* pnumtimes){_error_("not implemented yet");};
 		void GetInputUpToCurrentTimeAverages(IssmDouble** pvalues, IssmDouble** ptimes, int* pnumtimes, IssmDouble currenttime){_error_("not implemented yet");};
 		void ChangeEnum(int newenumtype){_error_("not implemented yet");};
@@ -77,6 +79,7 @@
 		void GetVectorFromInputs(Vector<IssmDouble>* vector,int* doflist);
 		int  GetResultInterpolation(void);
 		int  GetResultNumberOfNodes(void);
+		int  GetResultArraySize(void){return 1;};
 		void ResultToPatch(IssmDouble* values,int nodesperelement,int sid){_error_("not supported yet");};
 		void GetGradient(Vector<IssmDouble>* gradient_vec,int* doflist);
 		void ScaleGradient(IssmDouble scale);

Modified: issm/trunk/src/c/classes/Inputs/DatasetInput.cpp
===================================================================
--- issm/trunk/src/c/classes/Inputs/DatasetInput.cpp	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/classes/Inputs/DatasetInput.cpp	2016-04-13 04:32:01 UTC (rev 20500)
@@ -72,6 +72,18 @@
 	return (Object*)output;
 }
 /*}}}*/
+void DatasetInput::Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ /*{{{*/
+
+	MARSHALLING_ENUM(DatasetInputEnum);
+
+	MARSHALLING(enum_type);
+	MARSHALLING(numids);
+	MARSHALLING_DYNAMIC(ids,int,numids)
+	if (marshall_direction == MARSHALLING_BACKWARD) inputs = new Inputs();
+	inputs->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
+
+}
+/*}}}*/
 Input* DatasetInput::SpawnTriaInput(int index1,int index2,int index3){/*{{{*/
 
 	/*output*/

Modified: issm/trunk/src/c/classes/Inputs/DatasetInput.h
===================================================================
--- issm/trunk/src/c/classes/Inputs/DatasetInput.h	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/classes/Inputs/DatasetInput.h	2016-04-13 04:32:01 UTC (rev 20500)
@@ -31,6 +31,7 @@
 		int   Id();
 		int   ObjectEnum();
 		Object* copy();
+		void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction);
 		/*}}}*/
 		/*DatasetInput management: {{{*/
 		void   AddInput(Input* input,int id);
@@ -52,6 +53,7 @@
 		void GetInputValue(IssmDouble* pvalue,Gauss* gauss ,int index);
 		void GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list,Gauss* gauss){_error_("not implemented yet");};
 		void GetInputAverage(IssmDouble* pvalue){_error_("not implemented yet");};
+		void GetInputDerivativeAverageValue(IssmDouble* derivativevalues, IssmDouble* xyz_list){_error_("not implemented yet");};
 		void GetInputAllTimeAverages(IssmDouble** pvalues,IssmDouble** ptimes, int* pnumtimes){_error_("not implemented yet");};
 		void GetInputUpToCurrentTimeAverages(IssmDouble** pvalues, IssmDouble** ptimes, int* pnumtimes, IssmDouble currenttime){_error_("not implemented yet");};
 		void ChangeEnum(int newenumtype){_error_("not implemented yet");};
@@ -72,6 +74,7 @@
 		void GetVectorFromInputs(Vector<IssmDouble>* vector,int* doflist){_error_("not implemented yet");};
 		int GetResultInterpolation(void){_error_("not implemented yet");};
 		int GetResultNumberOfNodes(void){_error_("not implemented yet");};
+		int GetResultArraySize(void){_error_("not implemented yet");};
 		void ResultToPatch(IssmDouble* values,int nodesperelement,int sid){_error_("not supported yet");};
 		void GetGradient(Vector<IssmDouble>* gradient_vec,int* doflist){_error_("not implemented yet");};
 		void ScaleGradient(IssmDouble scale){_error_("not implemented yet");};

Modified: issm/trunk/src/c/classes/Inputs/DoubleInput.cpp
===================================================================
--- issm/trunk/src/c/classes/Inputs/DoubleInput.cpp	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/classes/Inputs/DoubleInput.cpp	2016-04-13 04:32:01 UTC (rev 20500)
@@ -51,7 +51,16 @@
 
 }
 /*}}}*/
+void DoubleInput::Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ /*{{{*/
 
+	MARSHALLING_ENUM(DoubleInputEnum);
+
+	MARSHALLING(enum_type);
+	MARSHALLING(value);
+
+}
+/*}}}*/
+
 /*DoubleInput management*/
 int DoubleInput::InstanceEnum(void){/*{{{*/
 

Modified: issm/trunk/src/c/classes/Inputs/DoubleInput.h
===================================================================
--- issm/trunk/src/c/classes/Inputs/DoubleInput.h	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/classes/Inputs/DoubleInput.h	2016-04-13 04:32:01 UTC (rev 20500)
@@ -29,6 +29,7 @@
 		int   Id(); 
 		int   ObjectEnum();
 		Object* copy();
+		void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction);
 		/*}}}*/
 		/*DoubleInput management: {{{*/
 		int   InstanceEnum();
@@ -39,6 +40,7 @@
 		Input* PointwiseMax(Input* inputB);
 		int  GetResultInterpolation(void){return P0Enum;};
 		int  GetResultNumberOfNodes(void){return 1;};
+		int  GetResultArraySize(void){return 1;};
 		void ResultToPatch(IssmDouble* values,int nodesperelement,int sid){_error_("not supported yet");};
 		void AddTimeValues(IssmDouble* values,int step,IssmDouble time){_error_("not supported yet");};
 		void Configure(Parameters* parameters);
@@ -52,6 +54,7 @@
 		void GetInputValue(IssmDouble* pvalue,Gauss* gauss ,int index){_error_("not implemented yet");};
 		void GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list,Gauss* gauss){_error_("not implemented yet");};
 		void GetInputAverage(IssmDouble* pvalue);
+		void GetInputDerivativeAverageValue(IssmDouble* derivativevalues, IssmDouble* xyz_list){_error_("not implemented yet");};
 		void GetInputAllTimeAverages(IssmDouble** pvalues,IssmDouble** ptimes, int* pnumtimes){_error_("not implemented yet");};
 		void GetInputUpToCurrentTimeAverages(IssmDouble** pvalues, IssmDouble** ptimes, int* pnumtimes, IssmDouble currenttime){_error_("not implemented yet");};
 		void ChangeEnum(int newenumtype);

Modified: issm/trunk/src/c/classes/Inputs/Input.h
===================================================================
--- issm/trunk/src/c/classes/Inputs/Input.h	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/classes/Inputs/Input.h	2016-04-13 04:32:01 UTC (rev 20500)
@@ -33,6 +33,7 @@
 		virtual void GetInputValue(IssmDouble* pvalue,Gauss* gauss,int index)=0;
 		virtual void GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, Gauss* gauss)=0;
 		virtual void GetInputAverage(IssmDouble* pvalue)=0;
+		virtual void GetInputDerivativeAverageValue(IssmDouble* derivativevalues, IssmDouble* xyz_list)=0;
 		virtual void GetInputAllTimeAverages(IssmDouble** pvalues,IssmDouble** ptimes, int* pnumtimes)=0;
 		virtual void GetInputUpToCurrentTimeAverages(IssmDouble** pvalues, IssmDouble** ptimes, int* pnumtimes, IssmDouble currenttime)=0;
 		virtual void ChangeEnum(int newenumtype)=0;
@@ -60,6 +61,8 @@
 		virtual Input* PointwiseMin(Input* inputmin)=0;
 		virtual int  GetResultInterpolation(void)=0;
 		virtual int  GetResultNumberOfNodes(void)=0;
-		virtual void ResultToPatch(IssmDouble* values,int nodesperelement,int sid){_error_("not supported yet");};
+		virtual int  GetResultArraySize(void)=0;
+		virtual void ResultToPatch(IssmDouble* values,int nodesperelement,int sid){_error_("not supported yet");}; 
+		virtual void ResultToMatrix(IssmDouble* values,int ncols,int sid){_error_("not supported yet");};
 };
 #endif

Modified: issm/trunk/src/c/classes/Inputs/Inputs.h
===================================================================
--- issm/trunk/src/c/classes/Inputs/Inputs.h	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/classes/Inputs/Inputs.h	2016-04-13 04:32:01 UTC (rev 20500)
@@ -38,6 +38,7 @@
 		IssmDouble  Min(int enumtype);
 		IssmDouble  MinAbs(int enumtype);
 		void        GetInputAverage(IssmDouble* pvalue, int enum_type);
+		void        GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list,Gauss* gauss){_error_("not implemented yet");};
 		void        GetInputValue(bool* pvalue,int enum_type);
 		void        GetInputValue(int* pvalue,int enum_type);
 		void        GetInputValue(IssmDouble* pvalue,int enum_type);

Modified: issm/trunk/src/c/classes/Inputs/IntInput.cpp
===================================================================
--- issm/trunk/src/c/classes/Inputs/IntInput.cpp	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/classes/Inputs/IntInput.cpp	2016-04-13 04:32:01 UTC (rev 20500)
@@ -33,9 +33,9 @@
 	_printf_(setw(15)<<"   IntInput "<<setw(25)<<left<<EnumToStringx(this->enum_type)<<" "<<this->value<<"\n");
 }
 /*}}}*/
-int    IntInput::Id(void){ return -1; }/*{{{*/
+int  IntInput::Id(void){ return -1; }/*{{{*/
 /*}}}*/
-int IntInput::ObjectEnum(void){/*{{{*/
+int  IntInput::ObjectEnum(void){/*{{{*/
 
 	return IntInputEnum;
 
@@ -47,7 +47,16 @@
 
 }
 /*}}}*/
+void IntInput::Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ /*{{{*/
 
+	MARSHALLING_ENUM(IntInputEnum);
+
+	MARSHALLING(enum_type);
+	MARSHALLING(value);
+
+}
+/*}}}*/
+
 /*IntInput management*/
 void IntInput::Echo(void){/*{{{*/
 	this->DeepEcho();

Modified: issm/trunk/src/c/classes/Inputs/IntInput.h
===================================================================
--- issm/trunk/src/c/classes/Inputs/IntInput.h	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/classes/Inputs/IntInput.h	2016-04-13 04:32:01 UTC (rev 20500)
@@ -30,6 +30,7 @@
 		int   Id(); 
 		int   ObjectEnum();
 		Object* copy();
+		void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction);
 		/*}}}*/
 		/*IntInput management: {{{*/
 		int   InstanceEnum();
@@ -40,6 +41,7 @@
 		Input* PointwiseMax(Input* inputB){_error_("not implemented yet");};
 		int  GetResultInterpolation(void){return P0Enum;};
 		int  GetResultNumberOfNodes(void){return 1;};
+		int  GetResultArraySize(void){return 1;};
 		void ResultToPatch(IssmDouble* values,int nodesperelement,int sid){_error_("not supported yet");};
 		void AddTimeValues(IssmDouble* values,int step,IssmDouble time){_error_("not supported yet");};
 		void Configure(Parameters* parameters);
@@ -53,6 +55,7 @@
 		void GetInputValue(IssmDouble* pvalue,Gauss* gauss ,int index){_error_("not implemented yet");};
 		void GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list,Gauss* gauss){_error_("not implemented yet");};
 		void GetInputAverage(IssmDouble* pvalue){_error_("not implemented yet");};
+		void GetInputDerivativeAverageValue(IssmDouble* derivativevalues, IssmDouble* xyz_list){_error_("not implemented yet");};
 		void GetInputAllTimeAverages(IssmDouble** pvalues,IssmDouble** ptimes, int* pnumtimes){_error_("not implemented yet");};
 		void GetInputUpToCurrentTimeAverages(IssmDouble** pvalues, IssmDouble** ptimes, int* pnumtimes, IssmDouble currenttime){_error_("not implemented yet");};
 		void ChangeEnum(int newenumtype);

Modified: issm/trunk/src/c/classes/Inputs/PentaInput.cpp
===================================================================
--- issm/trunk/src/c/classes/Inputs/PentaInput.cpp	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/classes/Inputs/PentaInput.cpp	2016-04-13 04:32:01 UTC (rev 20500)
@@ -27,7 +27,7 @@
 	/*Set values*/
 	if (numnodes > 0){
 		this->values=xNew<IssmDouble>((unsigned int)numnodes);
-		for(int i=0;i<this->NumberofNodes(this->interpolation_type);i++) values[i]=in_values[i];
+		for(int i=0;i<numnodes;i++) values[i]=in_values[i];
 	}
 	else{
 		this->values = NULL;
@@ -52,9 +52,9 @@
 	_printf_("]\n");
 }
 /*}}}*/
-int    PentaInput::Id(void){ return -1; }/*{{{*/
+int  PentaInput::Id(void){ return -1; }/*{{{*/
 /*}}}*/
-int PentaInput::ObjectEnum(void){/*{{{*/
+int  PentaInput::ObjectEnum(void){/*{{{*/
 
 	return PentaInputEnum;
 
@@ -66,7 +66,21 @@
 
 }
 /*}}}*/
+void PentaInput::Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ /*{{{*/
 
+	MARSHALLING_ENUM(PentaInputEnum);
+
+	MARSHALLING(enum_type);
+	MARSHALLING(interpolation_type);
+
+	int numnodes = this->NumberofNodes(this->interpolation_type);
+	if(numnodes > 0){
+		MARSHALLING_DYNAMIC(this->values,IssmDouble,numnodes)
+	}
+	else this->values = NULL;
+}
+/*}}}*/
+
 /*PentaInput management*/
 int PentaInput::InstanceEnum(void){/*{{{*/
 

Modified: issm/trunk/src/c/classes/Inputs/PentaInput.h
===================================================================
--- issm/trunk/src/c/classes/Inputs/PentaInput.h	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/classes/Inputs/PentaInput.h	2016-04-13 04:32:01 UTC (rev 20500)
@@ -31,6 +31,7 @@
 		int     Id();
 		int     ObjectEnum();
 		Object *copy();
+		void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction);
 
 		/*PentaInput management*/
 		int   InstanceEnum();
@@ -41,6 +42,7 @@
 		Input* PointwiseMax(Input* inputB);
 		int  GetResultInterpolation(void);
 		int  GetResultNumberOfNodes(void);
+		int  GetResultArraySize(void){return 1;};
 		void ResultToPatch(IssmDouble* values,int nodesperelement,int sid);
 		void AddTimeValues(IssmDouble* values,int step,IssmDouble time){_error_("not supported yet");};
 		void Configure(Parameters* parameters);
@@ -53,6 +55,7 @@
 		void GetInputValue(IssmDouble* pvalue,Gauss* gauss ,int index){_error_("not implemented yet");};
 		void GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list,Gauss* gauss);
 		void GetInputAverage(IssmDouble* pvalue);
+		void GetInputDerivativeAverageValue(IssmDouble* derivativevalues, IssmDouble* xyz_list){_error_("not implemented yet");};
 		void GetInputAllTimeAverages(IssmDouble** pvalues,IssmDouble** ptimes, int* pnumtimes){_error_("not implemented yet");};
 		void GetInputUpToCurrentTimeAverages(IssmDouble** pvalues, IssmDouble** ptimes, int* pnumtimes, IssmDouble currenttime){_error_("not implemented yet");};
 		void ChangeEnum(int newenumtype);

Modified: issm/trunk/src/c/classes/Inputs/SegInput.cpp
===================================================================
--- issm/trunk/src/c/classes/Inputs/SegInput.cpp	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/classes/Inputs/SegInput.cpp	2016-04-13 04:32:01 UTC (rev 20500)
@@ -44,9 +44,9 @@
 	_printf_("]\n");
 }
 /*}}}*/
-int    SegInput::Id(void){ return -1; }/*{{{*/
+int  SegInput::Id(void){ return -1; }/*{{{*/
 /*}}}*/
-int SegInput::ObjectEnum(void){/*{{{*/
+int  SegInput::ObjectEnum(void){/*{{{*/
 
 	return SegInputEnum;
 
@@ -58,7 +58,21 @@
 
 }
 /*}}}*/
+void SegInput::Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ /*{{{*/
 
+	MARSHALLING_ENUM(SegInputEnum);
+
+	MARSHALLING(enum_type);
+	MARSHALLING(interpolation_type);
+
+	int numnodes = this->NumberofNodes(this->interpolation_type);
+	if(numnodes > 0){
+		MARSHALLING_DYNAMIC(this->values,IssmDouble,numnodes)
+	}
+	else this->values = NULL;
+}
+/*}}}*/
+
 /*SegInput management*/
 int SegInput::InstanceEnum(void){/*{{{*/
 

Modified: issm/trunk/src/c/classes/Inputs/SegInput.h
===================================================================
--- issm/trunk/src/c/classes/Inputs/SegInput.h	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/classes/Inputs/SegInput.h	2016-04-13 04:32:01 UTC (rev 20500)
@@ -31,6 +31,7 @@
 		int     Id();
 		int     ObjectEnum();
 		Object *copy();
+		void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction);
 
 		/*SegInput management:*/
 		int    InstanceEnum();
@@ -41,6 +42,7 @@
 		Input* PointwiseMax(Input* inputB){_error_("not supported yet");};
 		int  GetResultInterpolation(void){_error_("not implemented");};
 		int  GetResultNumberOfNodes(void){_error_("not implemented");};
+		int  GetResultArraySize(void){_error_("not implemented");};
 		void ResultToPatch(IssmDouble* values,int nodesperelement,int sid){_error_("not supported yet");};
 		void   AddTimeValues(IssmDouble* values,int step,IssmDouble time){_error_("not supported yet");};
 		void   Configure(Parameters* parameters);
@@ -54,6 +56,7 @@
 		void GetInputValue(IssmDouble* pvalue,Gauss* gauss ,int index){_error_("not implemented yet");};
 		void GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list,Gauss* gauss);
 		void GetInputAverage(IssmDouble* pvalue);
+		void GetInputDerivativeAverageValue(IssmDouble* derivativevalues, IssmDouble* xyz_list){_error_("not implemented yet");};
 		void GetInputAllTimeAverages(IssmDouble** pvalues,IssmDouble** ptimes, int* pnumtimes){_error_("not implemented yet");};
 		void GetInputUpToCurrentTimeAverages(IssmDouble** pvalues, IssmDouble** ptimes, int* pnumtimes, IssmDouble currenttime){_error_("not implemented yet");};
 		void ChangeEnum(int newenumtype){_error_("not implemented yet");};

Modified: issm/trunk/src/c/classes/Inputs/TetraInput.cpp
===================================================================
--- issm/trunk/src/c/classes/Inputs/TetraInput.cpp	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/classes/Inputs/TetraInput.cpp	2016-04-13 04:32:01 UTC (rev 20500)
@@ -27,7 +27,7 @@
 	/*Set values*/
 	if (numnodes > 0){
 		this->values=xNew<IssmDouble>((unsigned int)numnodes);
-		for(int i=0;i<this->NumberofNodes(this->interpolation_type);i++) values[i]=in_values[i];
+		for(int i=0;i<numnodes;i++) values[i]=in_values[i];
 	}
 	else{
 		this->values = NULL;
@@ -52,9 +52,9 @@
 	_printf_("] ("<<EnumToStringx(this->interpolation_type)<<")\n");
 }
 /*}}}*/
-int    TetraInput::Id(void){ return -1; }/*{{{*/
+int  TetraInput::Id(void){ return -1; }/*{{{*/
 /*}}}*/
-int TetraInput::ObjectEnum(void){/*{{{*/
+int  TetraInput::ObjectEnum(void){/*{{{*/
 
 	return TetraInputEnum;
 
@@ -66,7 +66,21 @@
 
 }
 /*}}}*/
+void TetraInput::Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ /*{{{*/
 
+	MARSHALLING_ENUM(TetraInputEnum);
+
+	MARSHALLING(enum_type);
+	MARSHALLING(interpolation_type);
+
+	int numnodes = this->NumberofNodes(this->interpolation_type);
+	if(numnodes > 0){
+		MARSHALLING_DYNAMIC(this->values,IssmDouble,numnodes)
+	}
+	else this->values = NULL;
+}
+/*}}}*/
+
 /*TetraInput management*/
 int TetraInput::InstanceEnum(void){/*{{{*/
 

Modified: issm/trunk/src/c/classes/Inputs/TetraInput.h
===================================================================
--- issm/trunk/src/c/classes/Inputs/TetraInput.h	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/classes/Inputs/TetraInput.h	2016-04-13 04:32:01 UTC (rev 20500)
@@ -31,6 +31,7 @@
 		int     Id();
 		int     ObjectEnum();
 		Object *copy();
+		void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction);
 
 		/*TetraInput management:*/
 		int    InstanceEnum();
@@ -41,6 +42,7 @@
 		Input* PointwiseMax(Input* inputB);
 		int    GetResultInterpolation(void);
 		int    GetResultNumberOfNodes(void);
+		int    GetResultArraySize(void){return 1;};
 		void   ResultToPatch(IssmDouble* values,int nodesperelement,int sid);
 		void   AddTimeValues(IssmDouble* values,int step,IssmDouble time){_error_("not supported yet");};
 		void   Configure(Parameters* parameters);
@@ -54,6 +56,7 @@
 		void GetInputValue(IssmDouble* pvalue,Gauss* gauss,int index){_error_("not implemented yet");};
 		void GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list,Gauss* gauss);
 		void GetInputAverage(IssmDouble* pvalue);
+		void GetInputDerivativeAverageValue(IssmDouble* derivativevalues, IssmDouble* xyz_list){_error_("not implemented yet");};
 		void GetInputAllTimeAverages(IssmDouble** pvalues,IssmDouble** ptimes, int* pnumtimes);
 		void GetInputUpToCurrentTimeAverages(IssmDouble** pvalues, IssmDouble** ptimes, int* pnumtimes, IssmDouble currenttime);
 		void ChangeEnum(int newenumtype);

Modified: issm/trunk/src/c/classes/Inputs/TransientInput.cpp
===================================================================
--- issm/trunk/src/c/classes/Inputs/TransientInput.cpp	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/classes/Inputs/TransientInput.cpp	2016-04-13 04:32:01 UTC (rev 20500)
@@ -103,7 +103,19 @@
 
 }
 /*}}}*/
+void TransientInput::Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ /*{{{*/
 
+	if (marshall_direction == MARSHALLING_BACKWARD) inputs = new Inputs();
+
+	MARSHALLING_ENUM(TransientInputEnum);
+
+	MARSHALLING(enum_type);
+	MARSHALLING(numtimesteps);
+	MARSHALLING_DYNAMIC(this->timesteps,IssmDouble,numtimesteps);
+	inputs->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
+}
+/*}}}*/
+
 /*TransientInput management*/
 int TransientInput::InstanceEnum(void){/*{{{*/
 
@@ -344,6 +356,11 @@
 
 }
 /*}}}*/
+int  TransientInput::GetResultArraySize(void){/*{{{*/
+
+	return 1;
+}
+/*}}}*/
 void TransientInput::Extrude(int start){/*{{{*/
 
 	for(int i=0;i<this->numtimesteps;i++){

Modified: issm/trunk/src/c/classes/Inputs/TransientInput.h
===================================================================
--- issm/trunk/src/c/classes/Inputs/TransientInput.h	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/classes/Inputs/TransientInput.h	2016-04-13 04:32:01 UTC (rev 20500)
@@ -36,6 +36,7 @@
 		int   Id();
 		int   ObjectEnum();
 		Object* copy();
+		void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction);
 		/*}}}*/
 		/*TransientInput management: {{{*/
 		int    InstanceEnum();
@@ -46,6 +47,7 @@
 		Input* PointwiseMax(Input* input_in){_error_("not implemented yet");};
 		int  GetResultInterpolation(void);
 		int  GetResultNumberOfNodes(void);
+		int  GetResultArraySize(void);
 		void ResultToPatch(IssmDouble* values,int nodesperelement,int sid){_error_("not supported yet");};
 		void Configure(Parameters* parameters);
 		/*}}}*/
@@ -58,6 +60,7 @@
 		void GetInputValue(IssmDouble* pvalue,Gauss* gauss ,int index){_error_("not implemented yet");};
 		void GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list,Gauss* gauss);
 		void GetInputAverage(IssmDouble* pvalue);
+		void GetInputDerivativeAverageValue(IssmDouble* derivativevalues, IssmDouble* xyz_list){_error_("not implemented yet");};
 		void GetInputAllTimeAverages(IssmDouble** pvalues,IssmDouble** ptimes, int* pnumtimes);
 		void GetInputUpToCurrentTimeAverages(IssmDouble** pvalues, IssmDouble** ptimes, int* pnumtimes, IssmDouble currenttime);
 		void ChangeEnum(int newenumtype);

Modified: issm/trunk/src/c/classes/Inputs/TriaInput.cpp
===================================================================
--- issm/trunk/src/c/classes/Inputs/TriaInput.cpp	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/classes/Inputs/TriaInput.cpp	2016-04-13 04:32:01 UTC (rev 20500)
@@ -27,7 +27,7 @@
 	/*Set values*/
 	if (numnodes > 0){
 		this->values=xNew<IssmDouble>((unsigned int)numnodes);
-		for(int i=0;i<this->NumberofNodes(this->interpolation_type);i++) values[i]=in_values[i];
+		for(int i=0;i<numnodes;i++) values[i]=in_values[i];
 	}
 	else{
 		this->values = NULL;
@@ -65,7 +65,21 @@
 
 }
 /*}}}*/
+void TriaInput::Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ /*{{{*/
 
+	MARSHALLING_ENUM(TriaInputEnum);
+
+	MARSHALLING(enum_type);
+	MARSHALLING(interpolation_type);
+
+	int numnodes = this->NumberofNodes(this->interpolation_type);
+	if(numnodes > 0){
+		MARSHALLING_DYNAMIC(this->values,IssmDouble,numnodes)
+	}
+	else this->values = NULL;
+}
+/*}}}*/
+
 /*TriaInput management*/
 int TriaInput::InstanceEnum(void){/*{{{*/
 
@@ -126,6 +140,12 @@
 
 }
 /*}}}*/
+int  TriaInput::GetResultArraySize(void){/*{{{*/
+
+	return 1;
+
+}
+/*}}}*/
 void TriaInput::ResultToPatch(IssmDouble* values,int nodesperelement,int sid){/*{{{*/
 
 	int numnodes = this->NumberofNodes(this->interpolation_type);
@@ -171,6 +191,26 @@
 	*pvalue=value;
 }
 /*}}}*/
+void TriaInput::GetInputDerivativeAverageValue(IssmDouble* derivativevalues, IssmDouble* xyz_list){/*{{{*/
+
+	int        numnodes  = this->NumberofNodes(this->interpolation_type);
+	IssmDouble numnodesd = reCast<int,IssmDouble>(numnodes);
+	IssmDouble dvalue[3];
+
+	derivativevalues[0] = 0.;
+	derivativevalues[1] = 0.;
+
+	GaussTria* gauss=new GaussTria();
+	for(int iv=0;iv<numnodes;iv++){
+		gauss->GaussNode(this->interpolation_type,iv);
+		this->GetInputDerivativeValue(&dvalue[0],xyz_list,gauss);
+
+		derivativevalues[0] += dvalue[0]/numnodesd;
+		derivativevalues[1] += dvalue[1]/numnodesd;
+	}
+	delete gauss;
+}
+/*}}}*/
 void TriaInput::GetInputAllTimeAverages(IssmDouble** pvalues,IssmDouble** ptimes, int* pnumtimes){/*{{{*/
 
 	IssmDouble* outvalues=NULL;

Modified: issm/trunk/src/c/classes/Inputs/TriaInput.h
===================================================================
--- issm/trunk/src/c/classes/Inputs/TriaInput.h	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/classes/Inputs/TriaInput.h	2016-04-13 04:32:01 UTC (rev 20500)
@@ -31,6 +31,7 @@
 		int     Id();
 		int     ObjectEnum();
 		Object *copy();
+		void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction);
 
 		/*TriaInput management:*/
 		int    InstanceEnum();
@@ -41,6 +42,7 @@
 		Input* PointwiseMax(Input* inputB);
 		int    GetResultInterpolation(void);
 		int    GetResultNumberOfNodes(void);
+		int    GetResultArraySize(void);
 		void   ResultToPatch(IssmDouble* values,int nodesperelement,int sid);
 		void   AddTimeValues(IssmDouble* values,int step,IssmDouble time){_error_("not supported yet");};
 		void   Configure(Parameters* parameters);
@@ -54,6 +56,7 @@
 		void GetInputValue(IssmDouble* pvalue,Gauss* gauss,int index){_error_("not implemented yet");};
 		void GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list,Gauss* gauss);
 		void GetInputAverage(IssmDouble* pvalue);
+		void GetInputDerivativeAverageValue(IssmDouble* derivativevalues, IssmDouble* xyz_list);
 		void GetInputAllTimeAverages(IssmDouble** pvalues,IssmDouble** ptimes, int* pnumtimes);
 		void GetInputUpToCurrentTimeAverages(IssmDouble** pvalues, IssmDouble** ptimes, int* pnumtimes, IssmDouble currenttime);
 		void ChangeEnum(int newenumtype);

Modified: issm/trunk/src/c/classes/IoModel.cpp
===================================================================
--- issm/trunk/src/c/classes/IoModel.cpp	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/classes/IoModel.cpp	2016-04-13 04:32:01 UTC (rev 20500)
@@ -20,6 +20,7 @@
 
 IoModel::IoModel(){/*{{{*/
 	this->fid=NULL;
+	this->solution_enum=-1;
 	this->data=NULL;
 	this->independents=NULL;
 	this->independent_objects=NULL;
@@ -49,7 +50,7 @@
 	this->constraintcounter=0;
 }
 /*}}}*/
-IoModel::IoModel(FILE* iomodel_handle,bool trace,IssmPDouble* X){/*{{{*/
+IoModel::IoModel(FILE* iomodel_handle,int solution_enum_in,bool trace,IssmPDouble* X){/*{{{*/
 
 	bool autodiff=false;
 	bool iscontrol=false;
@@ -60,6 +61,9 @@
 	/*Check that Enums are Synchronized*/
 	this->CheckEnumSync();
 
+	/*Keep track of solution*/
+	this->solution_enum = solution_enum_in;
+
 	/*Initialize data: */
 	this->data=xNew<IssmDouble*>(MaximumNumberOfDefinitionsEnum);
 	for(int i=0;i<MaximumNumberOfDefinitionsEnum;i++) this->data[i]=NULL;
@@ -239,7 +243,7 @@
 	}
 }
 /*}}}*/
-void IoModel::Constant(bool* poutput,int constant_enum){/*{{{*/
+void  IoModel::Constant(bool* poutput,int constant_enum){/*{{{*/
 
 	_assert_(constant_enum>=0);
 	_assert_(this->constants);
@@ -247,7 +251,7 @@
 	this->constants->FindParam(poutput,constant_enum);
 }
 /*}}}*/
-void IoModel::Constant(int* poutput,int constant_enum){/*{{{*/
+void  IoModel::Constant(int* poutput,int constant_enum){/*{{{*/
 
 	_assert_(constant_enum>=0);
 	_assert_(this->constants);
@@ -255,7 +259,7 @@
 	this->constants->FindParam(poutput,constant_enum);
 }
 /*}}}*/
-void IoModel::Constant(IssmDouble* poutput,int constant_enum){/*{{{*/
+void  IoModel::Constant(IssmDouble* poutput,int constant_enum){/*{{{*/
 
 	_assert_(constant_enum>=0);
 	_assert_(this->constants);
@@ -263,7 +267,7 @@
 	this->constants->FindParam(poutput,constant_enum);
 }
 /*}}}*/
-void IoModel::Constant(char** poutput,int constant_enum){/*{{{*/
+void  IoModel::Constant(char** poutput,int constant_enum){/*{{{*/
 
 	_assert_(constant_enum>=0);
 	_assert_(this->constants);
@@ -290,7 +294,7 @@
 	return this->data[data_enum];
 }
 /*}}}*/
-void IoModel::StartTrace(bool trace){/*{{{*/
+void  IoModel::StartTrace(bool trace){/*{{{*/
 
 	bool autodiff = false;
 	bool iscontrol = false;
@@ -330,7 +334,7 @@
 
 }
 /*}}}*/
-void IoModel::DeclareIndependents(bool trace,IssmPDouble* X){/*{{{*/
+void  IoModel::DeclareIndependents(bool trace,IssmPDouble* X){/*{{{*/
 
 	int  i;
 	bool autodiff = false;
@@ -1515,7 +1519,7 @@
 	*pnumrecords=num_instances;
 }
 /*}}}*/
-void IoModel::FetchDataToInput(Elements* elements,int vector_enum,IssmDouble default_value){/*{{{*/
+void  IoModel::FetchDataToInput(Elements* elements,int vector_enum,IssmDouble default_value){/*{{{*/
 
 	/*intermediary: */
 	int         code,vector_layout;
@@ -1540,7 +1544,7 @@
 	if(!this->independents[vector_enum]) xDelete<IssmDouble>(doublearray);
 }
 /*}}}*/
-void IoModel::FetchDataToInput(Elements* elements,int vector_enum){/*{{{*/
+void  IoModel::FetchDataToInput(Elements* elements,int vector_enum){/*{{{*/
 
 	/*intermediary: */
 	int     i;
@@ -1612,7 +1616,7 @@
 	xDelete<char>(string);
 }
 /*}}}*/
-void IoModel::LastIndex(int *pindex){/*{{{*/
+void  IoModel::LastIndex(int *pindex){/*{{{*/
 
 	int my_rank;
 	int lastindex,index;
@@ -1648,8 +1652,7 @@
 	*pindex=lastindex;
 }
 /*}}}*/
-/*FUNCTION IoModel::SetFilePointerToData{{{*/
-FILE* IoModel::SetFilePointerToData(int* pcode,int* pvector_type, int data_enum){
+FILE* IoModel::SetFilePointerToData(int* pcode,int* pvector_type, int data_enum){/*{{{*/
 
 	int my_rank;
 

Modified: issm/trunk/src/c/classes/IoModel.h
===================================================================
--- issm/trunk/src/c/classes/IoModel.h	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/classes/IoModel.h	2016-04-13 04:32:01 UTC (rev 20500)
@@ -25,6 +25,9 @@
 		/*pointer to input file*/
 		FILE *fid;
 
+		/*Solution*/
+		int   solution_enum;
+
 		/*Partitioning*/
 		bool *my_elements;
 		int  *my_vertices;
@@ -58,7 +61,7 @@
 		/*Methods*/
 		~IoModel();
 		IoModel();
-		IoModel(FILE* iomodel_handle,bool trace,IssmPDouble* X);
+		IoModel(FILE* iomodel_handle,int solution_enum_in,bool trace,IssmPDouble* X);
 
 		/*Input/Output*/
 		void        CheckEnumSync(void);

Modified: issm/trunk/src/c/classes/Loads/Friction.cpp
===================================================================
--- issm/trunk/src/c/classes/Loads/Friction.cpp	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/classes/Loads/Friction.cpp	2016-04-13 04:32:01 UTC (rev 20500)
@@ -66,7 +66,7 @@
 	IssmDouble  drag_p,drag_q;
 	IssmDouble  Neff;
 	IssmDouble  drag_coefficient;
-	IssmDouble  bed,thickness;
+	IssmDouble  bed,thickness,sealevel;
 	IssmDouble  alpha_complement;
 
 	/*Recover parameters: */
@@ -74,6 +74,7 @@
 	element->GetInputValue(&drag_q,FrictionQEnum);
 	element->GetInputValue(&thickness, gauss,ThicknessEnum);
 	element->GetInputValue(&bed, gauss,BaseEnum);
+	element->GetInputValue(&sealevel, gauss,SealevelEnum);
 	element->GetInputValue(&drag_coefficient, gauss,FrictionCoefficientEnum);
 	IssmDouble rho_water   = element->GetMaterialParameter(MaterialsRhoSeawaterEnum);
 	IssmDouble rho_ice     = element->GetMaterialParameter(MaterialsRhoIceEnum);
@@ -84,7 +85,7 @@
 	s=1./drag_p;
 
 	//From bed and thickness, compute effective pressure when drag is viscous:
-	Neff=gravity*(rho_ice*thickness+rho_water*bed);
+	Neff=gravity*(rho_ice*thickness+rho_water*(bed-sealevel));
 	if(Neff<0)Neff=0;
 
 	//We need the velocity magnitude to evaluate the basal stress:
@@ -119,6 +120,7 @@
 void Friction::GetAlphaHydroComplement(IssmDouble* palpha_complement, Gauss* gauss){/*{{{*/
 
 	/*diverse: */
+	int         CoupledFlag;
 	IssmDouble  q_exp;
 	IssmDouble  C_param;
 	IssmDouble  As;
@@ -134,9 +136,16 @@
 	element->GetInputValue(&C_param,FrictionCEnum);
 
 	element->GetInputValue(&As,gauss,FrictionAsEnum);
-	element->GetInputValue(&Neff,gauss,FrictionEffectivePressureEnum);
 	element->GetInputValue(&n,gauss,MaterialsRheologyNEnum);
+	element->parameters->FindParam(&CoupledFlag,FrictionCouplingEnum);
 
+	if (CoupledFlag==1){
+		element->GetInputValue(&Neff,gauss,EffectivePressureEnum);
+	}
+	else{
+		element->GetInputValue(&Neff,gauss,FrictionEffectivePressureEnum);
+	}
+
 	if(Neff<0)Neff=0;
 
 	//We need the velocity magnitude to evaluate the basal stress:
@@ -202,10 +211,87 @@
 		case 6:
 			GetAlpha2WeertmanTemp(palpha2,gauss);
 			break;
+		case 7:
+			GetAlpha2Coulomb(palpha2,gauss);
+			break;
+		case 8:
+			GetAlpha2Sommers(palpha2,gauss);
+			break;
 	  default:
+			_error_("Friction law "<< this->law <<" not supported");
+	}
+
+}/*}}}*/
+void Friction::GetAlpha2Coulomb(IssmDouble* palpha2, Gauss* gauss){/*{{{*/
+
+	/*This routine calculates the basal friction coefficient 
+	  alpha2= drag^2 * Neff ^r * | vel | ^(s-1), with Neff=rho_ice*g*thickness+rho_ice*g*base, r=q/p and s=1/p**/
+
+	/*diverse: */
+	IssmDouble  r,s;
+	IssmDouble  drag_p, drag_q;
+	IssmDouble  Neff;
+	IssmDouble  thickness,base,bed,floatation_thickness,sealevel;
+	IssmDouble  vx,vy,vz,vmag;
+	IssmDouble  drag_coefficient,drag_coefficient_coulomb;
+	IssmDouble  alpha2,alpha2_coulomb;
+
+	/*Recover parameters: */
+	element->GetInputValue(&drag_p,FrictionPEnum);
+	element->GetInputValue(&drag_q,FrictionQEnum);
+	element->GetInputValue(&thickness, gauss,ThicknessEnum);
+	element->GetInputValue(&base, gauss,BaseEnum);
+	element->GetInputValue(&sealevel, gauss,SealevelEnum);
+	element->GetInputValue(&bed, gauss,BedEnum);
+	element->GetInputValue(&drag_coefficient, gauss,FrictionCoefficientEnum);
+	element->GetInputValue(&drag_coefficient_coulomb, gauss,FrictionCoefficientcoulombEnum);
+	IssmDouble rho_water        = element->GetMaterialParameter(MaterialsRhoSeawaterEnum);
+	IssmDouble rho_ice          = element->GetMaterialParameter(MaterialsRhoIceEnum);
+	IssmDouble gravity          = element->GetMaterialParameter(ConstantsGEnum);
+
+	//compute r and q coefficients: */
+	r=drag_q/drag_p;
+	s=1./drag_p;
+
+	//From base and thickness, compute effective pressure when drag is viscous:
+	Neff=gravity*(rho_ice*thickness+rho_water*(base-sealevel));
+	if(Neff<0)Neff=0;
+
+	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");
 	}
 
+	/*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.));
+
+	floatation_thickness=0;
+	if(bed<0) floatation_thickness=-rho_water/rho_ice*bed;
+	if(vmag==0.) alpha2_coulomb=0.;
+	else alpha2_coulomb=drag_coefficient_coulomb*drag_coefficient_coulomb*rho_water*gravity*(thickness-floatation_thickness)/vmag;
+
+	if(alpha2_coulomb<alpha2) alpha2=alpha2_coulomb;
+
+	_assert_(!xIsNan<IssmDouble>(alpha2));
+
+	/*Assign output pointers:*/
+	*palpha2=alpha2;
 }/*}}}*/
 void Friction::GetAlpha2Hydro(IssmDouble* palpha2, Gauss* gauss){/*{{{*/
 
@@ -214,9 +300,10 @@
 		Not tested so far so use at your own risks
 	  alpha2= NeffC[Chi/(1+alpha*Chi^q)]^(1/n)*1/vel  with
 		-Chi=|vel|/(C^n*Neff^n*As)
-		-alpha=(q-1)^(q-1)/q^q  **/
+		-alpha=(q-1)^(q-1)/q^q */
 
 	/*diverse: */
+	int         CoupledFlag;
 	IssmDouble  q_exp;
 	IssmDouble  C_param;
 	IssmDouble  As;
@@ -234,10 +321,16 @@
 	element->GetInputValue(&q_exp,FrictionQEnum);
 	element->GetInputValue(&C_param,FrictionCEnum);
 	element->GetInputValue(&As,gauss,FrictionAsEnum);
-
-	element->GetInputValue(&Neff,gauss,FrictionEffectivePressureEnum);
 	element->GetInputValue(&n,gauss,MaterialsRheologyNEnum);
 	
+	element->parameters->FindParam(&CoupledFlag,FrictionCouplingEnum);
+	if (CoupledFlag==1){
+		element->GetInputValue(&Neff,gauss,EffectivePressureEnum);
+	}
+	else{
+		element->GetInputValue(&Neff,gauss,FrictionEffectivePressureEnum);
+	}
+		
 	if(Neff<0)Neff=0;
 
 	switch(dim){
@@ -315,7 +408,7 @@
 	IssmDouble  r,s;
 	IssmDouble  drag_p, drag_q;
 	IssmDouble  Neff;
-	IssmDouble  thickness,bed;
+	IssmDouble  thickness,base,sealevel;
 	IssmDouble  vx,vy,vz,vmag;
 	IssmDouble  drag_coefficient;
 	IssmDouble  alpha2;
@@ -324,7 +417,8 @@
 	element->GetInputValue(&drag_p,FrictionPEnum);
 	element->GetInputValue(&drag_q,FrictionQEnum);
 	element->GetInputValue(&thickness, gauss,ThicknessEnum);
-	element->GetInputValue(&bed, gauss,BaseEnum);
+	element->GetInputValue(&base, gauss,BaseEnum);
+	element->GetInputValue(&sealevel, gauss,SealevelEnum);
 	element->GetInputValue(&drag_coefficient, gauss,FrictionCoefficientEnum);
 	IssmDouble rho_water   = element->GetMaterialParameter(MaterialsRhoSeawaterEnum);
 	IssmDouble rho_ice     = element->GetMaterialParameter(MaterialsRhoIceEnum);
@@ -334,8 +428,8 @@
 	r=drag_q/drag_p;
 	s=1./drag_p;
 
-	//From bed and thickness, compute effective pressure when drag is viscous:
-	Neff=gravity*(rho_ice*thickness+rho_water*bed);
+	//From base and thickness, compute effective pressure when drag is viscous:
+	Neff=gravity*(rho_ice*thickness+rho_water*(base-sealevel));
 	if(Neff<0)Neff=0;
 
 	switch(dim){
@@ -374,17 +468,19 @@
 	/*diverse: */
 	IssmDouble  r,s;
 	IssmDouble  drag_p, drag_q;
-	IssmDouble  Neff;
-	IssmDouble  thickness,bed;
+	IssmDouble  Neff,F;
+	IssmDouble  thickness,bed,sealevel;
 	IssmDouble  vx,vy,vz,vmag;
 	IssmDouble  drag_coefficient,water_layer;
 	IssmDouble  alpha2;
 
 	/*Recover parameters: */
+	element->parameters->FindParam(&F,FrictionFEnum);
 	element->GetInputValue(&drag_p,FrictionPEnum);
 	element->GetInputValue(&drag_q,FrictionQEnum);
 	element->GetInputValue(&thickness, gauss,ThicknessEnum);
 	element->GetInputValue(&bed, gauss,BaseEnum);
+	element->GetInputValue(&sealevel, gauss,SealevelEnum);
 	element->GetInputValue(&drag_coefficient, gauss,FrictionCoefficientEnum);
 	element->GetInputValue(&water_layer, gauss,FrictionWaterLayerEnum);
 	IssmDouble rho_water   = element->GetMaterialParameter(MaterialsRhoSeawaterEnum);
@@ -397,7 +493,9 @@
 
 	//From bed and thickness, compute effective pressure when drag is viscous:
 	if(bed>0) bed=0;
-	Neff=gravity*(rho_ice*thickness+rho_water*(bed-water_layer));
+	if(water_layer==0) Neff=gravity*rho_ice*thickness+gravity*rho_water*(bed-sealevel);
+	else if(water_layer>0) Neff=gravity*rho_ice*thickness*F;
+	else _error_("negative water layer thickness");
 	if(Neff<0) Neff=0;
 
 	switch(dim){
@@ -496,3 +594,37 @@
 	/*Assign output pointers:*/
 	*palpha2=alpha2;
 }/*}}}*/
+void Friction::GetAlpha2Sommers(IssmDouble* palpha2, Gauss* gauss){/*{{{*/
+
+	/* FrictionGetAlpha2 computes alpha2= drag^2 * Neff, with Neff=rho_ice*g*thickness+rho_ice*g*(head-bed)*/
+
+	/*diverse: */
+	IssmDouble  pressure_ice,pressure_water;
+	IssmDouble  Neff;
+	IssmDouble  drag_coefficient;
+	IssmDouble  bed,thickness,head,sealevel;
+	IssmDouble  alpha2;
+
+	/*Recover parameters: */
+	element->GetInputValue(&thickness, gauss,ThicknessEnum);
+	element->GetInputValue(&bed, gauss,BaseEnum);
+	element->GetInputValue(&head, gauss,HydrologyHeadEnum);
+	element->GetInputValue(&sealevel, gauss,SealevelEnum);
+	element->GetInputValue(&drag_coefficient, gauss,FrictionCoefficientEnum);
+	IssmDouble rho_water   = element->GetMaterialParameter(MaterialsRhoFreshwaterEnum);
+	IssmDouble rho_ice     = element->GetMaterialParameter(MaterialsRhoIceEnum);
+	IssmDouble gravity     = element->GetMaterialParameter(ConstantsGEnum);
+
+	//From bed and thickness, compute effective pressure when drag is viscous:
+	pressure_ice   = rho_ice*gravity*thickness;
+	pressure_water = rho_water*gravity*(head-bed+sealevel);
+	Neff=pressure_ice-pressure_water;
+	if(Neff<0.) Neff=0.;
+
+	alpha2=drag_coefficient*drag_coefficient*Neff;
+	_assert_(!xIsNan<IssmDouble>(alpha2));
+
+	/*Assign output pointers:*/
+	*palpha2=alpha2;
+}
+/*}}}*/

Modified: issm/trunk/src/c/classes/Loads/Friction.h
===================================================================
--- issm/trunk/src/c/classes/Loads/Friction.h	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/classes/Loads/Friction.h	2016-04-13 04:32:01 UTC (rev 20500)
@@ -32,12 +32,14 @@
 		void  GetAlphaViscousComplement(IssmDouble* alpha_complement,Gauss* gauss);
 		void  GetAlphaHydroComplement(IssmDouble* alpha_complement,Gauss* gauss);
 		void  GetAlpha2(IssmDouble* palpha2,Gauss* gauss);
+		void  GetAlpha2Coulomb(IssmDouble* palpha2,Gauss* gauss);
 		void  GetAlpha2Hydro(IssmDouble* palpha2,Gauss* gauss);
 		void  GetAlpha2Temp(IssmDouble* palpha2,Gauss* gauss);
 		void  GetAlpha2Viscous(IssmDouble* palpha2,Gauss* gauss);
 		void  GetAlpha2WaterLayer(IssmDouble* palpha2,Gauss* gauss);
 		void  GetAlpha2Weertman(IssmDouble* palpha2,Gauss* gauss);
 		void  GetAlpha2WeertmanTemp(IssmDouble* palpha2,Gauss* gauss);
+		void  GetAlpha2Sommers(IssmDouble* palpha2,Gauss* gauss);
 };
 
 #endif  /* _FRICTION_H_ */

Modified: issm/trunk/src/c/classes/Loads/Loads.cpp
===================================================================
--- issm/trunk/src/c/classes/Loads/Loads.cpp	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/classes/Loads/Loads.cpp	2016-04-13 04:32:01 UTC (rev 20500)
@@ -14,9 +14,9 @@
 #include <functional>
 #include <algorithm>
 
+#include "../../shared/io/Comm/IssmComm.h"
 #include "./Loads.h"
 #include "./Load.h"
-#include "../../shared/shared.h"
 
 using namespace std;
 /*}}}*/

Modified: issm/trunk/src/c/classes/Loads/Numericalflux.cpp
===================================================================
--- issm/trunk/src/c/classes/Loads/Numericalflux.cpp	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/classes/Loads/Numericalflux.cpp	2016-04-13 04:32:01 UTC (rev 20500)
@@ -157,6 +157,33 @@
 	return numericalflux;
 }
 /*}}}*/
+void    Numericalflux::Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ /*{{{*/
+
+	_assert_(this);
+
+	/*ok, marshall operations: */
+	MARSHALLING_ENUM(NumericalfluxEnum);
+	MARSHALLING(id);
+	MARSHALLING(analysis_type);
+	MARSHALLING(flux_type);
+
+	if(marshall_direction==MARSHALLING_BACKWARD){
+		this->hnodes      = new Hook();
+		this->hvertices   = new Hook();
+		this->helement    = new Hook();
+	}
+
+	this->hnodes->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
+	this->helement->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
+	this->hvertices->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
+
+	/*corresponding fields*/
+	nodes    =(Node**)this->hnodes->deliverp();
+	vertices =(Vertex**)this->hvertices->deliverp();
+	element  =(Element*)this->helement->delivers();
+
+}
+/*}}}*/
 void    Numericalflux::DeepEcho(void){/*{{{*/
 
 	_printf_("Numericalflux:\n");

Modified: issm/trunk/src/c/classes/Loads/Numericalflux.h
===================================================================
--- issm/trunk/src/c/classes/Loads/Numericalflux.h	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/classes/Loads/Numericalflux.h	2016-04-13 04:32:01 UTC (rev 20500)
@@ -44,6 +44,7 @@
 		void    Echo();
 		int     Id();
 		int     ObjectEnum();
+		void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction);
 		/*}}}*/
 		/*Update virtual functions resolution: {{{*/
 		void InputUpdateFromConstant(IssmDouble constant, int name){/*Do nothing*/};

Modified: issm/trunk/src/c/classes/Loads/Pengrid.cpp
===================================================================
--- issm/trunk/src/c/classes/Loads/Pengrid.cpp	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/classes/Loads/Pengrid.cpp	2016-04-13 04:32:01 UTC (rev 20500)
@@ -111,6 +111,35 @@
 
 }
 /*}}}*/
+void    Pengrid::Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ /*{{{*/
+
+	_assert_(this);
+
+	/*ok, marshall operations: */
+	MARSHALLING_ENUM(PengridEnum);
+	MARSHALLING(id);
+	MARSHALLING(analysis_type);
+
+	if(marshall_direction==MARSHALLING_BACKWARD){
+		this->hnode      = new Hook();
+		this->helement   = new Hook();
+		this->hmatpar    = new Hook();
+	}
+
+	this->hnode->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
+	this->helement->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
+	this->hmatpar->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
+
+	/*corresponding fields*/
+	node   =(Node*)this->hnode->delivers();
+	matpar =(Matpar*)this->hmatpar->delivers();
+	element=(Element*)this->helement->delivers();
+
+	MARSHALLING(active);
+	MARSHALLING(zigzag_counter);
+
+}
+/*}}}*/
 void    Pengrid::DeepEcho(void){/*{{{*/
 
 	_printf_("Pengrid:\n");

Modified: issm/trunk/src/c/classes/Loads/Pengrid.h
===================================================================
--- issm/trunk/src/c/classes/Loads/Pengrid.h	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/classes/Loads/Pengrid.h	2016-04-13 04:32:01 UTC (rev 20500)
@@ -54,6 +54,7 @@
 		int   Id(); 
 		int   ObjectEnum();
 		Object* copy();
+		void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction);
 		/*}}}*/
 		/*Update virtual functions resolution: {{{*/
 		void  InputUpdateFromVector(IssmDouble* vector, int name, int type);

Modified: issm/trunk/src/c/classes/Loads/Penpair.cpp
===================================================================
--- issm/trunk/src/c/classes/Loads/Penpair.cpp	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/classes/Loads/Penpair.cpp	2016-04-13 04:32:01 UTC (rev 20500)
@@ -65,6 +65,25 @@
 
 }
 /*}}}*/
+void    Penpair::Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ /*{{{*/
+
+	_assert_(this);
+
+	/*ok, marshall operations: */
+	MARSHALLING_ENUM(PenpairEnum);
+	MARSHALLING(id);
+	MARSHALLING(analysis_type);
+
+	if(marshall_direction==MARSHALLING_BACKWARD){
+		this->hnodes = new Hook();
+	}
+	this->hnodes->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
+
+	/*corresponding fields*/
+	nodes = (Node**)this->hnodes->deliverp();
+
+}
+/*}}}*/
 void    Penpair::DeepEcho(void){/*{{{*/
 
 	_printf_("Penpair:\n");

Modified: issm/trunk/src/c/classes/Loads/Penpair.h
===================================================================
--- issm/trunk/src/c/classes/Loads/Penpair.h	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/classes/Loads/Penpair.h	2016-04-13 04:32:01 UTC (rev 20500)
@@ -35,6 +35,7 @@
 		void     Echo();
 		int      Id(); 
 		int      ObjectEnum();
+		void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction);
 		/*}}}*/
 		/*Update virtual functions resolution: {{{*/
 		void  InputUpdateFromConstant(IssmDouble constant, int name);

Modified: issm/trunk/src/c/classes/Loads/Riftfront.cpp
===================================================================
--- issm/trunk/src/c/classes/Loads/Riftfront.cpp	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/classes/Loads/Riftfront.cpp	2016-04-13 04:32:01 UTC (rev 20500)
@@ -152,6 +152,49 @@
 
 }
 /*}}}*/
+void    Riftfront::Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ /*{{{*/
+
+	_assert_(this);
+
+	/*ok, marshall operations: */
+	MARSHALLING_ENUM(RiftfrontEnum);
+	MARSHALLING(id);
+	MARSHALLING(analysis_type);
+	MARSHALLING(type);
+	MARSHALLING(fill);
+	MARSHALLING(friction);
+	MARSHALLING(fractionincrement);
+	MARSHALLING(shelf);
+
+	if(marshall_direction==MARSHALLING_BACKWARD){
+		this->hnodes      = new Hook();
+		this->hmatpar     = new Hook();
+		this->helements   = new Hook();
+	}
+
+	this->hnodes->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
+	this->hmatpar->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
+	this->helements->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
+
+	/*corresponding fields*/
+	nodes     =(Node**)this->hnodes->deliverp();
+	matpar    =(Matpar*)this->hmatpar->delivers();
+	elements  =(Element**)this->helements->deliverp();
+
+	MARSHALLING(penalty_lock);
+	MARSHALLING(active);
+	MARSHALLING(frozen);
+	MARSHALLING(state);
+	MARSHALLING(counter);
+	MARSHALLING(prestable);
+	MARSHALLING(material_converged);
+	MARSHALLING(normal[0]);
+	MARSHALLING(normal[1]);
+	MARSHALLING(length);
+	MARSHALLING(fraction);
+
+}
+/*}}}*/
 void    Riftfront::DeepEcho(void){/*{{{*/
 
 	_printf_("Riftfront:\n");
@@ -209,7 +252,7 @@
 /*}}}*/
 void  Riftfront::InputUpdateFromVector(IssmDouble* vector, int name, int type){/*{{{*/
 
-	_error_("not implemented yet");
+	/*Nothing to update*/
 
 }
 /*}}}*/

Modified: issm/trunk/src/c/classes/Loads/Riftfront.h
===================================================================
--- issm/trunk/src/c/classes/Loads/Riftfront.h	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/classes/Loads/Riftfront.h	2016-04-13 04:32:01 UTC (rev 20500)
@@ -61,6 +61,7 @@
 		void     Echo();
 		int      Id(); 
 		int      ObjectEnum();
+		void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction);
 		/*}}}*/
 		/*Update virtual functions resolution: {{{*/
 		void    InputUpdateFromConstant(IssmDouble constant, int name);

Modified: issm/trunk/src/c/classes/Masscon.h
===================================================================
--- issm/trunk/src/c/classes/Masscon.h	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/classes/Masscon.h	2016-04-13 04:32:01 UTC (rev 20500)
@@ -76,6 +76,10 @@
 			return (Object*) mf;
 		}
 		/*}}}*/
+		void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){/*{{{*/
+			_error_("not implemented yet!"); 
+		} 
+		/*}}}*/
 		/*Definition virtual function resolutoin: */
 		char* Name(){/*{{{*/
 

Modified: issm/trunk/src/c/classes/Massconaxpby.h
===================================================================
--- issm/trunk/src/c/classes/Massconaxpby.h	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/classes/Massconaxpby.h	2016-04-13 04:32:01 UTC (rev 20500)
@@ -87,6 +87,10 @@
 			return (Object*) mf;
 		}
 		/*}}}*/
+		void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){/*{{{*/
+			_error_("not implemented yet!"); 
+		} 
+		/*}}}*/
 		/*Definition virtual function resolutoin: */
 		char* Name(){/*{{{*/
 

Modified: issm/trunk/src/c/classes/Massfluxatgate.h
===================================================================
--- issm/trunk/src/c/classes/Massfluxatgate.h	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/classes/Massfluxatgate.h	2016-04-13 04:32:01 UTC (rev 20500)
@@ -120,6 +120,10 @@
 			return new Massfluxatgate(this->name,this->definitionenum,this->numsegments,this->x1,this->y1,this->x2,this->y2,this->elements); 
 		}
 		/*}}}*/
+		void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){/*{{{*/
+			_error_("not implemented yet!"); 
+		} 
+		/*}}}*/
 		/*Definition virtual function resolutoin: */
 		char* Name(){/*{{{*/
 

Modified: issm/trunk/src/c/classes/Materials/Matice.cpp
===================================================================
--- issm/trunk/src/c/classes/Materials/Matice.cpp	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/classes/Materials/Matice.cpp	2016-04-13 04:32:01 UTC (rev 20500)
@@ -29,6 +29,7 @@
 Matice::Matice(){/*{{{*/
 	this->helement=NULL;
 	this->element=NULL;
+	this->isdamaged=false;
 	return;
 }
 /*}}}*/
@@ -121,7 +122,19 @@
 
 }
 /*}}}*/
+void      Matice::Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ /*{{{*/
 
+	if(marshall_direction==MARSHALLING_BACKWARD)helement=new Hook(); 
+	
+	MARSHALLING_ENUM(MaticeEnum);
+	MARSHALLING(mid);
+	MARSHALLING(isdamaged);
+	this->helement->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
+	this->element=(Element*)this->helement->delivers();
+
+}
+/*}}}*/
+
 /*Matice management*/
 void  Matice::Configure(Elements* elementsin){/*{{{*/
 

Modified: issm/trunk/src/c/classes/Materials/Matice.h
===================================================================
--- issm/trunk/src/c/classes/Materials/Matice.h	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/classes/Materials/Matice.h	2016-04-13 04:32:01 UTC (rev 20500)
@@ -39,6 +39,7 @@
 		int   Id(); 
 		int   ObjectEnum();
 		Object* copy();
+		void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction);
 		/*}}}*/
 		/*Update virtual funictions definitions: {{{*/
 		void  InputUpdateFromVector(IssmDouble* vector, int name, int type);

Modified: issm/trunk/src/c/classes/Materials/Matpar.cpp
===================================================================
--- issm/trunk/src/c/classes/Materials/Matpar.cpp	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/classes/Materials/Matpar.cpp	2016-04-13 04:32:01 UTC (rev 20500)
@@ -18,10 +18,62 @@
 /*}}}*/
 Matpar::Matpar(int matpar_mid, IoModel* iomodel){/*{{{*/
 
+	rho_ice=0;
+	rho_water=0;
+	rho_freshwater=0;
+	mu_water=0;
+	heatcapacity=0;
+	thermalconductivity=0;
+	temperateiceconductivity=0;
+	latentheat=0;
+	beta=0;
+	meltingpoint=0;
+	referencetemperature=0;
+	mixed_layer_capacity=0;
+	thermal_exchange_velocity=0;
+	g=0;
+	omega=0;
+	desfac=0;
+	rlaps=0;
+	rlapslgm=0;
+	dpermil=0;
+
+	albedo_snow=0;
+	albedo_ice=0;
+
+	sediment_compressibility=0;
+	sediment_porosity=0;
+	sediment_thickness=0;
+	water_compressibility=0;
+
+	epl_compressibility=0;
+	epl_porosity=0;
+	epl_init_thickness=0;
+	epl_colapse_thickness=0;
+	epl_max_thickness=0;
+	epl_conductivity=0;
+
+	lithosphere_shear_modulus=0;
+	lithosphere_density=0;
+	mantle_shear_modulus=0;
+	mantle_density=0;
+	
+	earth_density=0;
+
+	poisson=0;
+	young_modulus=0;
+	ridging_exponent=0;
+	cohesion=0;
+	internal_friction_coef=0;
+	compression_coef=0;
+	traction_coef=0;
+	time_relaxation_stress=0;
+	time_relaxation_damage=0;
+
 	bool isefficientlayer;
 	int  hydrology_model,smb_model,materials_type;
 	iomodel->Constant(&hydrology_model,HydrologyModelEnum);
-	iomodel->Constant(&smb_model,SurfaceforcingsEnum);
+	iomodel->Constant(&smb_model,SmbEnum);
 	iomodel->Constant(&materials_type,MaterialsEnum);
 
 	this->mid = matpar_mid;
@@ -45,17 +97,25 @@
 			iomodel->Constant(&this->g,ConstantsGEnum);
 
 			switch(smb_model){
-				case SMBEnum:
+				case SMBforcingEnum:
 					/*Nothing to add*/
 					break;
+				case SMBgembEnum:
+					iomodel->Constant(&this->albedo_ice,SmbAIceEnum);
+					iomodel->Constant(&this->albedo_snow,SmbASnowEnum);
+					break;
 				case SMBpddEnum:
-					iomodel->Constant(&this->desfac,SurfaceforcingsDesfacEnum);
-					iomodel->Constant(&this->s0p,SurfaceforcingsS0pEnum);
-					iomodel->Constant(&this->s0t,SurfaceforcingsS0tEnum);
-					iomodel->Constant(&this->rlaps,SurfaceforcingsRlapsEnum);
-					iomodel->Constant(&this->rlapslgm,SurfaceforcingsRlapslgmEnum);
+					iomodel->Constant(&this->desfac,SmbDesfacEnum);
+					iomodel->Constant(&this->rlaps,SmbRlapsEnum);
+					iomodel->Constant(&this->rlapslgm,SmbRlapslgmEnum);
 					break;
+				case SMBd18opddEnum:
+					iomodel->Constant(&this->desfac,SmbDesfacEnum);
+					iomodel->Constant(&this->rlaps,SmbRlapsEnum);
+					iomodel->Constant(&this->rlapslgm,SmbRlapslgmEnum);
+					iomodel->Constant(&this->dpermil,SmbDpermilEnum);					
 				case SMBgradientsEnum:
+					break;
 					/*Nothing to add*/
 					break;
 				case SMBhenningEnum:
@@ -89,6 +149,9 @@
 			else if(hydrology_model==HydrologyshreveEnum){
 				/*Nothing to add*/
 			}
+			else if(hydrology_model==HydrologysommersEnum){
+				/*Nothing to add*/
+			}
 			else{
 				_error_("Hydrology model "<<EnumToStringx(hydrology_model)<<" not supported yet");
 			}
@@ -98,6 +161,10 @@
 			iomodel->Constant(&this->lithosphere_density,MaterialsLithosphereDensityEnum);
 			iomodel->Constant(&this->mantle_shear_modulus,MaterialsMantleShearModulusEnum);
 			iomodel->Constant(&this->mantle_density,MaterialsMantleDensityEnum);
+
+			/*slr:*/
+			iomodel->Constant(&this->earth_density,MaterialsEarthDensityEnum);
+
 			break;
 		default:
 			_error_("Material "<< EnumToStringx(materials_type) <<" not supported yet");
@@ -129,10 +196,9 @@
 	_printf_("   thermal_exchange_velocity: " << thermal_exchange_velocity << "\n");
 	_printf_("   g: " << g << "\n");
 	_printf_("   desfac: " << desfac << "\n");
-	_printf_("   s0p: " << s0p << "\n");
-	_printf_("   s0t: " << s0t << "\n");
 	_printf_("   rlaps: " << rlaps << "\n");
 	_printf_("   rlapslgm: " << rlapslgm << "\n");
+	_printf_("   dpermil: " << dpermil << "\n");
 	return;
 }
 /*}}}*/
@@ -141,9 +207,9 @@
 	this->Echo();
 }		
 /*}}}*/
-int    Matpar::Id(void){ return mid; }/*{{{*/
+int  Matpar::Id(void){ return mid; }/*{{{*/
 /*}}}*/
-int Matpar::ObjectEnum(void){/*{{{*/
+int  Matpar::ObjectEnum(void){/*{{{*/
 
 	return MatparEnum;
 
@@ -174,10 +240,9 @@
 	matpar->thermal_exchange_velocity=this->thermal_exchange_velocity;
 	matpar->g=this->g;
 	matpar->desfac=this->desfac;
-	matpar->s0p=this->s0p;
-	matpar->s0t=this->s0t;
 	matpar->rlaps=this->rlaps;
 	matpar->rlapslgm=this->rlapslgm;
+	matpar->dpermil=this->dpermil;
 
 	matpar->sediment_compressibility=this->sediment_compressibility;
 	matpar->sediment_porosity=this->sediment_porosity;
@@ -195,11 +260,73 @@
 	matpar->lithosphere_density=this->lithosphere_density;
 	matpar->mantle_shear_modulus=this->mantle_shear_modulus;
 	matpar->mantle_density=this->mantle_density;
+	
+	matpar->earth_density=this->earth_density;
 
 	return matpar;
 }
 /*}}}*/
+void Matpar::Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ /*{{{*/
 
+	MARSHALLING_ENUM(MatparEnum);
+
+	MARSHALLING(mid);
+	MARSHALLING(rho_ice);
+	MARSHALLING(rho_water);
+	MARSHALLING(rho_freshwater);
+	MARSHALLING(mu_water);
+	MARSHALLING(heatcapacity);
+	MARSHALLING(thermalconductivity);
+	MARSHALLING(temperateiceconductivity);
+	MARSHALLING(latentheat);
+	MARSHALLING(beta);
+	MARSHALLING(meltingpoint);
+	MARSHALLING(referencetemperature);
+	MARSHALLING(mixed_layer_capacity);
+	MARSHALLING(thermal_exchange_velocity);
+	MARSHALLING(g);
+	MARSHALLING(omega);
+	MARSHALLING(desfac);
+	MARSHALLING(rlaps);
+	MARSHALLING(rlapslgm);
+	MARSHALLING(dpermil);
+
+	//hydrology Dual Porous Continuum:
+	MARSHALLING(sediment_compressibility);
+	MARSHALLING(sediment_porosity);
+	MARSHALLING(sediment_thickness);
+	MARSHALLING(water_compressibility);
+
+	MARSHALLING(epl_compressibility);
+	MARSHALLING(epl_porosity);
+	MARSHALLING(epl_init_thickness);
+	MARSHALLING(epl_colapse_thickness);
+	MARSHALLING(epl_max_thickness);
+	MARSHALLING(epl_conductivity);
+
+	//gia:
+	MARSHALLING(lithosphere_shear_modulus);
+	MARSHALLING(lithosphere_density);
+	MARSHALLING(mantle_shear_modulus);
+	MARSHALLING(mantle_density);
+	
+	//slr:
+	MARSHALLING(earth_density);
+
+	//Sea ice:
+	MARSHALLING(poisson);
+	MARSHALLING(young_modulus);
+	MARSHALLING(ridging_exponent);
+	MARSHALLING(cohesion);
+	MARSHALLING(internal_friction_coef);
+	MARSHALLING(compression_coef);
+	MARSHALLING(traction_coef);
+	MARSHALLING(time_relaxation_stress);
+	MARSHALLING(time_relaxation_damage);
+
+}
+/*}}}*/
+
 /*Update virtual functions definitions:*/
 void   Matpar::InputUpdateFromVector(IssmDouble* vector, int name, int type){/*{{{*/
 	/*Nothing updated yet*/
@@ -258,21 +385,18 @@
 		case  ConstantsGEnum:
 			this->g=constant;
 			break;
-		case  SurfaceforcingsDesfacEnum:
+		case  SmbDesfacEnum:
 			this->desfac=constant;
 			break;
-		case SurfaceforcingsS0pEnum:
-			this->s0p=constant;
-			break;
-		case SurfaceforcingsS0tEnum:
-			this->s0t=constant;
-			break;
-		case SurfaceforcingsRlapsEnum:
+		case SmbRlapsEnum:
 			this->rlaps=constant;
 			break;
-		case SurfaceforcingsRlapslgmEnum:
+		case SmbRlapslgmEnum:
 			this->rlapslgm=constant;
 			break;
+		case  SmbDpermilEnum:
+			this->dpermil=constant;
+			break;
 		default: 
 			break;
 	}
@@ -394,15 +518,15 @@
 		case HydrologydcEplMaxThicknessEnum:         return this->epl_max_thickness;
 		case HydrologydcWaterCompressibilityEnum:    return this->water_compressibility;
 		case ConstantsGEnum:                         return this->g;
-		case SurfaceforcingsDesfacEnum:              return this->desfac;
-		case SurfaceforcingsS0pEnum:                 return this->s0p;
-		case SurfaceforcingsS0tEnum:                 return this->s0t;
-		case SurfaceforcingsRlapsEnum:               return this->rlaps;
-		case SurfaceforcingsRlapslgmEnum:            return this->rlapslgm;
+		case SmbDesfacEnum:              return this->desfac;
+		case SmbRlapsEnum:               return this->rlaps;
+		case SmbRlapslgmEnum:            return this->rlapslgm;
+		case SmbDpermilEnum:             return this->dpermil;
 		case MaterialsLithosphereShearModulusEnum:   return this->lithosphere_shear_modulus;
 		case MaterialsLithosphereDensityEnum:        return this->lithosphere_density;
 		case MaterialsMantleDensityEnum:             return this->mantle_density;
 		case MaterialsMantleShearModulusEnum:        return this->mantle_shear_modulus;
+		case MaterialsEarthDensityEnum:              return this->earth_density;
 		default: _error_("Enum "<<EnumToStringx(enum_in)<<" not supported yet");
 	}
 

Modified: issm/trunk/src/c/classes/Materials/Matpar.h
===================================================================
--- issm/trunk/src/c/classes/Materials/Matpar.h	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/classes/Materials/Matpar.h	2016-04-13 04:32:01 UTC (rev 20500)
@@ -31,11 +31,14 @@
 		IssmDouble  g;
 		IssmDouble  omega;
 		IssmDouble  desfac;
-		IssmDouble  s0p;
-		IssmDouble  s0t;
 		IssmDouble  rlaps;
 		IssmDouble  rlapslgm;
+		IssmDouble  dpermil;
 
+		/*albedo: */
+		IssmDouble albedo_ice;
+		IssmDouble albedo_snow;
+
 		/*hydrology Dual Porous Continuum: */	 
 		IssmDouble  sediment_compressibility;
 		IssmDouble  sediment_porosity;	 
@@ -55,6 +58,9 @@
 		IssmDouble mantle_shear_modulus;
 		IssmDouble mantle_density;
 
+		/*slr:*/
+		IssmDouble earth_density;
+
 		/*Sea ice*/
 		IssmDouble poisson;
 		IssmDouble young_modulus;
@@ -77,6 +83,7 @@
 		int     Id();
 		int     ObjectEnum();
 		Object *copy();
+		void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction);
 		/*}}}*/
 		/*Update virtual functions resolution: {{{*/
 		void   InputUpdateFromVector(IssmDouble* vector, int name, int type);

Modified: issm/trunk/src/c/classes/Misfit.h
===================================================================
--- issm/trunk/src/c/classes/Misfit.h	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/classes/Misfit.h	2016-04-13 04:32:01 UTC (rev 20500)
@@ -103,6 +103,10 @@
 			return (Object*) mf;
 		}
 		/*}}}*/
+		void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){/*{{{*/
+			_error_("not implemented yet!"); 
+		} 
+		/*}}}*/
 		/*Definition virtual function resolutoin: */
 		char* Name(){/*{{{*/
 

Modified: issm/trunk/src/c/classes/Node.cpp
===================================================================
--- issm/trunk/src/c/classes/Node.cpp	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/classes/Node.cpp	2016-04-13 04:32:01 UTC (rev 20500)
@@ -58,19 +58,19 @@
 		XZvectorsToCoordinateSystem(&this->coord_system[0][0],&iomodel->Data(StressbalanceReferentialEnum)[io_index*6]);
 		_assert_(sqrt( coord_system[0][0]*coord_system[0][0] + coord_system[1][0]*coord_system[1][0]) >1.e-4);
 
-		if(iomodel->domaintype!=Domain2DhorizontalEnum){
+		if(iomodel->domaintype!=Domain2DhorizontalEnum & iomodel->domaintype!=Domain3DsurfaceEnum){
 			/*We have a  3d mesh, we may have collapsed elements, hence dead nodes. Freeze them out: */
 			_assert_(iomodel->Data(MeshVertexonbaseEnum)); 
 			_assert_(iomodel->Data(FlowequationVertexEquationEnum));
 			if(in_approximation==SSAApproximationEnum && !reCast<int>(iomodel->Data(MeshVertexonbaseEnum)[io_index])){
-				this->Deactivate();
+				this->HardDeactivate();
 			}
 			if(in_approximation==L1L2ApproximationEnum && !reCast<int>(iomodel->Data(MeshVertexonbaseEnum)[io_index])){
-				this->Deactivate();
+				this->HardDeactivate();
 			}
 			if(in_approximation==SSAHOApproximationEnum && reCast<int>(iomodel->Data(FlowequationBorderSSAEnum)[io_index])){
 				if(!reCast<int>(iomodel->Data(MeshVertexonbaseEnum)[io_index])){
-					this->Deactivate();
+					this->HardDeactivate();
 				}
 			}
 			if(in_approximation==SSAFSApproximationEnum && reCast<int>(iomodel->Data(FlowequationBorderSSAEnum)[io_index])){
@@ -81,7 +81,7 @@
 		}
 		/*spc all nodes on SIA*/
 		if(in_approximation==SIAApproximationEnum){
-			this->Deactivate();
+			this->HardDeactivate();
 		}
 	}
 
@@ -94,14 +94,13 @@
 				analysis_enum==BalancethicknessAnalysisEnum ||
 				analysis_enum==HydrologyDCInefficientAnalysisEnum ||
 				analysis_enum==HydrologyDCEfficientAnalysisEnum ||
-				analysis_enum==LevelsetAnalysisEnum ||
-				analysis_enum==ExtrapolationAnalysisEnum
+				analysis_enum==LevelsetAnalysisEnum
 				){
-		if(iomodel->domaintype!=Domain2DhorizontalEnum){
+		if(iomodel->domaintype!=Domain2DhorizontalEnum & iomodel->domaintype!=Domain3DsurfaceEnum & iomodel->domaintype!=Domain3DsurfaceEnum){
 			/*On a 3d mesh, we may have collapsed elements, hence dead nodes. Freeze them out: */
 			_assert_(iomodel->Data(MeshVertexonbaseEnum));
 			if(!(reCast<bool>(iomodel->Data(MeshVertexonbaseEnum)[io_index]))){
-				this->Deactivate();
+				this->HardDeactivate();
 			}
 		}
 	}
@@ -112,7 +111,7 @@
 			/*On a 3d mesh, we may have collapsed elements, hence dead nodes. Freeze them out: */
 			_assert_(iomodel->Data(MeshVertexonsurfaceEnum));
 			if(!(reCast<bool>(iomodel->Data(MeshVertexonsurfaceEnum)[io_index]))){
-				this->Deactivate();
+				this->HardDeactivate();
 			}
 		}
 	}
@@ -150,7 +149,20 @@
 	return (Object*)output; 
 }
 /*}}}*/
+void Node::Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ /*{{{*/
 
+	MARSHALLING_ENUM(NodeEnum);
+	MARSHALLING(id);
+	MARSHALLING(sid);
+	MARSHALLING(lid);
+	MARSHALLING(indexingupdate);
+	indexing.Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
+	MARSHALLING(analysis_enum);
+	MARSHALLING_ARRAY(coord_system,IssmDouble,9);
+
+}
+/*}}}*/
+
 /*Object virtual functions definitions:*/
 void Node::Echo(void){/*{{{*/
 
@@ -450,6 +462,7 @@
 	_assert_(dof<this->indexing.gsize);
 
 	if(this->indexing.f_set[dof] == 1){
+		//if(this->indexing.freeze) _error_("Cannot change dof of frozen node");
 		this->indexingupdate = true;
 		this->indexing.f_set[dof]=0; //n splits into f (for which we solve) and s (single point constraints)
 		this->indexing.s_set[dof]=1;
@@ -463,6 +476,7 @@
 	_assert_(dof<this->indexing.gsize);
 
 	if(this->indexing.f_set[dof] == 0){
+		if(this->indexing.freeze) _error_("Cannot change dof of frozen node");
 		this->indexingupdate = true;
 		this->indexing.f_set[dof]=1; 
 		this->indexing.s_set[dof]=0;
@@ -472,21 +486,30 @@
 void Node::FreezeDof(int dof){/*{{{*/
 
 	DofInSSet(dof); //with 0 displacement for this dof.
+	//FIXME: for now we don't want this element to change so we use freeze
+	this->indexing.freeze =true;
 
 }
 /*}}}*/
 void Node::Deactivate(void){/*{{{*/
 
-	if(IsActive()){
+	if(IsActive() && !this->indexing.freeze){
 		this->indexingupdate = true;
 		indexing.Deactivate();
 	}
 
 }
 /*}}}*/
+void Node::HardDeactivate(void){/*{{{*/
+
+	this->indexing.Deactivate();
+	this->indexing.freeze =true;
+
+}
+/*}}}*/
 void Node::Activate(void){/*{{{*/
 
-	if(!IsActive()){
+	if(!IsActive() && !this->indexing.freeze){
 		this->indexingupdate = true;
 		indexing.Activate();
 	}

Modified: issm/trunk/src/c/classes/Node.h
===================================================================
--- issm/trunk/src/c/classes/Node.h	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/classes/Node.h	2016-04-13 04:32:01 UTC (rev 20500)
@@ -49,6 +49,7 @@
 		int     Id();
 		int     ObjectEnum();
 		Object *copy();
+		void    Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction);
 
 		/*Node numerical routines*/
 		void  CreateNodalConstraints(Vector<IssmDouble>* ys);
@@ -71,6 +72,7 @@
 		bool  IsActive(void);
 		void  Activate(void);
 		void  Deactivate(void);
+		void  HardDeactivate(void);
 		void  ReindexingDone(void);
 		bool  RequiresDofReindexing(void);
 		int   IsFloating();

Modified: issm/trunk/src/c/classes/Nodes.cpp
===================================================================
--- issm/trunk/src/c/classes/Nodes.cpp	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/classes/Nodes.cpp	2016-04-13 04:32:01 UTC (rev 20500)
@@ -10,8 +10,8 @@
 #error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
 #endif
 
+#include "../shared/io/Comm/IssmComm.h"
 #include "./Nodes.h"
-#include "../shared/shared.h"
 #include "./Node.h"
 
 using namespace std;

Modified: issm/trunk/src/c/classes/Options/Option.h
===================================================================
--- issm/trunk/src/c/classes/Options/Option.h	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/classes/Options/Option.h	2016-04-13 04:32:01 UTC (rev 20500)
@@ -25,7 +25,9 @@
 		int           Id(){_error_("Not implemented yet"); };
 		int           ObjectEnum(){return OptionEnum;              };
 		Object       *copy(){_error_("Not implemented yet"); };
+		void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ _error_("not implemented yet!"); };
 
+
 		/*virtual functions: */
 		virtual char* Name()=0;
 		virtual int   NumEl()=0;

Modified: issm/trunk/src/c/classes/Params/BoolParam.cpp
===================================================================
--- issm/trunk/src/c/classes/Params/BoolParam.cpp	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/classes/Params/BoolParam.cpp	2016-04-13 04:32:01 UTC (rev 20500)
@@ -53,3 +53,13 @@
 
 }
 /*}}}*/
+void BoolParam::Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ /*{{{*/
+
+	MARSHALLING_ENUM(BoolParamEnum);
+
+	MARSHALLING(enum_type);
+	MARSHALLING(value);
+
+}
+/*}}}*/
+		

Modified: issm/trunk/src/c/classes/Params/BoolParam.h
===================================================================
--- issm/trunk/src/c/classes/Params/BoolParam.h	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/classes/Params/BoolParam.h	2016-04-13 04:32:01 UTC (rev 20500)
@@ -35,6 +35,7 @@
 		int   Id(); 
 		int   ObjectEnum();
 		Object* copy();
+		void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction);
 		/*}}}*/
 		/*Param vritual function definitions: {{{*/
 		int   InstanceEnum(){return enum_type;}

Modified: issm/trunk/src/c/classes/Params/DataSetParam.cpp
===================================================================
--- issm/trunk/src/c/classes/Params/DataSetParam.cpp	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/classes/Params/DataSetParam.cpp	2016-04-13 04:32:01 UTC (rev 20500)
@@ -57,7 +57,17 @@
 
 }
 /*}}}*/
+void DataSetParam::Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ /*{{{*/
 
+	if(marshall_direction==MARSHALLING_BACKWARD)value=new DataSet();
+	
+	MARSHALLING_ENUM(DataSetParamEnum);
+	MARSHALLING(enum_type);
+	value->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
+
+}
+/*}}}*/
+
 /*DataSetParam virtual functions definitions: */
 void DataSetParam::GetParameterValue(DataSet** pdataset){/*{{{*/
 	*pdataset=value->Copy();

Modified: issm/trunk/src/c/classes/Params/DataSetParam.h
===================================================================
--- issm/trunk/src/c/classes/Params/DataSetParam.h	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/classes/Params/DataSetParam.h	2016-04-13 04:32:01 UTC (rev 20500)
@@ -36,6 +36,7 @@
 		int   Id(); 
 		int   ObjectEnum();
 		Object* copy();
+		void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction);
 		/*}}}*/
 		/*Param vritual function definitions: {{{*/
 		int   InstanceEnum(){return enum_type;}

Modified: issm/trunk/src/c/classes/Params/DoubleMatArrayParam.cpp
===================================================================
--- issm/trunk/src/c/classes/Params/DoubleMatArrayParam.cpp	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/classes/Params/DoubleMatArrayParam.cpp	2016-04-13 04:32:01 UTC (rev 20500)
@@ -121,7 +121,29 @@
 
 }
 /*}}}*/
+void DoubleMatArrayParam::Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ /*{{{*/
 
+	MARSHALLING_ENUM(DoubleMatArrayParamEnum);
+
+	MARSHALLING(enum_type);
+	MARSHALLING(M);
+	if(M){
+		MARSHALLING_DYNAMIC(mdim_array,int,M);
+		MARSHALLING_DYNAMIC(ndim_array,int,M);
+		if(marshall_direction==MARSHALLING_BACKWARD && M) array=xNew<IssmDouble*>(M);
+		for(int i=0;i<M;i++){
+			MARSHALLING_DYNAMIC(array[i],IssmDouble,mdim_array[i]*ndim_array[i]);
+		}
+	}
+	else{
+		array=NULL;
+		mdim_array=NULL;
+		ndim_array=NULL;
+	}
+
+}
+/*}}}*/
+
 /*DoubleMatArrayParam virtual functions definitions: */
 void  DoubleMatArrayParam::GetParameterValue(IssmDouble*** pout_array, int* pout_M,int** pout_mdim_array, int** pout_ndim_array){/*{{{*/
 
@@ -210,3 +232,4 @@
 
 }
 /*}}}*/
+		

Modified: issm/trunk/src/c/classes/Params/DoubleMatArrayParam.h
===================================================================
--- issm/trunk/src/c/classes/Params/DoubleMatArrayParam.h	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/classes/Params/DoubleMatArrayParam.h	2016-04-13 04:32:01 UTC (rev 20500)
@@ -38,6 +38,7 @@
 		int   Id(); 
 		int   ObjectEnum();
 		Object* copy();
+		void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction);
 		/*}}}*/
 		/*Param vritual function definitions: {{{*/
 		int   InstanceEnum(){return enum_type;}

Modified: issm/trunk/src/c/classes/Params/DoubleMatParam.cpp
===================================================================
--- issm/trunk/src/c/classes/Params/DoubleMatParam.cpp	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/classes/Params/DoubleMatParam.cpp	2016-04-13 04:32:01 UTC (rev 20500)
@@ -72,7 +72,17 @@
 
 }
 /*}}}*/
+void DoubleMatParam::Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ /*{{{*/
 
+	MARSHALLING_ENUM(DoubleMatParamEnum);
+
+	MARSHALLING(enum_type);
+	MARSHALLING(M);
+	MARSHALLING(N);
+	MARSHALLING_DYNAMIC(value,IssmDouble,M*N);
+}
+/*}}}*/
+
 /*DoubleMatParam virtual functions definitions: */
 void  DoubleMatParam::GetParameterValue(IssmDouble** pIssmDoublearray,int* pM,int* pN){/*{{{*/
 	IssmDouble* output=NULL;
@@ -102,3 +112,13 @@
 	this->N=in_N;
 }
 /*}}}*/
+
+/*DoubleMatParam specific routines:*/
+void  DoubleMatParam::GetParameterValueByPointer(IssmDouble** pIssmDoublearray,int* pM,int* pN){/*{{{*/
+	
+	/*Assign output pointers:*/
+	if(pM) *pM=M;
+	if(pN) *pN=N;
+	*pIssmDoublearray=value;
+}
+/*}}}*/

Modified: issm/trunk/src/c/classes/Params/DoubleMatParam.h
===================================================================
--- issm/trunk/src/c/classes/Params/DoubleMatParam.h	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/classes/Params/DoubleMatParam.h	2016-04-13 04:32:01 UTC (rev 20500)
@@ -37,6 +37,7 @@
 		int   Id(); 
 		int   ObjectEnum();
 		Object* copy();
+		void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction);
 		/*}}}*/
 		/*Param vritual function definitions: {{{*/
 		int   InstanceEnum(){return enum_type;}
@@ -70,5 +71,8 @@
 		void  SetValue(FILE* fid){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a FILE");}
 		void  SetValue(IssmDouble** array, int M, int* mdim_array, int* ndim_array){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold an array of matrices");}
 		/*}}}*/
+		/*DoubleMatParam specific routines:{{{*/
+		void  GetParameterValueByPointer(IssmDouble** pIssmDoublearray,int* pM,int* pN);
+		/*}}}*/
 };
 #endif  /* _DOUBLEMATPARAM_H */

Modified: issm/trunk/src/c/classes/Params/DoubleParam.cpp
===================================================================
--- issm/trunk/src/c/classes/Params/DoubleParam.cpp	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/classes/Params/DoubleParam.cpp	2016-04-13 04:32:01 UTC (rev 20500)
@@ -51,7 +51,16 @@
 
 }
 /*}}}*/
+void DoubleParam::Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ /*{{{*/
 
+	MARSHALLING_ENUM(DoubleParamEnum);
+
+	MARSHALLING(enum_type);
+	MARSHALLING(value);
+
+}
+/*}}}*/
+
 /*DoubleParam virtual functions definitions: */
 void DoubleParam::GetParameterValue(int* pinteger){/*{{{*/
 	_error_("Double param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return an integer");

Modified: issm/trunk/src/c/classes/Params/DoubleParam.h
===================================================================
--- issm/trunk/src/c/classes/Params/DoubleParam.h	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/classes/Params/DoubleParam.h	2016-04-13 04:32:01 UTC (rev 20500)
@@ -36,6 +36,7 @@
 		int   Id(); 
 		int   ObjectEnum();
 		Object* copy();
+		void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction);
 		/*}}}*/
 		/*Param vritual function definitions: {{{*/
 		int   InstanceEnum(){return enum_type;}

Modified: issm/trunk/src/c/classes/Params/DoubleVecParam.cpp
===================================================================
--- issm/trunk/src/c/classes/Params/DoubleVecParam.cpp	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/classes/Params/DoubleVecParam.cpp	2016-04-13 04:32:01 UTC (rev 20500)
@@ -24,8 +24,11 @@
 	enum_type=in_enum_type;
 	M=in_M;
 
-	values=xNew<IssmDouble>(M);
-	xMemCpy<IssmDouble>(values,in_values,M);
+	if(M){
+		values=xNew<IssmDouble>(M);
+		xMemCpy<IssmDouble>(values,in_values,M);
+	}
+	else values=NULL;
 }
 /*}}}*/
 DoubleVecParam::~DoubleVecParam(){/*{{{*/
@@ -61,7 +64,17 @@
 
 }
 /*}}}*/
+void DoubleVecParam::Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ /*{{{*/
 
+	MARSHALLING_ENUM(DoubleVecParamEnum);
+
+	MARSHALLING(enum_type);
+	MARSHALLING(M);
+	MARSHALLING_DYNAMIC(values,IssmDouble,M);
+
+}
+/*}}}*/
+
 /*DoubleVecParam virtual functions definitions: */
 void  DoubleVecParam::GetParameterValue(IssmDouble** pIssmDoublearray,int* pM){/*{{{*/
 	IssmDouble* output=NULL;
@@ -107,3 +120,12 @@
 	this->M=in_M;
 }
 /*}}}*/
+
+/*DoubleVecParam specific routines:*/
+void  DoubleVecParam::GetParameterValueByPointer(IssmDouble** pIssmDoublearray,int* pM){/*{{{*/
+	
+	/*Assign output pointers:*/
+	if(pM) *pM=M;
+	*pIssmDoublearray=values;
+}
+/*}}}*/

Modified: issm/trunk/src/c/classes/Params/DoubleVecParam.h
===================================================================
--- issm/trunk/src/c/classes/Params/DoubleVecParam.h	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/classes/Params/DoubleVecParam.h	2016-04-13 04:32:01 UTC (rev 20500)
@@ -36,6 +36,7 @@
 		int   Id(); 
 		int   ObjectEnum();
 		Object* copy();
+		void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction);
 		/*}}}*/
 		/*Param virtual functions definitions: {{{*/
 		int   InstanceEnum(){return enum_type;}
@@ -69,5 +70,9 @@
 		void  SetValue(FILE* fid){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a FILE");}
 		void  SetValue(IssmDouble** array, int M, int* mdim_array, int* ndim_array){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold an array of matrices");}
 		/*}}}*/
+		/*DoubleVecParam specific routines:{{{*/
+		void  GetParameterValueByPointer(IssmDouble** pIssmDoublearray,int* pM);
+		/*}}}*/
+
 };
 #endif  /* _DOUBLEVECPARAM_H */

Modified: issm/trunk/src/c/classes/Params/FileParam.cpp
===================================================================
--- issm/trunk/src/c/classes/Params/FileParam.cpp	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/classes/Params/FileParam.cpp	2016-04-13 04:32:01 UTC (rev 20500)
@@ -40,9 +40,9 @@
 	_printf_(setw(22)<<"   FileParam "<<setw(35)<<left<<EnumToStringx(this->enum_type)<<" "<<this->value<<"\n");
 }
 /*}}}*/
-int    FileParam::Id(void){ return -1; }/*{{{*/
+int  FileParam::Id(void){ return -1; }/*{{{*/
 /*}}}*/
-int FileParam::ObjectEnum(void){/*{{{*/
+int  FileParam::ObjectEnum(void){/*{{{*/
 
 	return FileParamEnum;
 
@@ -54,3 +54,13 @@
 
 }
 /*}}}*/
+void FileParam::Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ /*{{{*/
+
+	MARSHALLING_ENUM(FileParamEnum);
+	MARSHALLING(enum_type);
+	MARSHALLING(value);
+
+	if(marshall_direction==MARSHALLING_BACKWARD) value=NULL; //meaningless file pointer!
+
+}
+/*}}}*/

Modified: issm/trunk/src/c/classes/Params/FileParam.h
===================================================================
--- issm/trunk/src/c/classes/Params/FileParam.h	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/classes/Params/FileParam.h	2016-04-13 04:32:01 UTC (rev 20500)
@@ -35,6 +35,7 @@
 		int   Id(); 
 		int   ObjectEnum();
 		Object* copy();
+		void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction);
 		/*}}}*/
 		/*Param vritual function definitions: {{{*/
 		int   InstanceEnum(){return enum_type;}

Modified: issm/trunk/src/c/classes/Params/GenericParam.h
===================================================================
--- issm/trunk/src/c/classes/Params/GenericParam.h	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/classes/Params/GenericParam.h	2016-04-13 04:32:01 UTC (rev 20500)
@@ -32,6 +32,7 @@
         public:
                 /*GenericParam constructors, destructors: {{{*/
                 GenericParam(int enumVal) : myEnumVal(enumVal){};
+                GenericParam(P Pin, int enumVal) : myP(Pin),myEnumVal(enumVal){};
                 ~GenericParam(){};
                 /*}}}*/
                 /*Object virtual functions definitions:{{{ */
@@ -44,13 +45,18 @@
                 }
                 void  Echo() {DeepEcho();};
                 int   Id(){ return -1; };
-                int   ObjectEnum() {return AdolcParamEnum;};
+                int   ObjectEnum() {return GenericParamEnum;};
 
                 // the "copy"  has to implement the base class abstract function
                 // but I would prefer to drop this not to hide a "new" in here because
                 // it does not clarify  ownership of the newed up instance...
                 // use the default copy constructor instead
                 Object* copy() { return new GenericParam<P>(*this); };
+					 void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){
+						 _printf_("   WARNING: parameter "<<EnumToStringx(this->myEnumVal)<<" is a GenericParam and cannot be marshalled\n");
+						 /*Nothing for now*/
+					 }
+
                 /*}}}*/
                 /*Param vritual function definitions: {{{*/
                 int   InstanceEnum(){return myEnumVal;}

Modified: issm/trunk/src/c/classes/Params/IntMatParam.cpp
===================================================================
--- issm/trunk/src/c/classes/Params/IntMatParam.cpp	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/classes/Params/IntMatParam.cpp	2016-04-13 04:32:01 UTC (rev 20500)
@@ -58,9 +58,9 @@
 	}
 }
 /*}}}*/
-int    IntMatParam::Id(void){ return -1; }/*{{{*/
+int  IntMatParam::Id(void){ return -1; }/*{{{*/
 /*}}}*/
-int IntMatParam::ObjectEnum(void){/*{{{*/
+int  IntMatParam::ObjectEnum(void){/*{{{*/
 
 	return IntMatParamEnum;
 
@@ -72,7 +72,17 @@
 
 }
 /*}}}*/
+void IntMatParam::Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ /*{{{*/
 
+	MARSHALLING_ENUM(IntMatParamEnum);
+
+	MARSHALLING(enum_type);
+	MARSHALLING(M);
+	MARSHALLING(N);
+	MARSHALLING_DYNAMIC(value,int,M*N);
+}
+/*}}}*/
+
 /*IntMatParam virtual functions definitions: */
 void  IntMatParam::GetParameterValue(int** pintarray,int* pM,int* pN){/*{{{*/
 	int* output=NULL;

Modified: issm/trunk/src/c/classes/Params/IntMatParam.h
===================================================================
--- issm/trunk/src/c/classes/Params/IntMatParam.h	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/classes/Params/IntMatParam.h	2016-04-13 04:32:01 UTC (rev 20500)
@@ -37,6 +37,7 @@
 		int   Id(); 
 		int   ObjectEnum();
 		Object* copy();
+		void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction);
 		/*}}}*/
 		/*Param vritual function definitions: {{{*/
 		int   InstanceEnum(){return enum_type;}

Modified: issm/trunk/src/c/classes/Params/IntParam.cpp
===================================================================
--- issm/trunk/src/c/classes/Params/IntParam.cpp	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/classes/Params/IntParam.cpp	2016-04-13 04:32:01 UTC (rev 20500)
@@ -40,9 +40,9 @@
 	_printf_(setw(22)<<"   IntParam "<<setw(35)<<left<<EnumToStringx(this->enum_type)<<" "<<this->value<<"\n");
 }
 /*}}}*/
-int    IntParam::Id(void){ return -1; }/*{{{*/
+int  IntParam::Id(void){ return -1; }/*{{{*/
 /*}}}*/
-int IntParam::ObjectEnum(void){/*{{{*/
+int  IntParam::ObjectEnum(void){/*{{{*/
 
 	return IntParamEnum;
 
@@ -54,3 +54,13 @@
 
 }
 /*}}}*/
+void IntParam::Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ /*{{{*/
+
+	MARSHALLING_ENUM(IntParamEnum);
+
+	MARSHALLING(enum_type);
+	MARSHALLING(value);
+
+}
+/*}}}*/
+

Modified: issm/trunk/src/c/classes/Params/IntParam.h
===================================================================
--- issm/trunk/src/c/classes/Params/IntParam.h	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/classes/Params/IntParam.h	2016-04-13 04:32:01 UTC (rev 20500)
@@ -36,6 +36,7 @@
 		int   Id(); 
 		int   ObjectEnum();
 		Object* copy();
+		void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction);
 		/*}}}*/
 		/*Param vritual function definitions: {{{*/
 		int   InstanceEnum(){return enum_type;}

Modified: issm/trunk/src/c/classes/Params/IntVecParam.cpp
===================================================================
--- issm/trunk/src/c/classes/Params/IntVecParam.cpp	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/classes/Params/IntVecParam.cpp	2016-04-13 04:32:01 UTC (rev 20500)
@@ -70,9 +70,9 @@
 	}
 }
 /*}}}*/
-int    IntVecParam::Id(void){ return -1; }/*{{{*/
+int  IntVecParam::Id(void){ return -1; }/*{{{*/
 /*}}}*/
-int IntVecParam::ObjectEnum(void){/*{{{*/
+int  IntVecParam::ObjectEnum(void){/*{{{*/
 
 	return IntVecParamEnum;
 
@@ -84,7 +84,20 @@
 
 }
 /*}}}*/
+void IntVecParam::Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ /*{{{*/
 
+	MARSHALLING_ENUM(IntVecParamEnum);
+
+	MARSHALLING(enum_type);
+	MARSHALLING(M);
+	if(M) { 
+		MARSHALLING_DYNAMIC(values,int,M);
+	}
+	else values=NULL;
+
+}
+/*}}}*/
+
 /*IntVecParam virtual functions definitions: */
 void  IntVecParam::GetParameterValue(int** pintarray,int* pM){/*{{{*/
 	int* output=NULL;

Modified: issm/trunk/src/c/classes/Params/IntVecParam.h
===================================================================
--- issm/trunk/src/c/classes/Params/IntVecParam.h	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/classes/Params/IntVecParam.h	2016-04-13 04:32:01 UTC (rev 20500)
@@ -37,6 +37,7 @@
 		int   Id(); 
 		int   ObjectEnum();
 		Object* copy();
+		void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction);
 		/*}}}*/
 		/*Param virtual functions definitions: {{{*/
 		int   InstanceEnum(){return enum_type;}

Modified: issm/trunk/src/c/classes/Params/MatrixParam.cpp
===================================================================
--- issm/trunk/src/c/classes/Params/MatrixParam.cpp	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/classes/Params/MatrixParam.cpp	2016-04-13 04:32:01 UTC (rev 20500)
@@ -49,7 +49,7 @@
 	this->value->Echo();
 }
 /*}}}*/
-int    MatrixParam::Id(void){ return -1; }/*{{{*/
+int  MatrixParam::Id(void){ return -1; }/*{{{*/
 /*}}}*/
 int MatrixParam::ObjectEnum(void){/*{{{*/
 

Modified: issm/trunk/src/c/classes/Params/MatrixParam.h
===================================================================
--- issm/trunk/src/c/classes/Params/MatrixParam.h	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/classes/Params/MatrixParam.h	2016-04-13 04:32:01 UTC (rev 20500)
@@ -36,6 +36,7 @@
 		int   Id(); 
 		int   ObjectEnum();
 		Object* copy();
+		void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ _error_("not implemented yet!"); };
 		/*}}}*/
 		/*Param vritual function definitions: {{{*/
 		int   InstanceEnum(){return enum_type;}

Modified: issm/trunk/src/c/classes/Params/Parameters.cpp
===================================================================
--- issm/trunk/src/c/classes/Params/Parameters.cpp	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/classes/Params/Parameters.cpp	2016-04-13 04:32:01 UTC (rev 20500)
@@ -464,7 +464,7 @@
 	for ( object=objects.begin() ; object < objects.end(); object++ ){
 
 		param=xDynamicCast<Param*>(*object);
-		if(param->InstanceEnum()==enum_type){
+		if(param && param->InstanceEnum()==enum_type){
 			return (*object);
 		}
 	}

Modified: issm/trunk/src/c/classes/Params/StringArrayParam.cpp
===================================================================
--- issm/trunk/src/c/classes/Params/StringArrayParam.cpp	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/classes/Params/StringArrayParam.cpp	2016-04-13 04:32:01 UTC (rev 20500)
@@ -80,7 +80,33 @@
 
 }
 /*}}}*/
+void StringArrayParam::Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ /*{{{*/
 
+	int* sizes=NULL;
+
+	if(marshall_direction==MARSHALLING_FORWARD || marshall_direction==MARSHALLING_SIZE){
+		if(numstrings)sizes=xNew<int>(numstrings);
+		for(int i=0;i<numstrings;i++)sizes[i]=strlen(value[i])+1;
+	}	
+
+	MARSHALLING_ENUM(StringArrayParamEnum);
+	
+	MARSHALLING(enum_type);
+	MARSHALLING(numstrings);
+
+	if(numstrings){
+		MARSHALLING_DYNAMIC(sizes,int,numstrings);
+		if(marshall_direction==MARSHALLING_BACKWARD) value=xNew<char*>(numstrings);
+		for(int i=0;i<numstrings;i++)MARSHALLING_DYNAMIC(value[i],char,sizes[i]);
+	}
+	else value=NULL;
+
+	//cleanup sizes array
+	if(sizes) xDelete<int>(sizes);
+
+}
+/*}}}*/
+
 /*StringArrayParam virtual functions definitions: */
 void  StringArrayParam::GetParameterValue(char*** pstringarray,int* pM){/*{{{*/
 

Modified: issm/trunk/src/c/classes/Params/StringArrayParam.h
===================================================================
--- issm/trunk/src/c/classes/Params/StringArrayParam.h	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/classes/Params/StringArrayParam.h	2016-04-13 04:32:01 UTC (rev 20500)
@@ -20,7 +20,6 @@
 class StringArrayParam: public Param{
 
 	private: 
-		/*just hold 3 values for 3 vertices: */
 		int      enum_type;
 		char**   value;
 		int      numstrings;
@@ -37,6 +36,7 @@
 		int   Id(); 
 		int   ObjectEnum();
 		Object* copy();
+		void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction);
 		/*}}}*/
 		/*Param vritual function definitions: {{{*/
 		int   InstanceEnum(){return enum_type;}

Modified: issm/trunk/src/c/classes/Params/StringParam.cpp
===================================================================
--- issm/trunk/src/c/classes/Params/StringParam.cpp	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/classes/Params/StringParam.cpp	2016-04-13 04:32:01 UTC (rev 20500)
@@ -55,7 +55,20 @@
 
 }
 /*}}}*/
+void StringParam::Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ /*{{{*/
 
+	int size;
+
+	if(marshall_direction==MARSHALLING_FORWARD || marshall_direction == MARSHALLING_SIZE)size=strlen(value)+1;
+	
+	MARSHALLING_ENUM(StringParamEnum);
+	MARSHALLING(enum_type);
+	MARSHALLING(size);
+	MARSHALLING_DYNAMIC(value,char,size);
+
+}
+/*}}}*/
+
 /*StringParam virtual functions definitions: */
 void  StringParam::GetParameterValue(char** pstring){/*{{{*/
 

Modified: issm/trunk/src/c/classes/Params/StringParam.h
===================================================================
--- issm/trunk/src/c/classes/Params/StringParam.h	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/classes/Params/StringParam.h	2016-04-13 04:32:01 UTC (rev 20500)
@@ -36,6 +36,7 @@
 		int   Id(); 
 		int   ObjectEnum();
 		Object* copy();
+		void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction);
 		/*}}}*/
 		/*Param vritual function definitions: {{{*/
 		int   InstanceEnum(){return enum_type;}

Modified: issm/trunk/src/c/classes/Params/TransientParam.cpp
===================================================================
--- issm/trunk/src/c/classes/Params/TransientParam.cpp	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/classes/Params/TransientParam.cpp	2016-04-13 04:32:01 UTC (rev 20500)
@@ -19,12 +19,13 @@
 	return;
 }
 /*}}}*/
-TransientParam::TransientParam(int in_enum_type,IssmDouble* in_values,IssmDouble* in_time,int in_N){/*{{{*/
+TransientParam::TransientParam(int in_enum_type,IssmDouble* in_values,IssmDouble* in_time,bool interpolation_on,int in_N){/*{{{*/
 
 	_assert_(in_values && in_time);
 
 	enum_type=in_enum_type;
 	N=in_N;
+	interpolation=interpolation_on;
 
 	values=xNew<IssmDouble>(N);
 	xMemCpy<IssmDouble>(values,in_values,N);
@@ -58,9 +59,9 @@
 	}
 }
 /*}}}*/
-int    TransientParam::Id(void){ return -1; }/*{{{*/
+int  TransientParam::Id(void){ return -1; }/*{{{*/
 /*}}}*/
-int TransientParam::ObjectEnum(void){/*{{{*/
+int  TransientParam::ObjectEnum(void){/*{{{*/
 
 	return TransientParamEnum;
 
@@ -68,11 +69,27 @@
 /*}}}*/
 Object* TransientParam::copy() {/*{{{*/
 
-	return new TransientParam(this->enum_type,this->values,this->timesteps,this->N);
+	return new TransientParam(this->enum_type,this->values,this->timesteps,this->interpolation,this->N);
 
 }
 /*}}}*/
+void TransientParam::Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ /*{{{*/
 
+	MARSHALLING_ENUM(TransientParamEnum);
+
+	MARSHALLING(enum_type);
+	MARSHALLING(interpolation);
+	MARSHALLING(N);
+	if(marshall_direction==MARSHALLING_BACKWARD){
+		values=xNew<IssmDouble>(N);
+		timesteps=xNew<IssmDouble>(N);
+	}
+	MARSHALLING_ARRAY(values,IssmDouble,N);
+	MARSHALLING_ARRAY(timesteps,IssmDouble,N);
+
+}
+/*}}}*/
+
 /*TransientParam virtual functions definitions: */
 void  TransientParam::GetParameterValue(IssmDouble* pdouble,IssmDouble time){/*{{{*/
 
@@ -86,7 +103,7 @@
 		output=this->values[0];
 		found=true;
 	}
-	else if(time>this->timesteps[this->N-1]){
+	else if(time>this->timesteps[this->N-1] || !interpolation){
 		/*get values for the last time: */
 		output=this->values[this->N-1];
 		found=true;

Modified: issm/trunk/src/c/classes/Params/TransientParam.h
===================================================================
--- issm/trunk/src/c/classes/Params/TransientParam.h	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/classes/Params/TransientParam.h	2016-04-13 04:32:01 UTC (rev 20500)
@@ -22,13 +22,14 @@
 	protected: 
 		int         enum_type;
 		int         N;
+		bool        interpolation;
 		IssmDouble *values;
 		IssmDouble *timesteps;
 
 	public:
 		/*TransientParam constructors, destructors: {{{*/
 		TransientParam();
-		TransientParam(int in_enum_type,IssmDouble* in_values,IssmDouble* in_time,int in_N);
+		TransientParam(int in_enum_type,IssmDouble* in_values,IssmDouble* in_time,bool interpolation_on,int in_N);
 		~TransientParam();
 		/*}}}*/
 		/*Object virtual functions definitions:{{{ */
@@ -37,6 +38,7 @@
 		int   Id(); 
 		int   ObjectEnum();
 		Object* copy();
+		void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction);
 		/*}}}*/
 		/*Param vritual function definitions: {{{*/
 		int   InstanceEnum(){return enum_type;}

Modified: issm/trunk/src/c/classes/Params/VectorParam.h
===================================================================
--- issm/trunk/src/c/classes/Params/VectorParam.h	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/classes/Params/VectorParam.h	2016-04-13 04:32:01 UTC (rev 20500)
@@ -36,6 +36,7 @@
 		int   Id(); 
 		int   ObjectEnum();
 		Object* copy();
+		void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ _error_("not implemented yet!"); };
 		/*}}}*/
 		/*Param vritual function definitions: {{{*/
 		int   InstanceEnum(){return enum_type;}

Modified: issm/trunk/src/c/classes/Profiler.cpp
===================================================================
--- issm/trunk/src/c/classes/Profiler.cpp	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/classes/Profiler.cpp	2016-04-13 04:32:01 UTC (rev 20500)
@@ -69,7 +69,17 @@
 
 }
 /*}}}*/
+void Profiler::Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ /*{{{*/
 
+	MARSHALLING_ENUM(ProfilerEnum);
+
+	time->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
+	flops->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
+	memory->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
+
+}
+/*}}}*/
+
 /*Profiler routines:*/
 void  Profiler::Tag(int tagenum,bool dontmpisync){/*{{{*/
 

Modified: issm/trunk/src/c/classes/Profiler.h
===================================================================
--- issm/trunk/src/c/classes/Profiler.h	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/classes/Profiler.h	2016-04-13 04:32:01 UTC (rev 20500)
@@ -42,6 +42,7 @@
 		int     Id();
 		int     ObjectEnum();
 		Object *copy();
+		void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction);
 		/*}}}*/
 		/*Profiler routines {{{*/
 		void    Tag(int tagenum,bool dontmpisync=false);

Modified: issm/trunk/src/c/classes/Segment.h
===================================================================
--- issm/trunk/src/c/classes/Segment.h	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/classes/Segment.h	2016-04-13 04:32:01 UTC (rev 20500)
@@ -70,6 +70,10 @@
 			return new Segment(this->eid,this->x1,this->y1,this->x2,this->y2);
 		}
 		/*}}}*/
+		void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){/*{{{*/
+			_error_("not implemented yet!"); 
+		} 
+		/*}}}*/
 
 };
 

Modified: issm/trunk/src/c/classes/Vertex.cpp
===================================================================
--- issm/trunk/src/c/classes/Vertex.cpp	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/classes/Vertex.cpp	2016-04-13 04:32:01 UTC (rev 20500)
@@ -36,6 +36,11 @@
 			_assert_(iomodel->Data(BaseEnum) && iomodel->Data(ThicknessEnum));
 			this->sigma = (iomodel->Data(MeshZEnum)[i]-iomodel->Data(BaseEnum)[i])/(iomodel->Data(ThicknessEnum)[i]);
 			break;
+		case Domain3DsurfaceEnum:
+			this->latitute     = iomodel->Data(MeshLatEnum)[i];
+			this->longitude    = iomodel->Data(MeshLongEnum)[i];
+			this->R            = iomodel->Data(MeshREnum)[i];
+			break;
 		case Domain2DhorizontalEnum:
 			this->sigma = 0.;
 			break;
@@ -90,7 +95,23 @@
 
 }
 /*}}}*/
+void Vertex::Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ /*{{{*/
 
+	MARSHALLING_ENUM(VertexEnum);
+	MARSHALLING(clone);
+	MARSHALLING(domaintype);
+	MARSHALLING(id);
+	MARSHALLING(sid);
+	MARSHALLING(pid);
+	MARSHALLING(x);
+	MARSHALLING(y);
+	MARSHALLING(z);
+	MARSHALLING(sigma);
+	MARSHALLING(connectivity);
+
+}
+/*}}}*/
+
 /*Vertex management: */
 int        Vertex::Connectivity(void){return connectivity;}/*{{{*/
 /*}}}*/
@@ -106,6 +127,18 @@
 	return this->z;
 }
 /*}}}*/
+IssmDouble Vertex::GetLatitude(){/*{{{*/
+	return this->latitute;
+}
+/*}}}*/
+IssmDouble Vertex::GetLongitude(){/*{{{*/
+	return this->longitude;
+}
+/*}}}*/
+IssmDouble Vertex::GetRadius(){/*{{{*/
+	return this->R;
+}
+/*}}}*/
 int        Vertex::Sid(void){ return sid; }/*{{{*/
 /*}}}*/
 int        Vertex::Pid(void){ return pid; }/*{{{*/
@@ -222,27 +255,43 @@
 	matrix->SetValues(1,&sid,3,&indices[0],&xyz[0],INS_VAL);
 }
 /*}}}*/
-void       Vertex::VertexCoordinates(Vector<IssmDouble>* vx,Vector<IssmDouble>* vy,Vector<IssmDouble>* vz){/*{{{*/
+void       Vertex::VertexCoordinates(Vector<IssmDouble>* vx,Vector<IssmDouble>* vy,Vector<IssmDouble>* vz, bool spherical){/*{{{*/
 
 	if (this->clone==true) return;
 
-	vx->SetValue(this->sid,this->x,INS_VAL);
-	vy->SetValue(this->sid,this->y,INS_VAL);
-	vz->SetValue(this->sid,this->z,INS_VAL);
+	if(!spherical){
+		vx->SetValue(this->sid,this->x,INS_VAL);
+		vy->SetValue(this->sid,this->y,INS_VAL);
+		vz->SetValue(this->sid,this->z,INS_VAL);
+	}
+	else{
+		vx->SetValue(this->sid,this->latitute,INS_VAL);
+		vy->SetValue(this->sid,this->longitude,INS_VAL);
+		vz->SetValue(this->sid,this->R,INS_VAL);
+	}
 
 	return;
 }
 /*}}}*/
 
 /*Methods relating to Vertex, but not internal methods: */
-void GetVerticesCoordinates(IssmDouble* xyz,Vertex** vertices, int numvertices){ /*{{{*/
+void GetVerticesCoordinates(IssmDouble* xyz,Vertex** vertices, int numvertices,bool spherical){ /*{{{*/
 
 	_assert_(vertices);
 	_assert_(xyz);
 
-	for(int i=0;i<numvertices;i++) {
-		xyz[i*3+0]=vertices[i]->GetX();
-		xyz[i*3+1]=vertices[i]->GetY();
-		xyz[i*3+2]=vertices[i]->GetZ();
+	if(!spherical){
+		for(int i=0;i<numvertices;i++) {
+			xyz[i*3+0]=vertices[i]->GetX();
+			xyz[i*3+1]=vertices[i]->GetY();
+			xyz[i*3+2]=vertices[i]->GetZ();
+		}
 	}
+	else{
+		for(int i=0;i<numvertices;i++) {
+			xyz[i*3+0]=vertices[i]->GetLatitude();
+			xyz[i*3+1]=vertices[i]->GetLongitude();
+			xyz[i*3+2]=vertices[i]->GetRadius();
+		}
+	}
 }/*}}}*/

Modified: issm/trunk/src/c/classes/Vertex.h
===================================================================
--- issm/trunk/src/c/classes/Vertex.h	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/classes/Vertex.h	2016-04-13 04:32:01 UTC (rev 20500)
@@ -27,6 +27,9 @@
 		IssmDouble x;
 		IssmDouble y;
 		IssmDouble z;
+		IssmDouble latitute;
+		IssmDouble longitude;
+		IssmDouble R;
 		IssmDouble sigma;        //sigma coordinate: (z-bed)/thickness
 		int        connectivity; //number of vertices connected to this vertex
 
@@ -41,6 +44,8 @@
 		int   Id(); 
 		int   ObjectEnum();
 		Object* copy();
+		void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction);
+
 		/*}}}*/
 		/*Vertex management:*/ 
 		int        Pid(void); 
@@ -49,6 +54,9 @@
 		IssmDouble GetX(void); 
 		IssmDouble GetY(void); 
 		IssmDouble GetZ(void); 
+		IssmDouble GetLatitude(void); 
+		IssmDouble GetLongitude(void); 
+		IssmDouble GetRadius(void); 
 		void       UpdatePosition(Vector<IssmDouble>* vx,Vector<IssmDouble>* vy,Vector<IssmDouble>* vz,Parameters* parameters,IssmDouble* thickness,IssmDouble* bed);
 		void       DistributePids(int* ppidcount);
 		void       OffsetPids(int pidcount);
@@ -56,10 +64,10 @@
 		void       UpdateClonePids(int* allborderpids);
 		void       SetClone(int* minranks);
 		void       ToXYZ(Matrix<IssmDouble>* matrix);
-		void       VertexCoordinates(Vector<IssmDouble>* vx,Vector<IssmDouble>* vy,Vector<IssmDouble>* vz);
+		void       VertexCoordinates(Vector<IssmDouble>* vx,Vector<IssmDouble>* vy,Vector<IssmDouble>* vz,bool spherical=false);
 };
 
 /*Methods relating to Vertex object: */
-void GetVerticesCoordinates(IssmDouble* xyz,Vertex** vertices, int numvertices);
+void GetVerticesCoordinates(IssmDouble* xyz,Vertex** vertices, int numvertices,bool spherical=false);
 
 #endif  /* _VERTEX_H */

Modified: issm/trunk/src/c/classes/classes.h
===================================================================
--- issm/trunk/src/c/classes/classes.h	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/classes/classes.h	2016-04-13 04:32:01 UTC (rev 20500)
@@ -18,6 +18,7 @@
 #include "./Segment.h"
 #include "./Massfluxatgate.h"
 #include "./Misfit.h"
+#include "./Nodalvalue.h"
 #include "./Masscon.h"
 #include "./Massconaxpby.h"
 
@@ -33,9 +34,11 @@
 #include "./Loads/Load.h"
 #include "./Loads/Friction.h"
 #include "./Loads/Numericalflux.h"
+#include "./Loads/Neumannflux.h"
 #include "./Loads/Riftfront.h"
 #include "./Loads/Penpair.h"
 #include "./Loads/Pengrid.h"
+#include "./Loads/Moulin.h"
 
 /*Elements: */
 #include "./Elements/Elements.h"
@@ -61,6 +64,7 @@
 #include "./Inputs/Input.h"
 #include "./Inputs/BoolInput.h"
 #include "./Inputs/DoubleInput.h"
+#include "./Inputs/DoubleArrayInput.h"
 #include "./Inputs/IntInput.h"
 #include "./Inputs/TetraInput.h"
 #include "./Inputs/PentaInput.h"
@@ -111,6 +115,10 @@
 /*kriging: */
 #include "./kriging/krigingobjects.h"
 
+/*dakota:*/
+#include "./Dakota/IssmDirectApplicInterface.h"
+#include "./Dakota/IssmParallelDirectApplicInterface.h"
+
 /*diverse: */
 #include "./Hook.h"
 #include "./DofIndexing.h"

Modified: issm/trunk/src/c/classes/gauss/GaussPenta.cpp
===================================================================
--- issm/trunk/src/c/classes/gauss/GaussPenta.cpp	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/classes/gauss/GaussPenta.cpp	2016-04-13 04:32:01 UTC (rev 20500)
@@ -286,9 +286,9 @@
 					_error_("index "<<index<<" not supported yet");
 			}
 			this->weights[ig] = this->weights[ig]*r1*r2;
-			this->coords4=xNew<IssmDouble>(numgauss);
-			for(ig=0;ig<numgauss;ig++) this->coords4[ig]=-1.0;
 		}
+		this->coords4=xNew<IssmDouble>(numgauss);
+		for(ig=0;ig<numgauss;ig++) this->coords4[ig]=-1.0;
 	}
 	else{
 		/*Double number of gauss points*/

Modified: issm/trunk/src/c/classes/kriging/Covertree.cpp
===================================================================
--- issm/trunk/src/c/classes/kriging/Covertree.cpp	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/classes/kriging/Covertree.cpp	2016-04-13 04:32:01 UTC (rev 20500)
@@ -1,11 +1,9 @@
 #include "../classes.h"
-//#include <utility>
 #include <set>
-//#include <vector>
 #include <algorithm>
 
 	/*Constructors/Destructors*/
-Covertree::Covertree(int maxLevel,const std::vector<Observation>& points){
+Covertree::Covertree(int maxLevel,const std::vector<Observation>& points){/*{{{*/
 	this->base = 2.;
 	_root=NULL;
 	_numNodes=0;
@@ -15,9 +13,8 @@
 	for(it=points.begin(); it!=points.end(); ++it) {
 		this->insert(*it);//adds data to the covertree object
 	}
-}
-
-Covertree::~Covertree(){
+}/*}}}*/
+Covertree::~Covertree(){/*{{{*/
 	if(_root==NULL) return;
 	//Get all of the root's children (from any level),
 	//delete the root, repeat for each of the children
@@ -30,10 +27,10 @@
 		nodes.insert(nodes.begin(),children.begin(),children.end());
 		delete byeNode;
 	}   
-}
+}/*}}}*/
 
-/*Methods*/
-std::vector<Covertree::CoverTreeNode*> Covertree::kNearestNodes(const Observation& p, const unsigned int& k) const{
+	/*Methods*/
+std::vector<Covertree::CoverTreeNode*> Covertree::kNearestNodes(const Observation& p, const unsigned int& k) const{/*{{{*/
 	if(_root==NULL) return std::vector<CoverTreeNode*>();
 	//maxDist is the kth nearest known point to p, and also the farthest
 	//point from p in the set minNodes defined below.
@@ -79,8 +76,8 @@
 		kNN.push_back(it->second);
 	}
 	return kNN;
-}
-bool Covertree::insert_rec(const Observation& p, const std::vector<distNodePair>& Qi, const int& level){
+}/*}}}*/
+bool   Covertree::insert_rec(const Observation& p, const std::vector<distNodePair>& Qi, const int& level){/*{{{*/
 	std::vector<std::pair<double, CoverTreeNode*> > Qj;
 	double sep = pow(base,level);
 	double minDist = 1.e+50;
@@ -118,9 +115,8 @@
 			return found;
 		}
 	}
-}
-
-void Covertree::remove_rec(const Observation& p, std::map<int,std::vector<distNodePair> >& coverSets, int level, bool& multi){
+}/*}}}*/
+void   Covertree::remove_rec(const Observation& p, std::map<int,std::vector<distNodePair> >& coverSets, int level, bool& multi){/*{{{*/
 	std::vector<distNodePair>& Qi = coverSets[level];
 	std::vector<distNodePair>& Qj = coverSets[level-1];
 	double minDist = 1.e+50;
@@ -221,16 +217,11 @@
 			_numNodes--;
 		}
 	}
-}
-
-int Covertree::get_numberofobs(){
+}/*}}}*/
+int Covertree::get_numberofobs(){/*{{{*/
 	return _numNodes;
-}
-
-std::pair<double, Covertree::CoverTreeNode*>
-Covertree::distance(const Observation& p,
-			const std::vector<CoverTreeNode*>& Q)
-{
+}/*}}}*/
+std::pair<double, Covertree::CoverTreeNode*> Covertree::distance(const Observation& p, const std::vector<CoverTreeNode*>& Q){/*{{{*/
 	double minDist = 1.e+50;
 	CoverTreeNode* minNode;
 	std::vector<CoverTreeNode*>::const_iterator it;
@@ -242,10 +233,8 @@
 		}
 	}
 	return std::make_pair(minDist,minNode);  
-}
-
-void Covertree::insert(const Observation& newObservation)
-{
+}/*}}}*/
+void   Covertree::insert(const Observation& newObservation){/*{{{*/
 	if(_root==NULL) {
 		_root = new CoverTreeNode(newObservation);
 		_numNodes=1;
@@ -264,10 +253,8 @@
 					(1,std::make_pair(_root->distance(newObservation),_root)),
 					_maxLevel);
 	}
-}
-
-void Covertree::remove(const Observation& p)
-{
+}/*}}}*/
+void   Covertree::remove(const Observation& p){/*{{{*/
 	//Most of this function's code is for the special case of removing the root
 	if(_root==NULL) return;
 	bool removingRoot=_root->hasObservation(p);
@@ -304,9 +291,8 @@
 		_numNodes--;
 		_root=newRoot;
 	}
-}
-
-std::vector<Observation> Covertree::kNearestNeighbors(const Observation& p, const unsigned int& k) const{
+}/*}}}*/
+std::vector<Observation> Covertree::kNearestNeighbors(const Observation& p, const unsigned int& k) const{/*{{{*/
 	if(_root==NULL) return std::vector<Observation>();
 	std::vector<CoverTreeNode*> v = kNearestNodes(p, k);
 	std::vector<Observation> kNN;
@@ -317,9 +303,8 @@
 		if(kNN.size() >= k) break;
 	}
 	return kNN;
-}
-
-void Covertree::print() const{
+}/*}}}*/
+void   Covertree::print() const{/*{{{*/
 	int d = _maxLevel-_minLevel+1;
 	std::vector<CoverTreeNode*> Q;
 	Q.push_back(_root);
@@ -345,35 +330,26 @@
 		Q.insert(Q.end(),newQ.begin(),newQ.end());
 		std::cout << "\n\n";
 	}
-}
+}/*}}}*/
 
-Covertree::CoverTreeNode* Covertree::getRoot() const
-{
+Covertree::CoverTreeNode* Covertree::getRoot() const{/*{{{*/
 	return _root;
-}
-
-Covertree::CoverTreeNode::CoverTreeNode(const Observation& p) {
+}/*}}}*/
+Covertree::CoverTreeNode::CoverTreeNode(const Observation& p) {/*{{{*/
 	_observations.push_back(p);
-}
-
-std::vector<Covertree::CoverTreeNode*>
-Covertree::CoverTreeNode::getChildren(int level) const
-{
+}/*}}}*/
+std::vector<Covertree::CoverTreeNode*> Covertree::CoverTreeNode::getChildren(int level) const{/*{{{*/
 	std::map<int,std::vector<CoverTreeNode*> >::const_iterator
 	  it = _childMap.find(level);
 	if(it!=_childMap.end()) {
 		return it->second;
 	}
 	return std::vector<CoverTreeNode*>();
-}
-
-void Covertree::CoverTreeNode::addChild(int level, CoverTreeNode* p)
-{
+}/*}}}*/
+void   Covertree::CoverTreeNode::addChild(int level, CoverTreeNode* p){/*{{{*/
 	_childMap[level].push_back(p);
-}
-
-void Covertree::CoverTreeNode::removeChild(int level, CoverTreeNode* p)
-{
+}/*}}}*/
+void   Covertree::CoverTreeNode::removeChild(int level, CoverTreeNode* p){/*{{{*/
 	std::vector<CoverTreeNode*>& v = _childMap[level];
 	for(unsigned int i=0;i<v.size();i++) {
 		if(v[i]==p) {
@@ -382,51 +358,38 @@
 			break;
 		}
 	}
-}
-
-void Covertree::CoverTreeNode::addObservation(const Observation& p)
-{
+}/*}}}*/
+void   Covertree::CoverTreeNode::addObservation(const Observation& p){/*{{{*/
 	if(find(_observations.begin(), _observations.end(), p) == _observations.end())
 	 _observations.push_back(p);
-}
-
-void Covertree::CoverTreeNode::removeObservation(const Observation& p)
-{
+}/*}}}*/
+void   Covertree::CoverTreeNode::removeObservation(const Observation& p){/*{{{*/
 	std::vector<Observation>::iterator it =
 	  find(_observations.begin(), _observations.end(), p);
 	if(it != _observations.end())
 	 _observations.erase(it);
-}
-
-double Covertree::CoverTreeNode::distance(const CoverTreeNode& p) const
-{
+}/*}}}*/
+double Covertree::CoverTreeNode::distance(const CoverTreeNode& p) const{/*{{{*/
 	return _observations[0].distance(p.getObservation());
-}
-
-bool Covertree::CoverTreeNode::isSingle() const
-{
+}/*}}}*/
+bool   Covertree::CoverTreeNode::isSingle() const{/*{{{*/
 	return _observations.size() == 1;
-}
-
-bool Covertree::CoverTreeNode::hasObservation(const Observation& p) const
-{
+}/*}}}*/
+bool   Covertree::CoverTreeNode::hasObservation(const Observation& p) const{/*{{{*/
 	return find(_observations.begin(), _observations.end(), p) != _observations.end();
-}
-
-const Observation& Covertree::CoverTreeNode::getObservation() const { return _observations[0]; }
-
-std::vector<Covertree::CoverTreeNode*>
-Covertree::CoverTreeNode::getAllChildren() const
-{
+}/*}}}*/
+const Observation& Covertree::CoverTreeNode::getObservation() const{/*{{{*/
+	return _observations[0]; 
+}/*}}}*/
+std::vector<Covertree::CoverTreeNode*> Covertree::CoverTreeNode::getAllChildren() const{/*{{{*/
 	std::vector<CoverTreeNode*> children;
 	std::map<int,std::vector<CoverTreeNode*> >::const_iterator it;
 	for(it=_childMap.begin();it!=_childMap.end();++it) {
 		children.insert(children.end(), it->second.begin(), it->second.end());
 	}
 	return children;
-}
-
-bool Covertree::isValidTree() const {
+}/*}}}*/
+bool   Covertree::isValidTree() const {/*{{{*/
 	if(_numNodes==0)
 	 return _root==NULL;
 
@@ -464,4 +427,4 @@
 		nodes.insert(nodes.begin(),allChildren.begin(),allChildren.end());
 	}
 	return true;
-}
+}/*}}}*/

Modified: issm/trunk/src/c/classes/kriging/Covertree.h
===================================================================
--- issm/trunk/src/c/classes/kriging/Covertree.h	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/classes/kriging/Covertree.h	2016-04-13 04:32:01 UTC (rev 20500)
@@ -7,10 +7,8 @@
 
 class Covertree{
 
-	/**
-	 * Cover tree node. Consists of arbitrarily many points P, as long as
-	 * they have distance 0 to each other. Keeps track of its children.
-	 */
+	/* Cover tree node. Consists of arbitrarily many points P, as long as they
+	 * have distance 0 to each other. Keeps track of its children.  */
 	class CoverTreeNode{
 		private:
 			//_childMap[i] is a vector of the node's children at level i
@@ -33,10 +31,8 @@
 			void removeObservation(const Observation& o);
 			const std::vector<Observation>& getObservations() { return _observations; }
 			double distance(const CoverTreeNode& p) const;
-
-			bool isSingle() const;
-			bool hasObservation(const Observation& o) const;
-
+			bool   isSingle() const;
+			bool   hasObservation(const Observation& o) const;
 			const Observation& getObservation() const;
 
 			/**
@@ -48,33 +44,24 @@
 	private:
 	typedef std::pair<double, CoverTreeNode*> distNodePair;
 
-	CoverTreeNode* _root;
-	unsigned int _numNodes;
-	int _maxLevel;//base^_maxLevel should be the max distance
+	CoverTreeNode *_root;
+	unsigned int   _numNodes;
+	int            _maxLevel;   //base^_maxLevel should be the max distance
 	//between any 2 points
-	int _minLevel;//A level beneath which there are no more new nodes.
+	int            _minLevel;   //A level beneath which there are no more new nodes.
 
-	std::vector<CoverTreeNode*>
-	  kNearestNodes(const Observation& o, const unsigned int& k) const;
+	std::vector<CoverTreeNode*> kNearestNodes(const Observation& o, const unsigned int& k) const;
 	/**
 	 * Recursive implementation of the insert algorithm (see paper).
 	 */
-	bool insert_rec(const Observation& p,
-				const std::vector<distNodePair>& Qi,
-				const int& level);
+	bool insert_rec(const Observation& p, const std::vector<distNodePair>& Qi,const int& level);
 
-	/**
-	 * Finds the node in Q with the minimum distance to p. Returns a
-	 * pair consisting of this node and the distance.
-	 */
-	distNodePair distance(const Observation& p,
-				const std::vector<CoverTreeNode*>& Q);
+	/* Finds the node in Q with the minimum distance to p. Returns a pair
+	 * consisting of this node and the distance.  */
+	distNodePair distance(const Observation& p,const std::vector<CoverTreeNode*>& Q);
 
 
-	void remove_rec(const Observation& p,
-				std::map<int,std::vector<distNodePair> >& coverSets,
-				int level,
-				bool& multi);
+	void remove_rec(const Observation& p, std::map<int,std::vector<distNodePair> >& coverSets, int level, bool& multi);
 
 	public:
 	double base;
@@ -88,8 +75,7 @@
 	 * if an inaccurate maxDist is given.
 	 */
 
-	Covertree(int maxDist,
-				const std::vector<Observation>& points=std::vector<Observation>()); 
+	Covertree(int maxDist,const std::vector<Observation>& points=std::vector<Observation>()); 
 	~Covertree();
 
 	/**

Modified: issm/trunk/src/c/classes/kriging/ExponentialVariogram.h
===================================================================
--- issm/trunk/src/c/classes/kriging/ExponentialVariogram.h	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/classes/kriging/ExponentialVariogram.h	2016-04-13 04:32:01 UTC (rev 20500)
@@ -26,7 +26,9 @@
 		int   Id(){_error_("Not implemented yet");}; 
 		int   ObjectEnum(){_error_("Not implemented yet");};
 		Object* copy();
+		void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ _error_("not implemented yet!"); };
 
+
 		/*Variogram functions*/
 		double SemiVariogram(double deltax,double deltay);
 		double Covariance(double deltax,double deltay);

Modified: issm/trunk/src/c/classes/kriging/GaussianVariogram.h
===================================================================
--- issm/trunk/src/c/classes/kriging/GaussianVariogram.h	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/classes/kriging/GaussianVariogram.h	2016-04-13 04:32:01 UTC (rev 20500)
@@ -27,6 +27,7 @@
 		int   Id(){_error_("Not implemented yet");}; 
 		int   ObjectEnum(){_error_("Not implemented yet");};
 		Object* copy();
+		void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ _error_("not implemented yet!"); };
 
 		/*Variogram functions*/
 		double SemiVariogram(double deltax,double deltay);

Modified: issm/trunk/src/c/classes/kriging/Observation.h
===================================================================
--- issm/trunk/src/c/classes/kriging/Observation.h	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/classes/kriging/Observation.h	2016-04-13 04:32:01 UTC (rev 20500)
@@ -32,7 +32,9 @@
 		int     ObjectEnum(){_error_("Not implemented yet"); };
 		bool operator==(const Observation& ob) const;
 		Object *copy();
+		void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ _error_("not implemented yet!");};
 
+
 		/*Management*/
 		void WriteXYObs(const Observation& ob, double* px, double* py, double* pobs);
 		void WriteXYObs(double* px,double* py,double* pobs);

Modified: issm/trunk/src/c/classes/kriging/Observations.cpp
===================================================================
--- issm/trunk/src/c/classes/kriging/Observations.cpp	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/classes/kriging/Observations.cpp	2016-04-13 04:32:01 UTC (rev 20500)
@@ -58,9 +58,6 @@
 		default:
 			_error_("Tree type "<<this->treetype<<" not supported yet (1: quadtree, 2: covertree)");
 	}
-
-
-
 }
 /*}}}*/
 Observations::~Observations(){/*{{{*/
@@ -130,7 +127,7 @@
 		if(observations_list[i]>maxtrimming) continue;
 		if(observations_list[i]<mintrimming) continue;
 
-		/*First check that this observation is not too close from another one*/
+		/*Second, check that this observation is not too close from another one*/
 		this->quadtree->ClosestObs(&index,x[i],y[i]);
 		if(index>=0){
 			observation=xDynamicCast<Observation*>(this->GetObjectByOffset(index));
@@ -156,12 +153,56 @@
 /*}}}*/
 void Observations::InitCovertree(IssmPDouble* observations_list,IssmPDouble* x,IssmPDouble* y,int n,Options* options){/*{{{*/
 
-    int maxdepth = 20;
+	/*Intermediaries*/
+	 IssmPDouble  minspacing,mintrimming,maxtrimming;
+
+	/*Checks*/
+	_assert_(n);
+
+	/*Get trimming limits*/
+	options->Get(&mintrimming,"mintrimming",-1.e+21);
+	options->Get(&maxtrimming,"maxtrimming",+1.e+21);
+	options->Get(&minspacing,"minspacing",0.01);
+	if(minspacing<=0) _error_("minspacing must > 0");
+
+	/*Get maximum distance between 2 points
+	 *  maxDist should be the maximum distance that any two points
+	 *  can have between each other. IE p.distance(q) < maxDist for all
+	 *  p,q that you will ever try to insert. The cover tree may be invalid
+	 *  if an inaccurate maxDist is given.*/
+	IssmPDouble xmin = x[0];
+	IssmPDouble xmax = x[0];
+	IssmPDouble ymin = y[0];
+	IssmPDouble ymax = y[0];
+	for(int i=1;i<n;i++){
+		if(x[i]<xmin) xmin=x[i];
+		if(x[i]>xmax) xmax=x[i];
+		if(y[i]<ymin) ymin=y[i];
+		if(y[i]>ymax) ymax=y[i];
+	}
+	IssmPDouble maxDist = sqrt(pow(xmax-xmin,2)+pow(ymax-ymin,2));
+	IssmPDouble base    = 2.;
+	int         maxdepth = ceilf(log(maxDist)/log(base));
+
 	 _printf0_("Generating covertree with a maximum depth " <<  maxdepth <<"... ");
     this->covertree=new Covertree(maxdepth);
 
     for(int i=0;i<n;i++){
-		 this->covertree->insert(Observation(x[i],y[i],observations_list[i]));
+
+		/*First check limits*/
+		if(observations_list[i]>maxtrimming) continue;
+		if(observations_list[i]<mintrimming) continue;
+
+		/*Second, check that this observation is not too close from another one*/
+		Observation newobs = Observation(x[i],y[i],observations_list[i]);
+		if(i>0 && this->covertree->getRoot()){
+			/*Get closest obs and see if it is too close*/
+			std::vector<Observation> kNN=(this->covertree->kNearestNeighbors(newobs,1));
+			Observation oldobs = (*kNN.begin());
+			if(oldobs.distance(newobs)<minspacing) continue;
+		}
+
+		this->covertree->insert(newobs);
     }
 	 _printf0_("done\n");
 }
@@ -170,6 +211,20 @@
 /*Methods*/
 void Observations::ClosestObservation(IssmPDouble *px,IssmPDouble *py,IssmPDouble *pobs,IssmPDouble x_interp,IssmPDouble y_interp,IssmPDouble radius){/*{{{*/
 
+	switch(this->treetype){
+		case 1:
+			this->ClosestObservationQuadtree(px,py,pobs,x_interp,y_interp,radius);
+			break;
+		case 2:
+			this->ClosestObservationCovertree(px,py,pobs,x_interp,y_interp,radius);
+			break;
+		default:
+			_error_("Tree type "<<this->treetype<<" not supported yet (1: quadtree, 2: covertree)");
+	}
+
+}/*}}}*/
+void Observations::ClosestObservationQuadtree(IssmPDouble *px,IssmPDouble *py,IssmPDouble *pobs,IssmPDouble x_interp,IssmPDouble y_interp,IssmPDouble radius){/*{{{*/
+
 	/*Output and Intermediaries*/
 	int          nobs,i,index;
 	IssmPDouble  hmin,h2,hmin2;
@@ -219,6 +274,28 @@
 	xDelete<int>(indices);
 
 }/*}}}*/
+void Observations::ClosestObservationCovertree(IssmPDouble *px,IssmPDouble *py,IssmPDouble *pobs,IssmPDouble x_interp,IssmPDouble y_interp,IssmPDouble radius){/*{{{*/
+
+	IssmPDouble hmin  = UNDEF;
+
+	if(this->covertree->getRoot()){
+		/*Get closest obs and see if it is too close*/
+		Observation newobs = Observation(x_interp,y_interp,0.);
+		std::vector<Observation> kNN=(this->covertree->kNearestNeighbors(newobs,1));
+		Observation observation = (*kNN.begin());
+		hmin = observation.distance(newobs);
+		if(hmin<=radius){
+			*px   = observation.x;
+			*py   = observation.y;
+			*pobs = observation.value;
+			return;
+		}
+	}
+
+	*px   = UNDEF;
+	*py   = UNDEF;
+	*pobs = UNDEF;
+}/*}}}*/
 void Observations::Distances(IssmPDouble* distances,IssmPDouble *x,IssmPDouble *y,int n,IssmPDouble radius){/*{{{*/
 
 	IssmPDouble xi,yi,obs;
@@ -233,12 +310,47 @@
 		}
 	}
 }/*}}}*/
+void Observations::ObservationList(IssmPDouble **px,IssmPDouble **py,IssmPDouble **pobs,int* pnobs){/*{{{*/
+
+	/*Output and Intermediaries*/
+	int          nobs;
+	IssmPDouble *x            = NULL;
+	IssmPDouble *y            = NULL;
+	IssmPDouble *obs          = NULL;
+	Observation *observation  = NULL;
+
+	nobs = this->Size();
+
+	if(nobs){
+		x   = xNew<IssmPDouble>(nobs);
+		y   = xNew<IssmPDouble>(nobs);
+		obs = xNew<IssmPDouble>(nobs);
+		for(int i=0;i<this->Size();i++){
+			observation=xDynamicCast<Observation*>(this->GetObjectByOffset(i));
+			observation->WriteXYObs(&x[i],&y[i],&obs[i]);
+		}
+	}
+
+	/*Assign output pointer*/
+	*px=x;
+	*py=y;
+	*pobs=obs;
+	*pnobs=nobs;
+}/*}}}*/
 void Observations::ObservationList(IssmPDouble **px,IssmPDouble **py,IssmPDouble **pobs,int* pnobs,IssmPDouble x_interp,IssmPDouble y_interp,IssmPDouble radius,int maxdata){/*{{{*/
 
-	if(this->treetype==2){
-		this->ObservationList2(px,py,pobs,pnobs,x_interp,y_interp,radius,maxdata);
-		return;
+	switch(this->treetype){
+		case 1:
+			this->ObservationListQuadtree(px,py,pobs,pnobs,x_interp,y_interp,radius,maxdata);
+			break;
+		case 2:
+			this->ObservationListCovertree(px,py,pobs,pnobs,x_interp,y_interp,radius,maxdata);
+			break;
+		default:
+			_error_("Tree type "<<this->treetype<<" not supported yet (1: quadtree, 2: covertree)");
 	}
+}/*}}}*/
+void Observations::ObservationListQuadtree(IssmPDouble **px,IssmPDouble **py,IssmPDouble **pobs,int* pnobs,IssmPDouble x_interp,IssmPDouble y_interp,IssmPDouble radius,int maxdata){/*{{{*/
 
 	/*Output and Intermediaries*/
 	bool         stop;
@@ -320,32 +432,48 @@
 	*pobs=obs;
 	*pnobs=nobs;
 }/*}}}*/
-void Observations::ObservationList(IssmPDouble **px,IssmPDouble **py,IssmPDouble **pobs,int* pnobs){/*{{{*/
+void Observations::ObservationListCovertree(double **px,double **py,double **pobs,int* pnobs,double x_interp,double y_interp,double radius,int maxdata){/*{{{*/
 
-	/*Output and Intermediaries*/
-	int          nobs;
-	IssmPDouble *x            = NULL;
-	IssmPDouble *y            = NULL;
-	IssmPDouble *obs          = NULL;
-	Observation *observation  = NULL;
+	double *x            = NULL;
+	double *y            = NULL;
+	double *obs          = NULL;
+	Observation observation=Observation(x_interp,y_interp,0.);
+	std::vector<Observation> kNN;
 
-	nobs = this->Size();
+	kNN=(this->covertree->kNearestNeighbors(observation, maxdata));
+	//cout << "kNN's size: " << kNN.size() << " (maxdata = " <<maxdata<<")"<<endl;
 
-	if(nobs){
-		x   = xNew<IssmPDouble>(nobs);
-		y   = xNew<IssmPDouble>(nobs);
-		obs = xNew<IssmPDouble>(nobs);
-		for(int i=0;i<this->Size();i++){
-			observation=xDynamicCast<Observation*>(this->GetObjectByOffset(i));
-			observation->WriteXYObs(&x[i],&y[i],&obs[i]);
+	//kNN is sort from closest to farthest neighbor
+	//searches for the first neighbor that is out of radius
+	//deletes and resizes the kNN vector
+	vector<Observation>::iterator it;
+	if(radius>0.){
+		for (it = kNN.begin(); it != kNN.end(); ++it) {
+			//(*it).print();
+			//cout << "\n" << (*it).distance(observation) << endl;
+			if ((*it).distance(observation) > radius) {
+				break;
+			}
 		}
+		kNN.erase(it, kNN.end());
 	}
 
-	/*Assign output pointer*/
+	/*Allocate vectors*/
+	x   = new double[kNN.size()];
+	y   = new double[kNN.size()];
+	obs = new double[kNN.size()];
+
+	/*Loop over all observations and fill in x, y and obs*/
+	int i = 0;
+	for(it = kNN.begin(); it != kNN.end(); ++it) {
+		(*it).WriteXYObs((*it), &x[i], &y[i], &obs[i]);
+		i++;
+	}
+
 	*px=x;
 	*py=y;
 	*pobs=obs;
-	*pnobs=nobs;
+	*pnobs = kNN.size();
 }/*}}}*/
 void Observations::InterpolationIDW(IssmPDouble *pprediction,IssmPDouble x_interp,IssmPDouble y_interp,IssmPDouble radius,int mindata,int maxdata,IssmPDouble power){/*{{{*/
 
@@ -362,9 +490,6 @@
 	_assert_(pprediction);
 	_assert_(power>0);
 
-	/*If radius is not provided or is 0, return all observations*/
-	if(radius==0) radius=this->quadtree->root->length;
-
 	/*Get list of observations for current point*/
 	this->ObservationList(&x,&y,&obs,&n_obs,x_interp,y_interp,radius,maxdata);
 
@@ -409,9 +534,6 @@
 	_assert_(mindata>0 && maxdata>0);
 	_assert_(pprediction && perror);
 
-	/*If radius is not provided or is 0, return all observations*/
-	if(radius==0) radius=this->quadtree->root->length;
-
 	/*Get list of observations for current point*/
 	this->ObservationList(&x,&y,&obs,&n_obs,x_interp,y_interp,radius,maxdata);
 
@@ -429,6 +551,7 @@
 	IssmDouble unbias = variogram->Covariance(0.,0.);
 	/*First: Create semivariogram matrix for observations*/
 	for(i=0;i<n_obs;i++){
+		//printf("%g %g ==> %g\n",x[i],y[i],sqrt(pow(x[i]-x_interp,2)+pow(y[i]-y_interp,2)));
 		for(j=0;j<=i;j++){
 			A[i*(n_obs+1)+j] = variogram->Covariance(x[i]-x[j],y[i]-y[j]);
 			A[j*(n_obs+1)+i] = A[i*(n_obs+1)+j];
@@ -469,7 +592,6 @@
 	xDelete<IssmPDouble>(A);
 	xDelete<IssmPDouble>(B);
 	xDelete<IssmPDouble>(Lambda);
-
 }/*}}}*/
 void Observations::InterpolationNearestNeighbor(IssmPDouble *pprediction,IssmPDouble x_interp,IssmPDouble y_interp,IssmPDouble radius){/*{{{*/
 
@@ -616,47 +738,3 @@
 	xDelete<IssmPDouble>(counter);
 }/*}}}*/
 
-void Observations::ObservationList2(double **px,double **py,double **pobs,int* pnobs,double x_interp,double y_interp,double radius,int maxdata){/*{{{*/
-    
-
-    double *x            = NULL;
-    double *y            = NULL;
-    double *obs          = NULL;
-    Observation observation=Observation(x_interp,y_interp,0.);
-    std::vector<Observation> kNN;
-
-	 kNN=(this->covertree->kNearestNeighbors(observation, maxdata));
-	 //cout << "kNN's size: " << kNN.size() << " (maxdata = " <<maxdata<<")"<<endl;
-	
-	//kNN is sort from closest to farthest neighbor
-	//searches for the first neighbor that is out of radius
-	//deletes and resizes the kNN vector
-	vector<Observation>::iterator it;
-	if(radius>0.){
-		for (it = kNN.begin(); it != kNN.end(); ++it) {
-			//(*it).print();
-			//cout << "\n" << (*it).distance(observation) << endl;
-			if ((*it).distance(observation) > radius) {
-				break;
-			}
-		}
-		kNN.erase(it, kNN.end());
-	}
-    
-	/*Allocate vectors*/
-	x   = new double[kNN.size()];
-	y   = new double[kNN.size()];
-	obs = new double[kNN.size()];
-
-	/*Loop over all observations and fill in x, y and obs*/
-	int i = 0;
-	for(it = kNN.begin(); it != kNN.end(); ++it) {
-		(*it).WriteXYObs((*it), &x[i], &y[i], &obs[i]);
-		i++;
-	}
-    
-    *px=x;
-    *py=y;
-    *pobs=obs;
-	 *pnobs = kNN.size();
-}/*}}}*/

Modified: issm/trunk/src/c/classes/kriging/Observations.h
===================================================================
--- issm/trunk/src/c/classes/kriging/Observations.h	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/classes/kriging/Observations.h	2016-04-13 04:32:01 UTC (rev 20500)
@@ -33,6 +33,8 @@
 
 		/*Methods*/
 		void ClosestObservation(IssmDouble *px,IssmDouble *py,IssmDouble *pobs,IssmDouble x_interp,IssmDouble y_interp,IssmDouble radius);
+		void ClosestObservationQuadtree(IssmDouble *px,IssmDouble *py,IssmDouble *pobs,IssmDouble x_interp,IssmDouble y_interp,IssmDouble radius);
+		void ClosestObservationCovertree(IssmDouble *px,IssmDouble *py,IssmDouble *pobs,IssmDouble x_interp,IssmDouble y_interp,IssmDouble radius);
 		void Distances(IssmPDouble* distances,IssmPDouble *x,IssmPDouble *y,int n,IssmPDouble radius);
 		void InterpolationIDW(IssmDouble *pprediction,IssmDouble x_interp,IssmDouble y_interp,IssmDouble radius,int mindata,int maxdata,IssmDouble power);
 		void InterpolationV4(IssmDouble *pprediction,IssmDouble x_interp,IssmDouble y_interp,IssmDouble radius,int mindata,int maxdata);
@@ -40,7 +42,8 @@
 		void InterpolationNearestNeighbor(IssmDouble *pprediction,IssmDouble x_interp,IssmDouble y_interp,IssmDouble radius);
 		void ObservationList(IssmDouble **px,IssmDouble **py,IssmDouble **pobs,int* pnobs);
 		void ObservationList(IssmDouble **px,IssmDouble **py,IssmDouble **pobs,int* pnobs,IssmDouble x_interp,IssmDouble y_interp,IssmDouble radius,int maxdata);
-		void ObservationList2(IssmDouble **px,IssmDouble **py,IssmDouble **pobs,int* pnobs,IssmDouble x_interp,IssmDouble y_interp,IssmDouble radius,int maxdata);
+		void ObservationListQuadtree(IssmDouble **px,IssmDouble **py,IssmDouble **pobs,int* pnobs,IssmDouble x_interp,IssmDouble y_interp,IssmDouble radius,int maxdata);
+		void ObservationListCovertree(IssmDouble **px,IssmDouble **py,IssmDouble **pobs,int* pnobs,IssmDouble x_interp,IssmDouble y_interp,IssmDouble radius,int maxdata);
 		void QuadtreeColoring(IssmDouble* A,IssmDouble *x,IssmDouble *y,int n);
 		void Variomap(IssmDouble* gamma,IssmDouble *x,int n);
 

Modified: issm/trunk/src/c/classes/kriging/PowerVariogram.h
===================================================================
--- issm/trunk/src/c/classes/kriging/PowerVariogram.h	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/classes/kriging/PowerVariogram.h	2016-04-13 04:32:01 UTC (rev 20500)
@@ -26,7 +26,9 @@
 		int   Id(){_error_("Not implemented yet");}; 
 		int   ObjectEnum(){_error_("Not implemented yet");};
 		Object* copy();
+		void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ _error_("not implemented yet!"); };
 
+
 		/*Variogram functions*/
 		double SemiVariogram(double deltax,double deltay);
 		double Covariance(double deltax,double deltay);

Modified: issm/trunk/src/c/classes/kriging/Quadtree.h
===================================================================
--- issm/trunk/src/c/classes/kriging/Quadtree.h	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/classes/kriging/Quadtree.h	2016-04-13 04:32:01 UTC (rev 20500)
@@ -30,7 +30,9 @@
 				int     Id()        {_error_("not implemented yet"); };
 				int     ObjectEnum(){_error_("not implemented yet"); };
 				Object *copy();
+				void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ _error_("not implemented yet!");};
 
+
 				/*Methods*/
 				int          IsWithinRange(double  x,double y,double range);
 				void         RangeSearch(int *indices,int *pnobs,double x,double y,double range);

Modified: issm/trunk/src/c/classes/kriging/SphericalVariogram.h
===================================================================
--- issm/trunk/src/c/classes/kriging/SphericalVariogram.h	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/classes/kriging/SphericalVariogram.h	2016-04-13 04:32:01 UTC (rev 20500)
@@ -26,7 +26,9 @@
 		int   Id(){_error_("Not implemented yet");}; 
 		int   ObjectEnum(){_error_("Not implemented yet");};
 		Object* copy();
+		void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ _error_("not implemented yet!"); };
 
+
 		/*Variogram functions*/
 		double SemiVariogram(double deltax,double deltay);
 		double Covariance(double deltax,double deltay);

Modified: issm/trunk/src/c/cores/CorePointerFromSolutionEnum.cpp
===================================================================
--- issm/trunk/src/c/cores/CorePointerFromSolutionEnum.cpp	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/cores/CorePointerFromSolutionEnum.cpp	2016-04-13 04:32:01 UTC (rev 20500)
@@ -58,6 +58,9 @@
 		case MasstransportSolutionEnum:
 			solutioncore=&masstransport_core;
 			break;
+		case SealevelriseSolutionEnum:
+			solutioncore=&sealevelrise_core;
+			break;
 		case GiaSolutionEnum:
 			#if _HAVE_GIA_
 			solutioncore=&gia_core;

Modified: issm/trunk/src/c/cores/ProcessArguments.cpp
===================================================================
--- issm/trunk/src/c/cores/ProcessArguments.cpp	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/cores/ProcessArguments.cpp	2016-04-13 04:32:01 UTC (rev 20500)
@@ -7,21 +7,27 @@
 
 #include "../shared/shared.h"
 
-void ProcessArguments(int* solution_type,char** pbinfilename,char** poutbinfilename,char** ptoolkitsfilename,char** plockfilename,char** prootpath, int argc,char **argv){
+void ProcessArguments(int* solution_type,char** pbinfilename,char** poutbinfilename,char** ptoolkitsfilename,char** plockfilename,char** prestartfilename, char** prootpath, int argc,char **argv){
 
 	char *modelname      = NULL;
 	char *binfilename    = NULL;
 	char *outbinfilename = NULL;
 	char *toolkitsfilename  = NULL;
 	char *lockfilename   = NULL;
+	char *restartfilename    = NULL;
 	char *rootpath       = NULL;
-	char *rootpatharg    = NULL;
+	char *rootpatharg    = NULL; 
+	int   my_rank, rank_length;  
 
 	/*Check input arguments*/
 	if(argc<2)_error_("Usage error: no solution requested");
 	if(argc<3)_error_("Usage error: missing execution directory");
 	if(argc<4)_error_("Usage error: missing model name");
 
+	/*Recover myrank: */
+	my_rank=IssmComm::GetRank();
+	rank_length= (my_rank == 0 ? 1 : (int)(log10(static_cast<double>(my_rank))+1)); /*length of string "my_rank" */
+
 	/*Get requested solution*/
 	*solution_type=StringToEnumx(argv[1]);
 
@@ -39,12 +45,14 @@
 		outbinfilename = xNew<char>(strlen(rootpath)+strlen(modelname)+strlen(".outbin")+1); sprintf(outbinfilename,"%s%s%s",rootpath,modelname,".outbin");
 		toolkitsfilename  = xNew<char>(strlen(rootpath)+strlen(modelname)+strlen(".toolkits") +1); sprintf(toolkitsfilename, "%s%s%s",rootpath,modelname,".toolkits");
 		lockfilename   = xNew<char>(strlen(rootpath)+strlen(modelname)+strlen(".lock")  +1); sprintf(lockfilename,  "%s%s%s",rootpath,modelname,".lock");
+		restartfilename   = xNew<char>(strlen(rootpath)+strlen(modelname)+strlen(".rst.")  +rank_length +1); sprintf(restartfilename,  "%s%s%s%i",rootpath,modelname,".rst.",my_rank);
 	}
 	else{
 		binfilename    = xNew<char>(strlen(modelname)+strlen(".bin")   +1); sprintf(binfilename,   "%s%s",modelname,".bin");
 		outbinfilename = xNew<char>(strlen(modelname)+strlen(".outbin")+1); sprintf(outbinfilename,"%s%s",modelname,".outbin");
 		toolkitsfilename  = xNew<char>(strlen(modelname)+strlen(".toolkits") +1); sprintf(toolkitsfilename, "%s%s",modelname,".toolkits");
 		lockfilename   = xNew<char>(strlen(modelname)+strlen(".lock")  +1); sprintf(lockfilename,  "%s%s",modelname,".lock");
+		restartfilename   = xNew<char>(strlen(modelname)+strlen(".rst.")  +rank_length +1); sprintf(restartfilename,  "%s%s%i",modelname,".rst.",my_rank);
 	}
 
 	/*Clean up and assign output pointer*/
@@ -52,6 +60,7 @@
 	*poutbinfilename=outbinfilename;
 	*ptoolkitsfilename=toolkitsfilename;
 	*plockfilename=lockfilename;
+	*prestartfilename=restartfilename;
 	*prootpath=rootpath;
 
 }

Modified: issm/trunk/src/c/cores/ad_core.cpp
===================================================================
--- issm/trunk/src/c/cores/ad_core.cpp	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/cores/ad_core.cpp	2016-04-13 04:32:01 UTC (rev 20500)
@@ -115,9 +115,6 @@
 			/*Branch according to AD driver: */
 			femmodel->parameters->FindParam(&driver,AutodiffDriverEnum);
 
-			/* these are always needed regardless of the interpreter */
-			anEDF_for_solverx_p->dp_x=xNew<double>(anEDF_for_solverx_p->max_n);
-			anEDF_for_solverx_p->dp_y=xNew<double>(anEDF_for_solverx_p->max_m);
 
 			if (strcmp(driver,"fos_forward")==0){ /*{{{*/
 
@@ -142,15 +139,12 @@
 				anEDF_for_solverx_p->fos_forward=EDF_fos_forward_for_solverx;
 #endif
 
-				/*allocate the space for the parameters to invoke the EDF fos_forward:*/
-				anEDF_for_solverx_p->dp_X=xNew<double>(anEDF_for_solverx_p->max_n);
-				anEDF_for_solverx_p->dp_Y=xNew<double>(anEDF_for_solverx_p->max_m);
 
 				/*call driver: */
 				fos_forward(my_rank,num_dependents,num_independents, 0, xp, tangentDir, theOutput, jacTimesTangentDir );
 
 				/*add to results*/
-				femmodel->results->AddObject(new GenericExternalResult<IssmPDouble*>(femmodel->results->Size()+1,AutodiffJacobianEnum,jacTimesTangentDir,num_dependents,1,1,0.0));
+				femmodel->results->AddObject(new GenericExternalResult<IssmPDouble*>(femmodel->results->Size()+1,AutodiffJacobianEnum,jacTimesTangentDir,num_dependents,1,0,0.0));
 
 				/*free resources :*/
 				xDelete(theOutput);
@@ -189,9 +183,6 @@
 #endif
 				// anEDF_for_solverx_p->fov_reverse=EDF_fov_reverse_for_solverx;
 
-				/*allocate the space for the parameters to invoke EDF fov_forward:*/
-				anEDF_for_solverx_p->dpp_X=xNew<double>(anEDF_for_solverx_p->max_n, tangentDirNum);
-				anEDF_for_solverx_p->dpp_Y=xNew<double>(anEDF_for_solverx_p->max_m, tangentDirNum);
 
 				/*seed matrix: */
 				seed=xNewZeroInit<double>(num_independents,tangentDirNum);
@@ -222,7 +213,7 @@
 				xDelete(seed);
 
 				/*add to results: */
-				femmodel->results->AddObject(new GenericExternalResult<IssmPDouble*>(femmodel->results->Size()+1,AutodiffJacobianEnum,*jacTimesSeed,num_dependents*tangentDirNum,1,1,0.0));
+				femmodel->results->AddObject(new GenericExternalResult<IssmPDouble*>(femmodel->results->Size()+1,AutodiffJacobianEnum,*jacTimesSeed,num_dependents*tangentDirNum,1,0,0.0));
 
 				/*Free resources: */
 				xDelete(jacTimesSeed);
@@ -251,15 +242,12 @@
 				anEDF_for_solverx_p->fos_reverse_iArr=fos_reverse_mumpsSolveEDF;
 #endif
 
-				/*allocate the space for the parameters to invoke the EDF fos_reverse :*/
-				anEDF_for_solverx_p->dp_U=xNew<double>(anEDF_for_solverx_p->max_m);
-				anEDF_for_solverx_p->dp_Z=xNew<double>(anEDF_for_solverx_p->max_n);
 
 				/*call driver: */
 				fos_reverse(my_rank,num_dependents,num_independents, aWeightVector, weightVectorTimesJac );
 
 				/*add to results*/
-				femmodel->results->AddObject(new GenericExternalResult<IssmPDouble*>(femmodel->results->Size()+1,AutodiffJacobianEnum,weightVectorTimesJac,num_independents,1,1,0.0));
+				femmodel->results->AddObject(new GenericExternalResult<IssmPDouble*>(femmodel->results->Size()+1,AutodiffJacobianEnum,weightVectorTimesJac,num_independents,1,0,0.0));
 
 				/*free resources :*/
 				xDelete(weightVectorTimesJac);
@@ -295,9 +283,6 @@
 				anEDF_for_solverx_p->fov_reverse=EDF_fov_reverse_for_solverx;
 				#endif
 
-				/*allocate the space for the parameters to invoke the EDF fos_reverse :*/
-				anEDF_for_solverx_p->dpp_U=xNew<double>(weightNum,anEDF_for_solverx_p->max_m);
-				anEDF_for_solverx_p->dpp_Z=xNew<double>(weightNum,anEDF_for_solverx_p->max_n);
 
 				/*seed matrix: */
 				weights=xNewZeroInit<double>(weightNum,num_dependents);
@@ -321,7 +306,7 @@
 				fov_reverse(my_rank,num_dependents,num_independents, weightNum, weights, weightsTimesJac );
 
 				/*add to results: */
-				femmodel->results->AddObject(new GenericExternalResult<IssmPDouble*>(femmodel->results->Size()+1,AutodiffJacobianEnum,*weightsTimesJac,weightNum*num_independents,1,1,0.0));
+				femmodel->results->AddObject(new GenericExternalResult<IssmPDouble*>(femmodel->results->Size()+1,AutodiffJacobianEnum,*weightsTimesJac,weightNum*num_independents,1,0,0.0));
 
 				/*Free resources: */
 				xDelete(weights);
@@ -330,17 +315,6 @@
 			} /*}}}*/
 			else _error_("driver: " << driver << " not yet supported!");
 
-			/* delete the allocated space for the parameters:*/
-			xDelete(anEDF_for_solverx_p->dp_x);
-			xDelete(anEDF_for_solverx_p->dp_X);
-			xDelete(anEDF_for_solverx_p->dpp_X);
-			xDelete(anEDF_for_solverx_p->dp_y);
-			xDelete(anEDF_for_solverx_p->dp_Y);
-			xDelete(anEDF_for_solverx_p->dpp_Y);
-			xDelete(anEDF_for_solverx_p->dp_U);
-			xDelete(anEDF_for_solverx_p->dpp_U);
-			xDelete(anEDF_for_solverx_p->dp_Z);
-			xDelete(anEDF_for_solverx_p->dpp_Z);
 
 			if(VerboseAutodiff())_printf0_("   end AD core\n");
 

Modified: issm/trunk/src/c/cores/control_core.cpp
===================================================================
--- issm/trunk/src/c/cores/control_core.cpp	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/cores/control_core.cpp	2016-04-13 04:32:01 UTC (rev 20500)
@@ -99,10 +99,10 @@
 		#ifdef _HAVE_ADOLC_
 		IssmPDouble* J_passive=xNew<IssmPDouble>(nsteps);
 		for(int i=0;i<nsteps;i++) J_passive[i]=reCast<IssmPDouble>(J[i]);
-		femmodel->results->AddObject(new GenericExternalResult<IssmPDouble*>(femmodel->results->Size()+1,JEnum,J_passive,nsteps,1,1,0));
+		femmodel->results->AddObject(new GenericExternalResult<IssmPDouble*>(femmodel->results->Size()+1,JEnum,J_passive,nsteps,1,0,0));
 		xDelete<IssmPDouble>(J_passive);
 		#else
-		femmodel->results->AddObject(new GenericExternalResult<IssmPDouble*>(femmodel->results->Size()+1,JEnum,J,nsteps,1,1,0));
+		femmodel->results->AddObject(new GenericExternalResult<IssmPDouble*>(femmodel->results->Size()+1,JEnum,J,nsteps,1,0,0));
 		#endif
 	}
 

Modified: issm/trunk/src/c/cores/controlad_core.cpp
===================================================================
--- issm/trunk/src/c/cores/controlad_core.cpp	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/cores/controlad_core.cpp	2016-04-13 04:32:01 UTC (rev 20500)
@@ -106,8 +106,8 @@
 	}
 	
 	/*Save results:*/
-	femmodel->results->AddObject(new GenericExternalResult<IssmPDouble*>(femmodel->results->Size()+1,AutodiffJacobianEnum,G,n,1,1,0.0));
-	femmodel->results->AddObject(new GenericExternalResult<IssmPDouble*>(femmodel->results->Size()+1,AutodiffXpEnum,X,intn,1,1,0.0));
+	femmodel->results->AddObject(new GenericExternalResult<IssmPDouble*>(femmodel->results->Size()+1,AutodiffJacobianEnum,G,n,1,0,0.0));
+	femmodel->results->AddObject(new GenericExternalResult<IssmPDouble*>(femmodel->results->Size()+1,AutodiffXpEnum,X,intn,1,0,0.0));
 
 	/*Clean-up and return*/
 	xDelete<double>(G);
@@ -122,6 +122,7 @@
 	char* outputfilename=NULL;
 	char* toolkitsfilename=NULL;
 	char* lockfilename=NULL;
+	char* restartfilename=NULL;
 	int         solution_type;
 	IssmDouble    pfd;
 	IssmDouble*   Xd=NULL;
@@ -137,8 +138,9 @@
 	femmodel->parameters->FindParam(&outputfilename,OutputFileNameEnum);
 	femmodel->parameters->FindParam(&toolkitsfilename,ToolkitsFileNameEnum);
 	femmodel->parameters->FindParam(&lockfilename,LockFileNameEnum);
+	femmodel->parameters->FindParam(&restartfilename,RestartFileNameEnum);
 
-	femmodel=new FemModel(rootpath, inputfilename, outputfilename, toolkitsfilename, lockfilename, femmodel->comm, femmodel->solution_type,NULL);
+	femmodel=new FemModel(rootpath, inputfilename, outputfilename, toolkitsfilename, lockfilename, restartfilename, femmodel->comm, femmodel->solution_type,NULL);
 
 	
 	/*Get initial guess:*/
@@ -150,6 +152,7 @@
 	xDelete<char>(outputfilename);
 	xDelete<char>(toolkitsfilename);
 	xDelete<char>(lockfilename);
+	xDelete<char>(restartfilename);
 	xDelete<IssmDouble>(Xd);
 
 	*pintn=intn;
@@ -240,6 +243,7 @@
 	char* outputfilename=NULL;
 	char* toolkitsfilename=NULL;
 	char* lockfilename=NULL;
+	char* restartfilename=NULL;
 	IssmPDouble* G2=NULL;
 	int         solution_type;
 	FemModel   *femmodel  =  NULL;
@@ -262,8 +266,9 @@
 	femmodel->parameters->FindParam(&outputfilename,OutputFileNameEnum);
 	femmodel->parameters->FindParam(&toolkitsfilename,ToolkitsFileNameEnum);
 	femmodel->parameters->FindParam(&lockfilename,LockFileNameEnum);
+	femmodel->parameters->FindParam(&restartfilename,RestartFileNameEnum);
 
-	femmodelad=new FemModel(rootpath, inputfilename, outputfilename, toolkitsfilename, lockfilename, femmodel->comm, femmodel->solution_type,X);
+	femmodelad=new FemModel(rootpath, inputfilename, outputfilename, toolkitsfilename, lockfilename, restartfilename,femmodel->comm, femmodel->solution_type,X);
 	femmodel=femmodelad; //We can do this, because femmodel is being called from outside, not by reference, so we won't erase it
 	
 	/*Recover some parameters*/
@@ -317,6 +322,7 @@
 	xDelete<char>(outputfilename);
 	xDelete<char>(toolkitsfilename);
 	xDelete<char>(lockfilename);
+	xDelete<char>(restartfilename);
 	if(femmodelad)delete femmodelad;
 
 } /*}}}*/

Modified: issm/trunk/src/c/cores/controlm1qn3_core.cpp
===================================================================
--- issm/trunk/src/c/cores/controlm1qn3_core.cpp	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/cores/controlm1qn3_core.cpp	2016-04-13 04:32:01 UTC (rev 20500)
@@ -136,7 +136,7 @@
 	SetControlInputsFromVectorx(femmodel,X);
 	ControlInputSetGradientx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,G);
 	femmodel->OutputControlsx(&femmodel->results);
-	femmodel->results->AddObject(new GenericExternalResult<double>(JEnum,f,1,0));
+	femmodel->results->AddObject(new GenericExternalResult<double>(femmodel->results->Size()+1,JEnum,f));
 
 	/*Finalize*/
 	if(VerboseControl()) _printf0_("   preparing final solution\n");

Modified: issm/trunk/src/c/cores/controltao_core.cpp
===================================================================
--- issm/trunk/src/c/cores/controltao_core.cpp	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/cores/controltao_core.cpp	2016-04-13 04:32:01 UTC (rev 20500)
@@ -110,7 +110,7 @@
 	SetControlInputsFromVectorx(femmodel,X);
 	ControlInputSetGradientx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,G);
 	femmodel->OutputControlsx(&femmodel->results);
-	femmodel->results->AddObject(new GenericExternalResult<double*>(femmodel->results->Size()+1,JEnum,user.J,maxiter+3,1,1,0));
+	femmodel->results->AddObject(new GenericExternalResult<double*>(femmodel->results->Size()+1,JEnum,user.J,maxiter+3,1,0,0));
 
 	/*Finalize*/
 	if(VerboseControl()) _printf0_("   preparing final solution\n");

Modified: issm/trunk/src/c/cores/controlvalidation_core.cpp
===================================================================
--- issm/trunk/src/c/cores/controlvalidation_core.cpp	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/cores/controlvalidation_core.cpp	2016-04-13 04:32:01 UTC (rev 20500)
@@ -90,10 +90,10 @@
 	#ifdef _HAVE_ADOLC_
 	IssmPDouble* J_passive=xNew<IssmPDouble>(2*num);
 	for(int i=0;i<2*num;i++) J_passive[i]=reCast<IssmPDouble>(output[i]);
-	femmodel->results->AddObject(new GenericExternalResult<IssmPDouble*>(femmodel->results->Size()+1,JEnum,J_passive,num,2,1,0));
+	femmodel->results->AddObject(new GenericExternalResult<IssmPDouble*>(femmodel->results->Size()+1,JEnum,J_passive,num,2,0,0));
 	xDelete<IssmPDouble>(J_passive);
 	#else
-	femmodel->results->AddObject(new GenericExternalResult<IssmPDouble*>(femmodel->results->Size()+1,JEnum,output,num,2,1,0));
+	femmodel->results->AddObject(new GenericExternalResult<IssmPDouble*>(femmodel->results->Size()+1,JEnum,output,num,2,0,0));
 	#endif
 	ControlInputSetGradientx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,G);
 	femmodel->OutputControlsx(&femmodel->results);

Modified: issm/trunk/src/c/cores/cores.h
===================================================================
--- issm/trunk/src/c/cores/cores.h	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/cores/cores.h	2016-04-13 04:32:01 UTC (rev 20500)
@@ -23,6 +23,7 @@
 void thermal_core(FemModel* femmodel);
 void surfaceslope_core(FemModel* femmodel);
 void levelsetfunctionslope_core(FemModel* femmodel);
+void movingfront_core(FemModel* femmodel);
 void bedslope_core(FemModel* femmodel);
 void meshdeformation_core(FemModel* femmodel);
 void control_core(FemModel* femmodel);
@@ -45,17 +46,23 @@
 void adgradient_core(FemModel* femmodel);
 void dummy_core(FemModel* femmodel);
 void gia_core(FemModel* femmodel);
+void smb_core(FemModel* femmodel);
 void damage_core(FemModel* femmodel);
+void sealevelrise_core(FemModel* femmodel);
+Vector<IssmDouble>* sealevelrise_core_eustatic(FemModel* femmodel);
+Vector<IssmDouble>* sealevelrise_core_noneustatic(FemModel* femmodel,Vector<IssmDouble>* Sg_eustatic);
 IssmDouble objectivefunction(IssmDouble search_scalar,FemModel* femmodel);
 
 //optimization
 int GradJSearch(IssmDouble* search_vector,FemModel* femmodel,int step);
 
 //diverse
-void ProcessArguments(int* solution,char** pbinname,char** poutbinname,char** ptoolkitsname,char** plockname,char** prootpath,int argc,char **argv);
+void ProcessArguments(int* solution,char** pbinname,char** poutbinname,char** ptoolkitsname,char** plockname,char** prestartname, char** prootpath,int argc,char **argv);
 void WriteLockFile(char* filename);
 void ResetBoundaryConditions(FemModel* femmodel, int analysis_type);
 void PrintBanner(void);
+void TransferForcing(FemModel* femmodel,int forcingenum);
+void TransferSealevel(FemModel* femmodel,int forcingenum);
 
 //solution configuration
 void CorePointerFromSolutionEnum(void (**psolutioncore)(FemModel*),Parameters* parameters,int solutiontype);

Modified: issm/trunk/src/c/cores/dakota_core.cpp
===================================================================
--- issm/trunk/src/c/cores/dakota_core.cpp	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/cores/dakota_core.cpp	2016-04-13 04:32:01 UTC (rev 20500)
@@ -26,20 +26,43 @@
  *
  */ 
 
-/*include files: {{{*/
+ /* \brief: run core ISSM solution using Dakota inputs coming from CPU 0.
+ * \sa qmu.cpp DakotaPlugin.cpp
+ *
+ * This routine needs to be understood simultaneously with qmu.cpp and DakotaPlugin. 
+ * DakotaSpawnCoreParallel is called by all CPUS, with CPU 0 holding Dakota variable values, along 
+ * with variable descriptors. 
+ *
+ * DakotaSpawnCoreParallel takes care of broadcasting the variables and their descriptors across the MPI 
+ * ring. Once this is done, we use the variables to modify the inputs for the solution core. 
+ * For ex, if "rho_ice" is provided, for ex 920, we include "rho_ice" in the inputs, then 
+ * call the core with the modified inputs. This is the way we get Dakota to explore the parameter 
+ * spce of the core. 
+ *
+ * Once the core is called, we process the results of the core, and using the processed results, 
+ * we compute response functions. The responses are computed on all CPUS, but they are targeted 
+ * for CPU 0, which will get these values back to the Dakota engine. 
+ *
+ */ 
+
+/*include config: {{{*/
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #else
 #error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
 #endif
+/*}}}*/
 
+/*include ISSM files: */
 #include "./cores.h"
 #include "../toolkits/toolkits.h"
 #include "../shared/shared.h"
 #include "../classes/classes.h"
+#include "../modules/modules.h"
 
-#ifdef _HAVE_DAKOTA_ //only works if dakota library has been compiled in.
-#if _DAKOTA_MAJOR_ < 5 || (_DAKOTA_MAJOR_ == 5 && _DAKOTA_MINOR_ < 3)
+#if defined(_HAVE_DAKOTA_) && (_DAKOTA_MAJOR_ <= 5) //this only works for Dakota <=5, which had no effective parallel capabilities yet.
+/*Dakota include files:{{{*/
+#if (_DAKOTA_MAJOR_ < 5 || (_DAKOTA_MAJOR_ == 5 && _DAKOTA_MINOR_ < 3))
 #include <ParallelLibrary.H>
 #include <ProblemDescDB.H>
 #include <DakotaStrategy.H>
@@ -52,110 +75,166 @@
 #include <DakotaModel.hpp>
 #include <DakotaInterface.hpp>
 #endif
-#include "./DakotaSpawnCore.h"
-#endif
 /*}}}*/
-/*DakotaPlugin class {{{*/
-#ifdef _HAVE_DAKOTA_ //only works if dakota library has been compiled in.
-#if _DAKOTA_MAJOR_ < 5 || (_DAKOTA_MAJOR_ == 5 && _DAKOTA_MINOR_ < 3)
-#include <DirectApplicInterface.H>
-#include <DakotaResponse.H>
-#include <ParamResponsePair.H>
-#include <system_defs.h>
-#include <ProblemDescDB.H>
-#include <ParallelLibrary.H>
-#else
-#include <DirectApplicInterface.hpp>
-#include <DakotaResponse.hpp>
-#include <ParamResponsePair.hpp>
-#include <ProblemDescDB.hpp>
-#include <ParallelLibrary.hpp>
-#endif
-namespace SIM {
-	class DakotaPlugin: public Dakota::DirectApplicInterface{
-		public:
-			/*these fields are used by core solutions: */
-			void *femmodel;
-			int   counter;
-			/*Constructors/Destructors*/
-			DakotaPlugin(const Dakota::ProblemDescDB& problem_db,void* in_femmodel):Dakota::DirectApplicInterface(problem_db){/*{{{*/
-				femmodel = in_femmodel;
-				counter  = 0;
-			}/*}}}*/
-			~DakotaPlugin(){/*{{{*/
-				/* Virtual destructor handles referenceCount at Interface level. */ 
-			}/*}}}*/
-		protected:
-			/*execute the input filter portion of a direct evaluation invocation*/
-			//int derived_map_if(const Dakota::String& if_name);
-			/*execute an analysis code portion of a direct evaluation invocation*/
-			int derived_map_ac(const Dakota::String& driver){/*{{{*/
 
-				int i;
-				IssmDouble* variables=NULL;
-				char** variable_descriptors=NULL;
-				char*  variable_descriptor=NULL;
-				IssmDouble* responses=NULL;
+void DakotaFree(double** pvariables,char*** pvariables_descriptors,char*** presponses_descriptors,int numvariables,int numresponses){ /*{{{*/
 
-				/*increae counter: */
-				counter++;
+	/*\brief DakotaFree: free allocations on other cpus, not done by Dakota.*/
 
-				/*Before launching analysis, we need to transfer the dakota inputs into Issm 
-				 *readable variables: */
+	int i;
+	int my_rank;
 
-				/*First, the variables: */
-				variables=xNew<IssmDouble>(numACV);
-				for(i=0;i<numACV;i++){
-					variables[i]=xC[i];
-				}
-				/*The descriptors: */
-				variable_descriptors=xNew<char*>(numACV);
-				for(i=0;i<numACV;i++){
-					std::string label=xCLabels[i];
-					variable_descriptor=xNew<char>(strlen(label.c_str())+1);
-					memcpy(variable_descriptor,label.c_str(),(strlen(label.c_str())+1)*sizeof(char));
+	double  *variables             = NULL;
+	char   **variables_descriptors = NULL;
+	char   **responses_descriptors = NULL;
+	char    *string                = NULL;
 
-					variable_descriptors[i]=variable_descriptor;
-				}
+	/*recover pointers: */
+	variables=*pvariables;
+	variables_descriptors=*pvariables_descriptors;
+	responses_descriptors=*presponses_descriptors;
 
-				/*Initialize responses: */
-				responses=xNewZeroInit<IssmDouble>(numFns);
+	/*recover my_rank:*/
+	my_rank=IssmComm::GetRank();
 
-				/*run core solution: */
-				DakotaSpawnCore(responses,numFns, variables,variable_descriptors,numACV,femmodel,counter);
+	/*Free variables and variables_descriptors only on cpu !=0*/
+	if(my_rank!=0){
+		xDelete<double>(variables);
+		for(i=0;i<numvariables;i++){
+			string=variables_descriptors[i];
+			xDelete<char>(string);
+		}
+		xDelete<char*>(variables_descriptors);
+	}
 
-				/*populate responses: */
-				for(i=0;i<numFns;i++){
-					fnVals[i]=responses[i];
-				}
+	//responses descriptors on every cpu
+	for(i=0;i<numresponses;i++){
+		string=responses_descriptors[i];
+		xDelete<char>(string);
+	}
+	//rest of dynamic allocations.
+	xDelete<char*>(responses_descriptors);
 
-				/*Free ressources:*/
-				xDelete<IssmDouble>(variables);
-				for(i=0;i<numACV;i++){
-					variable_descriptor=variable_descriptors[i];
-					xDelete<char>(variable_descriptor);
-				}
-				xDelete<char*>(variable_descriptors);
-				xDelete<IssmDouble>(responses);
+	/*Assign output pointers:*/
+	*pvariables=variables;
+	*pvariables_descriptors=variables_descriptors;
+	*presponses_descriptors=responses_descriptors;
+} /*}}}*/
+void DakotaMPI_Bcast(double** pvariables, char*** pvariables_descriptors,int* pnumvariables, int* pnumresponses){ /*{{{*/
 
-				return 0;
-			}/*}}}*/
-			/*execute the output filter portion of a direct evaluation invocation*/
-			//int derived_map_of(const Dakota::String& of_name);
-			/*add for issm: */
-			int GetCounter(){/*{{{*/
-				return counter;
-			}/*}}}*/
-		private:
-	};
+	/* * \brief: broadcast variables_descriptors, variables, numvariables and numresponses
+	 * from cpu 0 to all other cpus.
+	 */ 
+
+	int i;
+	int my_rank;
+
+	/*inputs and outputs: */
+	double* variables=NULL;
+	char**  variables_descriptors=NULL;
+	int     numvariables;
+	int     numresponses;
+
+	/*intermediary: */
+	char* string=NULL;
+	int   string_length;
+
+	/*recover my_rank:*/
+	my_rank=IssmComm::GetRank();
+
+	/*recover inputs from pointers: */
+	variables=*pvariables;
+	variables_descriptors=*pvariables_descriptors;
+	numvariables=*pnumvariables;
+	numresponses=*pnumresponses;
+
+	/*numvariables: */
+	ISSM_MPI_Bcast(&numvariables,1,ISSM_MPI_INT,0,IssmComm::GetComm()); 
+
+	/*variables:*/
+	if(my_rank!=0)variables=xNew<double>(numvariables);
+	ISSM_MPI_Bcast(variables,numvariables,MPI_DOUBLE,0,IssmComm::GetComm()); 
+
+	/*variables_descriptors: */
+	if(my_rank!=0){
+		variables_descriptors=xNew<char*>(numvariables);
+	}
+	for(i=0;i<numvariables;i++){
+		if(my_rank==0){
+			string=variables_descriptors[i];
+			string_length=(strlen(string)+1)*sizeof(char);
+		}
+		ISSM_MPI_Bcast(&string_length,1,ISSM_MPI_INT,0,IssmComm::GetComm()); 
+		if(my_rank!=0)string=xNew<char>(string_length);
+		ISSM_MPI_Bcast(string,string_length,ISSM_MPI_CHAR,0,IssmComm::GetComm()); 
+		if(my_rank!=0)variables_descriptors[i]=string;
+	}
+
+	/*numresponses: */
+	ISSM_MPI_Bcast(&numresponses,1,ISSM_MPI_INT,0,IssmComm::GetComm()); 
+
+	/*Assign output pointers:*/
+	*pnumvariables=numvariables;
+	*pvariables=variables;
+	*pvariables_descriptors=variables_descriptors;
+	*pnumresponses=numresponses;
+} /*}}}*/
+int  DakotaSpawnCore(double* d_responses, int d_numresponses, double* d_variables, char** d_variables_descriptors,int d_numvariables, void* void_femmodel,int counter){ /*{{{*/
+
+	/*Notice the d_, which prefixes anything that is being provided to us by the Dakota pluggin. Careful. some things are ours, some are dakotas!: */
+
+	char     **responses_descriptors    = NULL;      //these are our! there are only numresponsedescriptors of them, not d_numresponses!!!
+	int        numresponsedescriptors;
+	int        solution_type;
+	bool       control_analysis         = false;
+	void     (*solutioncore)(FemModel*) = NULL;
+	FemModel  *femmodel                 = NULL;
+	bool       nodakotacore             = true;
+
+	/*If counter==-1 on cpu0, it means that the dakota runs are done. In which case, bail out and return 0: */
+	ISSM_MPI_Bcast(&counter,1,ISSM_MPI_INT,0,IssmComm::GetComm()); 
+	if(counter==-1)return 0;
+
+	/*cast void_femmodel to FemModel, and at the same time, make a copy, so we start this new core run for this specific sample 
+	 *with a brand new copy of the model, which has not been tempered with by previous dakota runs: */
+	femmodel=(reinterpret_cast<FemModel*>(void_femmodel))->copy();
+
+	/*retrieve parameters: */
+	femmodel->parameters->FindParam(&responses_descriptors,&numresponsedescriptors,QmuResponsedescriptorsEnum);
+	femmodel->parameters->FindParam(&solution_type,SolutionTypeEnum);
+	femmodel->parameters->FindParam(&control_analysis,InversionIscontrolEnum);
+
+	if(VerboseQmu()) _printf0_("qmu iteration: " << counter << "\n");
+
+	/* only cpu 0, running dakota is providing us with variables and variables_descriptors and numresponses: broadcast onto other cpus: */
+	DakotaMPI_Bcast(&d_variables,&d_variables_descriptors,&d_numvariables,&d_numresponses);
+
+	/*Modify core inputs in objects contained in femmodel, to reflect the dakota variables inputs: */
+	InputUpdateFromDakotax(femmodel,d_variables,d_variables_descriptors,d_numvariables);
+
+	/*Determine solution sequence: */
+	if(VerboseQmu()) _printf0_("Starting " << EnumToStringx(solution_type) << " core:\n");
+	WrapperCorePointerFromSolutionEnum(&solutioncore,femmodel->parameters,solution_type,nodakotacore);
+
+	/*Run the core solution sequence: */
+	solutioncore(femmodel);
+
+	/*compute responses: */
+	if(VerboseQmu()) _printf0_("compute dakota responses:\n");
+	femmodel->DakotaResponsesx(d_responses,responses_descriptors,numresponsedescriptors,d_numresponses);
+
+	/*Free ressources:*/
+	DakotaFree(&d_variables,&d_variables_descriptors,&responses_descriptors, d_numvariables, numresponsedescriptors);
+
+	/*Avoid leaks here: */
+	delete femmodel;
+
+	return 1; //this is critical! do not return 0, otherwise, dakota_core will stop running!
 } 
-#endif
 /*}}}*/
+void dakota_core(FemModel* femmodel){  /*{{{*/
 
-void dakota_core(FemModel* femmodel){ 
 
-	#ifdef _HAVE_DAKOTA_ //only works if dakota library has been compiled in.
-
 	int                my_rank;
 	char              *dakota_input_file  = NULL;
 	char              *dakota_output_file = NULL;
@@ -203,7 +282,7 @@
 			problem_db.set_db_model_nodes(ml_iter->model_id());
 
 			// Serial case: plug in derived Interface object without an analysisComm
-			interface.assign_rep(new SIM::DakotaPlugin(problem_db,(void*)femmodel), false);
+			interface.assign_rep(new SIM::IssmDirectApplicInterface(problem_db,(void*)femmodel), false);
 		}
 
 		// Execute the strategy
@@ -226,5 +305,9 @@
 	xDelete<char>(dakota_error_file);
 	xDelete<char>(dakota_output_file);
 
-	#endif //#ifdef _HAVE_DAKOTA_
+} /*}}}*/
+#else
+void dakota_core(FemModel* femmodel){ 
+	_error_("dakota_core for versions of Dakota >=6 should not be used anymore! Use instead the issm_dakota  executable!");
 }
+#endif

Modified: issm/trunk/src/c/cores/damage_core.cpp
===================================================================
--- issm/trunk/src/c/cores/damage_core.cpp	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/cores/damage_core.cpp	2016-04-13 04:32:01 UTC (rev 20500)
@@ -1,5 +1,5 @@
 /* 
- * \brief: damgage_core.cpp: core for the damage solution
+ * \brief: damage_core.cpp: core for the damage solution
  */ 
 
 #include "./cores.h"
@@ -14,20 +14,27 @@
 	/*intermediary*/
 	bool   save_results;
 	bool   dakota_analysis     = false;
-	int    solution_type;
+	int    solution_type,stabilization;
 	int    numoutputs          = 0; 
 	char   **requested_outputs = NULL;
 
-	
+			
 	//first recover parameters common to all solutions
 	femmodel->parameters->FindParam(&save_results,SaveResultsEnum);
 	femmodel->parameters->FindParam(&solution_type,SolutionTypeEnum);
 	femmodel->parameters->FindParam(&numoutputs,DamageEvolutionNumRequestedOutputsEnum);
 	if(numoutputs) femmodel->parameters->FindParam(&requested_outputs,&numoutputs,DamageEvolutionRequestedOutputsEnum);
+	femmodel->parameters->FindParam(&stabilization,DamageStabilizationEnum);
 
 	if(VerboseSolution()) _printf0_("   computing damage\n");
+	Damagex(femmodel); /* optionally calculate damage analytically first */
 	femmodel->SetCurrentConfiguration(DamageEvolutionAnalysisEnum);
-	solutionsequence_linear(femmodel);
+	if(stabilization==4){
+		solutionsequence_fct(femmodel);
+	}
+	else{
+		solutionsequence_linear(femmodel);
+	}
 
 	if(save_results){
 		if(VerboseSolution()) _printf0_("   saving results\n");

Modified: issm/trunk/src/c/cores/gia_core.cpp
===================================================================
--- issm/trunk/src/c/cores/gia_core.cpp	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/cores/gia_core.cpp	2016-04-13 04:32:01 UTC (rev 20500)
@@ -52,5 +52,9 @@
 		int outputs[2] = {GiaWEnum,GiadWdtEnum};
 		femmodel->RequestedOutputsx(&femmodel->results,&outputs[0],2);
 	}
+	
+	xDelete<IssmDouble>(x);
+	xDelete<IssmDouble>(y);
 
+
 }

Modified: issm/trunk/src/c/cores/hydrology_core.cpp
===================================================================
--- issm/trunk/src/c/cores/hydrology_core.cpp	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/cores/hydrology_core.cpp	2016-04-13 04:32:01 UTC (rev 20500)
@@ -12,15 +12,17 @@
 void hydrology_core(FemModel* femmodel){
 
 	/*intermediary*/
-	int        hydrology_model;
-	bool       save_results;
-	bool       modify_loads=true;
-	bool       isefficientlayer;
+	int  hydrology_model;
+	bool save_results;
+	bool modify_loads=true;
+	bool isefficientlayer;
 
 	/*first recover parameters common to all solutions*/
 	femmodel->parameters->FindParam(&save_results,SaveResultsEnum);
 	femmodel->parameters->FindParam(&hydrology_model,HydrologyModelEnum);
-
+	
+	if(VerboseSolution()) _printf0_("   computing water heads\n");
+			
 	/*first compute slopes: */
 	if (hydrology_model==HydrologyshreveEnum){
 		surfaceslope_core(femmodel);
@@ -57,7 +59,6 @@
 		}
 		
 		/*Proceed now to heads computations*/
-		if(VerboseSolution()) _printf0_("   computing water head\n");
 		solutionsequence_hydro_nonlinear(femmodel);
 
 		if(save_results){
@@ -75,5 +76,28 @@
 			OutputResultsx(femmodel);
 		}
 	}
+
+	else if (hydrology_model==HydrologysommersEnum){
+		femmodel->SetCurrentConfiguration(HydrologySommersAnalysisEnum);
+		solutionsequence_nonlinear(femmodel,modify_loads);
+		if(VerboseSolution()) _printf0_("   updating gap height\n");
+		HydrologySommersAnalysis* analysis = new HydrologySommersAnalysis();
+		analysis->UpdateGapHeight(femmodel);
+		delete analysis;	
+		
+		if(save_results){
+			if(VerboseSolution()) _printf0_("   saving results \n");
+			int outputs[2] = {HydrologyHeadEnum,HydrologyGapHeightEnum};
+			femmodel->RequestedOutputsx(&femmodel->results,&outputs[0],2);
+			
+			/*unload results*/
+			if(VerboseSolution()) _printf0_("   saving temporary results\n");
+			OutputResultsx(femmodel);
+		}
+	}
+
+	else{
+		_error_("Hydrology model "<< EnumToStringx(hydrology_model) <<" not supported yet");
+	}
 }
 

Modified: issm/trunk/src/c/cores/masstransport_core.cpp
===================================================================
--- issm/trunk/src/c/cores/masstransport_core.cpp	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/cores/masstransport_core.cpp	2016-04-13 04:32:01 UTC (rev 20500)
@@ -30,10 +30,9 @@
 	femmodel->parameters->FindParam(&numoutputs,MasstransportNumRequestedOutputsEnum);
 	femmodel->parameters->FindParam(&stabilization,MasstransportStabilizationEnum);
 	if(numoutputs) femmodel->parameters->FindParam(&requested_outputs,&numoutputs,MasstransportRequestedOutputsEnum);
+			
+	if(VerboseSolution()) _printf0_("   computing mass transport\n");
 
-	/*Calculate new Surface Mass Balance (SMB)*/
-	SurfaceMassBalancex(femmodel);
-
 	/*Transport mass or free surface*/
 	if(isFS && isfreesurface){
 		if(VerboseSolution()) _printf0_("   call free surface computational core\n");

Modified: issm/trunk/src/c/cores/steadystate_core.cpp
===================================================================
--- issm/trunk/src/c/cores/steadystate_core.cpp	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/cores/steadystate_core.cpp	2016-04-13 04:32:01 UTC (rev 20500)
@@ -47,15 +47,20 @@
 
 	for(;;){
 
-		if(VerboseSolution()) _printf0_("   computing temperature and velocity for step: " << step << "\n");
+		/* Compute first velocity, then temperature due to high sensitivity of temperature to velocity. */
+		if(VerboseSolution()) _printf0_("\n======================================================\n");
+		if(VerboseSolution()) _printf0_("   computing velocity and temperature for step: " << step << "\n");
+		if(VerboseSolution()) _printf0_("====================================================\n");
+
+		if(VerboseSolution()) _printf0_("\n   -- computing new velocity -- \n\n");
+		stressbalance_core(femmodel);
+		GetSolutionFromInputsx(&ug,femmodel);
+
+		if(VerboseSolution()) _printf0_("\n   -- computing new temperature --\n\n");
 		thermal_core(femmodel);
 		if(!isenthalpy)femmodel->SetCurrentConfiguration(ThermalAnalysisEnum);/*Could be MeltingAnalysis...*/
 		GetSolutionFromInputsx(&tg,femmodel);
 
-		if(VerboseSolution()) _printf0_("   computing new velocity\n");
-		stressbalance_core(femmodel);
-		GetSolutionFromInputsx(&ug,femmodel);
-
 		if(step>1){
 			if(VerboseSolution()) _printf0_("   checking steadystate convergence\n");
 			if(steadystateconvergence(tg,tg_old,ug,ug_old,reltol)) break;

Modified: issm/trunk/src/c/cores/stressbalance_core.cpp
===================================================================
--- issm/trunk/src/c/cores/stressbalance_core.cpp	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/cores/stressbalance_core.cpp	2016-04-13 04:32:01 UTC (rev 20500)
@@ -21,6 +21,7 @@
 	int        numoutputs        = 0;
 	char     **requested_outputs = NULL;
 	Analysis  *analysis          = NULL;
+			
 
 	/* recover parameters:*/
 	femmodel->parameters->FindParam(&domaintype,DomainTypeEnum);
@@ -33,6 +34,8 @@
 	femmodel->parameters->FindParam(&solution_type,SolutionTypeEnum);
 	femmodel->parameters->FindParam(&numoutputs,StressbalanceNumRequestedOutputsEnum);
 	if(numoutputs) femmodel->parameters->FindParam(&requested_outputs,&numoutputs,StressbalanceRequestedOutputsEnum);
+	
+	if(VerboseSolution()) _printf0_("   computing new velocity\n");
 
 	/*Compute slopes if necessary */
 	if(isSIA || (isFS && domaintype==Domain2DverticalEnum)) surfaceslope_core(femmodel);

Modified: issm/trunk/src/c/cores/thermal_core.cpp
===================================================================
--- issm/trunk/src/c/cores/thermal_core.cpp	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/cores/thermal_core.cpp	2016-04-13 04:32:01 UTC (rev 20500)
@@ -26,6 +26,9 @@
 	femmodel->parameters->FindParam(&numoutputs,ThermalNumRequestedOutputsEnum);
 	if(numoutputs) femmodel->parameters->FindParam(&requested_outputs,&numoutputs,ThermalRequestedOutputsEnum);
 
+	/*Calculate geothermalflux*/
+	GeothermalFluxx(femmodel);
+
 	if(isenthalpy){
 		enthalpy_analysis = new EnthalpyAnalysis();
 		enthalpy_analysis->Core(femmodel);

Modified: issm/trunk/src/c/cores/transient_core.cpp
===================================================================
--- issm/trunk/src/c/cores/transient_core.cpp	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/cores/transient_core.cpp	2016-04-13 04:32:01 UTC (rev 20500)
@@ -20,45 +20,51 @@
 
 	/*parameters: */
 	IssmDouble starttime,finaltime,dt,yts;
-	bool       isstressbalance,ismasstransport,isFS,isthermal,isgroundingline,isgia,islevelset,isdamageevolution,ishydrology,iscalving;
+	bool       isstressbalance,ismasstransport,issmb,isFS,isthermal,isgroundingline,isgia,isslr,iscoupler,ismovingfront,isdamageevolution,ishydrology;
 	bool       save_results,dakota_analysis;
-	bool       time_adapt=false;
+	bool       time_adapt;
 	int        output_frequency;
-	int        domaintype,groundingline_migration;
-	int        numoutputs         = 0;
-	Analysis  *analysis = NULL;
-	char**     requested_outputs = NULL;
+	int        recording_frequency;
+	int        domaintype,groundingline_migration,smb_model;
+	int        numoutputs;
+	Analysis  *analysis          = NULL;
+	char     **requested_outputs = NULL;
 
-
 	/*intermediary: */
-	int    step;
+	int        step;
 	IssmDouble time;
 
-	//first recover parameters common to all solutions
+	//then recover parameters common to all solutions
 	femmodel->parameters->FindParam(&domaintype,DomainTypeEnum);
+	femmodel->parameters->FindParam(&step,StepEnum);
 	femmodel->parameters->FindParam(&starttime,TimesteppingStartTimeEnum);
 	femmodel->parameters->FindParam(&finaltime,TimesteppingFinalTimeEnum);
 	femmodel->parameters->FindParam(&dt,TimesteppingTimeStepEnum);
 	femmodel->parameters->FindParam(&yts,ConstantsYtsEnum);
 	femmodel->parameters->FindParam(&dakota_analysis,QmuIsdakotaEnum);
 	femmodel->parameters->FindParam(&output_frequency,SettingsOutputFrequencyEnum);
+	femmodel->parameters->FindParam(&recording_frequency,SettingsRecordingFrequencyEnum);
 	femmodel->parameters->FindParam(&time_adapt,TimesteppingTimeAdaptEnum);
 	femmodel->parameters->FindParam(&isstressbalance,TransientIsstressbalanceEnum);
 	femmodel->parameters->FindParam(&ismasstransport,TransientIsmasstransportEnum);
+	femmodel->parameters->FindParam(&issmb,TransientIssmbEnum);
 	femmodel->parameters->FindParam(&isthermal,TransientIsthermalEnum);
 	femmodel->parameters->FindParam(&isgia,TransientIsgiaEnum);
+	femmodel->parameters->FindParam(&isslr,TransientIsslrEnum);
+	femmodel->parameters->FindParam(&iscoupler,TransientIscouplerEnum);
 	femmodel->parameters->FindParam(&isgroundingline,TransientIsgroundinglineEnum);
-	femmodel->parameters->FindParam(&islevelset,TransientIslevelsetEnum);
+	femmodel->parameters->FindParam(&ismovingfront,TransientIsmovingfrontEnum);
 	femmodel->parameters->FindParam(&isdamageevolution,TransientIsdamageevolutionEnum);
 	femmodel->parameters->FindParam(&ishydrology,TransientIshydrologyEnum);
 	femmodel->parameters->FindParam(&isFS,FlowequationIsFSEnum);
-	femmodel->parameters->FindParam(&iscalving,TransientIscalvingEnum);
 	if(isgroundingline) femmodel->parameters->FindParam(&groundingline_migration,GroundinglineMigrationEnum);
 	femmodel->parameters->FindParam(&numoutputs,TransientNumRequestedOutputsEnum);
 	if(numoutputs) femmodel->parameters->FindParam(&requested_outputs,&numoutputs,TransientRequestedOutputsEnum);
 
+	//first, figure out if there was a check point, if so, do a reset of the FemModel* femmodel structure. 
+	if(recording_frequency)femmodel->Restart();
+
 	/*initialize: */
-	step=0;
 	time=starttime;
 
 	while(time < finaltime - (yts*DBL_EPSILON)){ //make sure we run up to finaltime.
@@ -73,66 +79,36 @@
 		femmodel->parameters->SetParam(time,TimeEnum);
 		femmodel->parameters->SetParam(step,StepEnum);
 
-		if(VerboseSolution()) _printf0_("iteration " << step << "/" << floor((finaltime-time)/dt)+step << "  time [yr]: " << time/yts << " (time step: " << dt/yts << ")\n");
+		if(VerboseSolution()) _printf0_("iteration " << step << "/" << floor((finaltime-time)/dt)+step << "  time [yr]: " << setprecision(4) << time/yts << " (time step: " << dt/yts << ")\n");
 		if(step%output_frequency==0 || (time >= finaltime - (yts*DBL_EPSILON)) || step==1)
 		 save_results=true;
 		else
 		 save_results=false;
 		femmodel->parameters->SetParam(save_results,SaveResultsEnum);
 
-		if(isthermal && domaintype==Domain3DEnum){
+		if(isthermal && domaintype==Domain3DEnum){ 
+			if(issmb){
+				femmodel->parameters->FindParam(&smb_model,SmbEnum);
+				if(smb_model==SMBpddEnum) ResetBoundaryConditions(femmodel,ThermalAnalysisEnum);
+				if(smb_model==SMBd18opddEnum) ResetBoundaryConditions(femmodel,ThermalAnalysisEnum);
+			}
 			if(VerboseSolution()) _printf0_("   computing thermal regime\n");
 			thermal_core(femmodel);
 		}
 
-		if(ishydrology){
-			if(VerboseSolution()) _printf0_("   computing water heads\n");
-			hydrology_core(femmodel);
-		}
+		if(ishydrology) hydrology_core(femmodel);
 
-		if(isstressbalance){
-			if(VerboseSolution()) _printf0_("   computing new velocity\n");
-			stressbalance_core(femmodel);
-		}
+		if(isstressbalance) stressbalance_core(femmodel);
 
-		if(isdamageevolution){
-			if(VerboseSolution()) _printf0_("   computing damage\n");
-			damage_core(femmodel);
-		}
+		if(isdamageevolution) damage_core(femmodel);
 
-		if(islevelset){
-			if(iscalving) Calvingx(femmodel);
-			if(VerboseSolution()) _printf0_("   computing levelset transport\n");
-			/* smoothen slope of lsf for computation of normal on ice domain*/
-			levelsetfunctionslope_core(femmodel);
+		if(ismovingfront)	movingfront_core(femmodel);
 
-			/* extrapolate velocities onto domain with no ice */
-			Analysis* extanalysis = new ExtrapolationAnalysis();
-			const int nvars=3;
-			int vars[nvars] = {VxEnum, VyEnum, ThicknessEnum};
-			for(int iv=0;iv<nvars;iv++){
-				femmodel->parameters->SetParam(vars[iv],ExtrapolationVariableEnum); 
-				extanalysis->Core(femmodel);
-			}
-			delete extanalysis;	
+		/* from here on, prepare geometry for next time step*/
+		if(issmb)smb_core(femmodel);
 
-			/* solve level set equation */
-			analysis = new LevelsetAnalysis();
-			analysis->Core(femmodel);
-			delete analysis;
-
-			/* update vertices included for next calculation */
-			GetMaskOfIceVerticesLSMx(femmodel);
-
-			/* add computation domain mask to outputs */
-			int outputs[1] = {IceMaskNodeActivationEnum};
-			femmodel->RequestedOutputsx(&femmodel->results,&outputs[0],1);
-		}
-
 		if(ismasstransport){
-			if(VerboseSolution()) _printf0_("   computing new thickness\n");
 			masstransport_core(femmodel);
-			if(VerboseSolution()) _printf0_("   updating vertices positions\n");
 			femmodel->UpdateVertexPositionsx();
 		}
 		
@@ -153,7 +129,7 @@
 			}
 		}
 
-		/*Calculate new Basal melting on Floating ice*/
+		/*Calculate new basal melting on floating ice*/
 		FloatingiceMeltingRatex(femmodel);
 		
 		if(isgia){
@@ -165,6 +141,9 @@
 			#endif
 		}
 
+		/*Sea level rise: */
+		if(isslr | iscoupler) sealevelrise_core(femmodel);
+
 		/*unload results*/
 		if(VerboseSolution()) _printf0_("   computing requested outputs\n");
 		femmodel->RequestedOutputsx(&femmodel->results,requested_outputs,numoutputs,save_results);
@@ -172,11 +151,16 @@
 			int outputs[1] = {MaskGroundediceLevelsetEnum};
 			femmodel->RequestedOutputsx(&femmodel->results,&outputs[0],1,save_results);
 		}
-
+		
 		if(save_results){
 			if(VerboseSolution()) _printf0_("   saving temporary results\n");
 			OutputResultsx(femmodel);
 		}
+
+		if(recording_frequency&& step%recording_frequency==0){
+			if(VerboseSolution()) _printf0_("   checkpointing model \n");
+			femmodel->CheckPoint();
+		}
 	}
 
 	femmodel->RequestedDependentsx();

Modified: issm/trunk/src/c/datastructures/DataSet.cpp
===================================================================
--- issm/trunk/src/c/datastructures/DataSet.cpp	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/datastructures/DataSet.cpp	2016-04-13 04:32:01 UTC (rev 20500)
@@ -18,6 +18,7 @@
 
 #include "../datastructures/datastructures.h"
 #include "../shared/shared.h"
+#include "../classes/classes.h"
 
 using namespace std;
 /*}}}*/
@@ -27,6 +28,8 @@
 
 	sorted=0;
 	numsorted=0;
+	presorted=0;
+	enum_type=-1;
 	sorted_ids=NULL;
 	id_offsets=NULL;
 
@@ -36,6 +39,8 @@
 	enum_type=dataset_enum;
 
 	sorted=0;
+	numsorted=0;
+	presorted=0;
 	sorted_ids=NULL;
 	id_offsets=NULL;
 
@@ -85,6 +90,296 @@
 /*}}}*/
 
 /*Specific methods*/
+void  DataSet::Marshall(char** pmarshalled_data, int* pmarshalled_data_size, int marshall_direction){ /*{{{*/
+	
+	vector<Object*>::iterator obj;
+	int obj_size=0;
+	int obj_enum=0;
+	int i;
+
+	if(marshall_direction==MARSHALLING_FORWARD || marshall_direction==MARSHALLING_SIZE){
+		obj_size=objects.size();
+	}
+	else{
+		clear();
+	}
+
+	MARSHALLING_ENUM(DataSetEnum);
+	MARSHALLING(enum_type);
+	MARSHALLING(sorted);
+	MARSHALLING(presorted);
+	MARSHALLING(numsorted);
+
+	/*Now branch according to direction of marshalling: */
+	if(marshall_direction==MARSHALLING_FORWARD || marshall_direction==MARSHALLING_SIZE){
+		if(!(this->sorted && numsorted>0 && this->id_offsets)){
+			sorted_ids=NULL;
+			id_offsets=NULL;
+		  }
+		MARSHALLING_DYNAMIC(sorted_ids,int,numsorted);
+		MARSHALLING_DYNAMIC(id_offsets,int,numsorted);
+		MARSHALLING(obj_size);
+
+		/*Go through our objects, and marshall them into the buffer: */
+		for( obj=this->objects.begin() ; obj < this->objects.end(); obj++ ){
+			obj_enum=(*obj)->ObjectEnum();
+			MARSHALLING(obj_enum);
+			(*obj)->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
+		}
+	}
+	else{
+
+		MARSHALLING_DYNAMIC(sorted_ids,int,numsorted);
+		MARSHALLING_DYNAMIC(id_offsets,int,numsorted);
+		if (!(this->sorted && numsorted>0)){
+		 sorted_ids=NULL;
+		 id_offsets=NULL;
+		}
+		MARSHALLING(obj_size);
+
+		/*This is the heart of the demashalling method. We have a buffer coming
+		 in, and we are supposed to create a dataset out of it. No such thing
+		 as class orientation for buffers, we need to key off the enum of each
+		 object stored in the buffer. */
+		for(i=0;i<obj_size;i++){
+
+			/*Recover enum of object first: */
+			MARSHALLING(obj_enum); 
+
+			/*Giant case statement to spin-up the right object, and demarshall into it the information 
+			 *stored in the buffer: */
+			if(obj_enum==NodeEnum){
+				Node* node=NULL;
+				node=new Node();
+				node->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
+				this->AddObject(node);
+			}
+			else if(obj_enum==VertexEnum){
+				Vertex* vertex=NULL;
+				vertex=new Vertex();
+				vertex->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
+				this->AddObject(vertex);
+			}
+			else if(obj_enum==DoubleParamEnum){
+				DoubleParam* doubleparam=NULL;
+				doubleparam=new DoubleParam();
+				doubleparam->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
+				this->AddObject(doubleparam);
+			}
+			else if(obj_enum==IntParamEnum){
+				IntParam* intparam=NULL;
+				intparam=new IntParam();
+				intparam->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
+				this->AddObject(intparam);
+			}
+			else if(obj_enum==IntMatParamEnum){
+				IntMatParam* intmparam=NULL;
+				intmparam=new IntMatParam();
+				intmparam->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
+				this->AddObject(intmparam);
+			}
+			else if(obj_enum==IntVecParamEnum){
+				IntVecParam* intvparam=NULL;
+				intvparam=new IntVecParam();
+				intvparam->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
+				this->AddObject(intvparam);
+			}
+			else if(obj_enum==BoolParamEnum){
+				BoolParam* boolparam=NULL;
+				boolparam=new BoolParam();
+				boolparam->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
+				this->AddObject(boolparam);
+			}
+			else if(obj_enum==DataSetParamEnum){
+				DataSetParam* dsparam=NULL;
+				dsparam=new DataSetParam();
+				dsparam->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
+				this->AddObject(dsparam);
+			}
+			else if(obj_enum==DoubleMatArrayParamEnum){
+				DoubleMatArrayParam* dmaparam=NULL;
+				dmaparam=new DoubleMatArrayParam();
+				dmaparam->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
+				this->AddObject(dmaparam);
+			}
+			else if(obj_enum==DoubleMatParamEnum){
+				DoubleMatParam* dmparam=NULL;
+				dmparam=new DoubleMatParam();
+				dmparam->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
+				this->AddObject(dmparam);
+			}
+			else if(obj_enum==DoubleVecParamEnum){
+				DoubleVecParam* dvparam=NULL;
+				dvparam=new DoubleVecParam();
+				dvparam->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
+				this->AddObject(dvparam);
+			}
+			else if(obj_enum==FileParamEnum){
+				FileParam* fileparam=NULL;
+				fileparam=new FileParam();
+				fileparam->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
+				delete fileparam;
+				/* No need to add this object, the pointer is not valid             
+				   The FemModel should reset all FileParams in the restart function */
+			}
+			else if(obj_enum==StringParamEnum){
+				StringParam* sparam=NULL;
+				sparam=new StringParam();
+				sparam->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
+				this->AddObject(sparam);
+			}
+			else if(obj_enum==StringArrayParamEnum){
+				StringArrayParam* saparam=NULL;
+				saparam=new StringArrayParam();
+				saparam->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
+				this->AddObject(saparam);
+			}
+			else if(obj_enum==TransientParamEnum){
+				TransientParam* transparam=NULL;
+				transparam=new TransientParam();
+				transparam->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
+				this->AddObject(transparam);
+			}
+			else if(obj_enum==GenericParamEnum){
+				/*Skip for now (we don't want to Marhsall Comms*/
+			}
+			else if(obj_enum==MaticeEnum){
+				Matice* matice=NULL;
+				matice=new Matice();
+				matice->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
+				this->AddObject(matice);
+			}
+			else if(obj_enum==MatparEnum){
+				Matpar* matpar=NULL;
+				matpar=new Matpar();
+				matpar->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
+				this->AddObject(matpar);
+			}
+			else if(obj_enum==SpcStaticEnum){
+				SpcStatic* spcstatic=NULL;
+				spcstatic=new SpcStatic();
+				spcstatic->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
+				this->AddObject(spcstatic);
+			}
+			else if(obj_enum==SpcDynamicEnum){
+				SpcDynamic* spcdynamic=NULL;
+				spcdynamic=new SpcDynamic();
+				spcdynamic->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
+				this->AddObject(spcdynamic);
+			}
+			else if(obj_enum==SpcTransientEnum){
+				SpcTransient* spctransient=NULL;
+				spctransient=new SpcTransient();
+				spctransient->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
+				this->AddObject(spctransient);
+			}
+			else if(obj_enum==TriaEnum){
+				Tria* tria=NULL;
+				tria=new Tria();
+				tria->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
+				this->AddObject(tria);
+			}
+			else if(obj_enum==PentaEnum){
+				Penta* penta=NULL;
+				penta=new Penta();
+				penta->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
+				this->AddObject(penta);
+			}
+			else if(obj_enum==TetraEnum){
+				Tetra* tetra=NULL;
+				tetra=new Tetra();
+				tetra->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
+				this->AddObject(tetra);
+			}
+			else if(obj_enum==SegEnum){
+				Seg* seg=NULL;
+				seg=new Seg();
+				seg->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
+				this->AddObject(seg);
+			}
+			else if(obj_enum==BoolInputEnum){
+				BoolInput* boolinput=NULL;
+				boolinput=new BoolInput();
+				boolinput->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
+				this->AddObject(boolinput);
+			}
+			else if(obj_enum==DoubleInputEnum){
+				DoubleInput* doubleinput=NULL;
+				doubleinput=new DoubleInput();
+				doubleinput->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
+				this->AddObject(doubleinput);
+			}
+			else if(obj_enum==IntInputEnum){
+				IntInput* intinput=NULL;
+				intinput=new IntInput();
+				intinput->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
+				this->AddObject(intinput);
+			}
+			else if(obj_enum==ControlInputEnum){
+				ControlInput* cinput=NULL;
+				cinput=new ControlInput();
+				cinput->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
+				this->AddObject(cinput);
+			}
+			else if(obj_enum==TransientInputEnum){
+				TransientInput* transinput=NULL;
+				transinput=new TransientInput();
+				transinput->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
+				this->AddObject(transinput);
+			}
+			else if(obj_enum==TriaInputEnum){
+				TriaInput* triainput=NULL;
+				triainput=new TriaInput();
+				triainput->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
+				this->AddObject(triainput);
+			}
+			else if(obj_enum==PentaInputEnum){
+				PentaInput* pentainput=NULL;
+				pentainput=new PentaInput();
+				pentainput->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
+				this->AddObject(pentainput);
+			}
+			else if(obj_enum==TetraInputEnum){
+				TetraInput* tetrainput=NULL;
+				tetrainput=new TetraInput();
+				tetrainput->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
+				this->AddObject(tetrainput);
+			}
+			else if(obj_enum==SegInputEnum){
+				SegInput* seginput=NULL;
+				seginput=new SegInput();
+				seginput->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
+				this->AddObject(seginput);
+			}
+			else if(obj_enum==RiftfrontEnum){
+				Riftfront* rift=NULL;
+				rift=new Riftfront();
+				rift->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
+				this->AddObject(rift);
+			}
+			else if(obj_enum==NumericalfluxEnum){
+				Numericalflux* numflux=NULL;
+				numflux=new Numericalflux();
+				numflux->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
+				this->AddObject(numflux);
+			}
+			else if(obj_enum==PengridEnum){
+				Pengrid* pengrid=NULL;
+				pengrid=new Pengrid();
+				pengrid->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
+				this->AddObject(pengrid);
+			}
+			else if(obj_enum==PenpairEnum){
+				Penpair* penpair=NULL;
+				penpair=new Penpair();
+				penpair->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
+				this->AddObject(penpair);
+			}
+			else _error_("could not recognize enum type: " << obj_enum << ": " << EnumToStringx(obj_enum) ); 
+		}
+	}
+}
+/*}}}*/
 int   DataSet::AddObject(Object* object){/*{{{*/
 
 	_assert_(this);
@@ -128,7 +423,7 @@
 
 	vector<Object*>::iterator object;
 
-	if(this==NULL)_error_("trying to echo a NULL dataset");
+	_assert_(this);
 
 	_printf0_("DataSet echo: " << objects.size() << " objects\n");
 
@@ -144,7 +439,7 @@
 
 	vector<Object*>::iterator object;
 
-	if(this==NULL)_error_("trying to echo a NULL dataset");
+	_assert_(this);
 
 	_printf0_("DataSet echo: " << objects.size() << " objects\n");
 

Modified: issm/trunk/src/c/datastructures/DataSet.h
===================================================================
--- issm/trunk/src/c/datastructures/DataSet.h	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/datastructures/DataSet.h	2016-04-13 04:32:01 UTC (rev 20500)
@@ -32,6 +32,7 @@
 		DataSet();
 		DataSet(int enum_type);
 		~DataSet();
+		void  Marshall(char** pmarshalled_data, int* pmarshalled_data_size, int marshall_direction);
 
 		/*management*/
 		int      GetEnum();

Modified: issm/trunk/src/c/datastructures/Object.h
===================================================================
--- issm/trunk/src/c/datastructures/Object.h	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/datastructures/Object.h	2016-04-13 04:32:01 UTC (rev 20500)
@@ -20,6 +20,7 @@
 		virtual int   Id()=0;
 		virtual int   ObjectEnum()=0;
 		virtual Object* copy()=0;
+		virtual void Marshall(char** pmarshalled_data, int* pmarshalled_data_size, int marshall_direction)=0;
 
 };
 #endif

Modified: issm/trunk/src/c/kml/KML_Attribute.h
===================================================================
--- issm/trunk/src/c/kml/KML_Attribute.h	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/kml/KML_Attribute.h	2016-04-13 04:32:01 UTC (rev 20500)
@@ -28,6 +28,7 @@
 		int   Id(){_error_("Not implemented yet.");};
 		int   ObjectEnum(){_error_("Not implemented yet.");};
 		Object* copy(){_error_("Not implemented yet.");};
+		void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ _error_("not implemented yet!");};
 		/*}}}*/
 
 		/*virtual functions: */

Modified: issm/trunk/src/c/kml/KML_ColorStyle.h
===================================================================
--- issm/trunk/src/c/kml/KML_ColorStyle.h	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/kml/KML_ColorStyle.h	2016-04-13 04:32:01 UTC (rev 20500)
@@ -35,6 +35,7 @@
 		void  Demarshall(char** pmarshalled_dataset){_error_("Not implemented yet.");};
 		int   ObjectEnum(){_error_("Not implemented yet.");};
 		Object* copy(){_error_("Not implemented yet.");};
+		void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ _error_("not implemented yet!");};
 		/*}}}*/
 
 };

Modified: issm/trunk/src/c/kml/KML_Comment.h
===================================================================
--- issm/trunk/src/c/kml/KML_Comment.h	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/kml/KML_Comment.h	2016-04-13 04:32:01 UTC (rev 20500)
@@ -29,6 +29,7 @@
 		int   Id(){_error_("Not implemented yet.");};
 		int   ObjectEnum(){_error_("Not implemented yet.");};
 		Object* copy(){_error_("Not implemented yet.");};
+		void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ _error_("not implemented yet!");};
 		/*}}}*/
 
 		/*virtual functions: */

Modified: issm/trunk/src/c/kml/KML_Container.h
===================================================================
--- issm/trunk/src/c/kml/KML_Container.h	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/kml/KML_Container.h	2016-04-13 04:32:01 UTC (rev 20500)
@@ -32,6 +32,7 @@
 		int   Id(){_error_("Not implemented yet.");};
 		int   ObjectEnum(){_error_("Not implemented yet.");};
 		Object* copy(){_error_("Not implemented yet.");};
+		void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ _error_("not implemented yet!");};
 		/*}}}*/
 
 };

Modified: issm/trunk/src/c/kml/KML_Document.h
===================================================================
--- issm/trunk/src/c/kml/KML_Document.h	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/kml/KML_Document.h	2016-04-13 04:32:01 UTC (rev 20500)
@@ -29,6 +29,7 @@
 		int   Id(){_error_("Not implemented yet.");};
 		int   ObjectEnum(){_error_("Not implemented yet.");};
 		Object* copy(){_error_("Not implemented yet.");};
+		void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ _error_("not implemented yet!");};
 		/*}}}*/
 
 };

Modified: issm/trunk/src/c/kml/KML_Feature.h
===================================================================
--- issm/trunk/src/c/kml/KML_Feature.h	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/kml/KML_Feature.h	2016-04-13 04:32:01 UTC (rev 20500)
@@ -43,6 +43,7 @@
 		int   Id(){_error_("Not implemented yet.");};
 		int   ObjectEnum(){_error_("Not implemented yet.");};
 		Object* copy(){_error_("Not implemented yet.");};
+		void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ _error_("not implemented yet!");};
 		/*}}}*/
 
 };

Modified: issm/trunk/src/c/kml/KML_File.h
===================================================================
--- issm/trunk/src/c/kml/KML_File.h	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/kml/KML_File.h	2016-04-13 04:32:01 UTC (rev 20500)
@@ -31,6 +31,7 @@
 		int   Id(){_error_("Not implemented yet.");};
 		int   ObjectEnum(){_error_("Not implemented yet.");};
 		Object* copy(){_error_("Not implemented yet.");};
+		void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ _error_("not implemented yet!");};
 		/*}}}*/
 
 };

Modified: issm/trunk/src/c/kml/KML_Folder.h
===================================================================
--- issm/trunk/src/c/kml/KML_Folder.h	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/kml/KML_Folder.h	2016-04-13 04:32:01 UTC (rev 20500)
@@ -29,6 +29,7 @@
 		int   Id(){_error_("Not implemented yet.");};
 		int   ObjectEnum(){_error_("Not implemented yet.");};
 		Object* copy(){_error_("Not implemented yet.");};
+		void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ _error_("not implemented yet!");};
 		/*}}}*/
 
 };

Modified: issm/trunk/src/c/kml/KML_Geometry.h
===================================================================
--- issm/trunk/src/c/kml/KML_Geometry.h	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/kml/KML_Geometry.h	2016-04-13 04:32:01 UTC (rev 20500)
@@ -28,6 +28,7 @@
 		int   Id(){_error_("Not implemented yet.");};
 		int   ObjectEnum(){_error_("Not implemented yet.");};
 		Object* copy(){_error_("Not implemented yet.");};
+		void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ _error_("not implemented yet!");};
 		/*}}}*/
 
 };

Modified: issm/trunk/src/c/kml/KML_GroundOverlay.h
===================================================================
--- issm/trunk/src/c/kml/KML_GroundOverlay.h	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/kml/KML_GroundOverlay.h	2016-04-13 04:32:01 UTC (rev 20500)
@@ -35,6 +35,7 @@
 		int   Id(){_error_("Not implemented yet.");};
 		int   ObjectEnum(){_error_("Not implemented yet.");};
 		Object* copy(){_error_("Not implemented yet.");};
+		void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ _error_("not implemented yet!");};
 		/*}}}*/
 
 };

Modified: issm/trunk/src/c/kml/KML_Icon.h
===================================================================
--- issm/trunk/src/c/kml/KML_Icon.h	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/kml/KML_Icon.h	2016-04-13 04:32:01 UTC (rev 20500)
@@ -43,6 +43,7 @@
 		int   Id(){_error_("Not implemented yet.");};
 		int   ObjectEnum(){_error_("Not implemented yet.");};
 		Object* copy(){_error_("Not implemented yet.");};
+		void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ _error_("not implemented yet!");};
 		/*}}}*/
 
 };

Modified: issm/trunk/src/c/kml/KML_LatLonBox.h
===================================================================
--- issm/trunk/src/c/kml/KML_LatLonBox.h	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/kml/KML_LatLonBox.h	2016-04-13 04:32:01 UTC (rev 20500)
@@ -34,6 +34,7 @@
 		int   Id(){_error_("Not implemented yet.");};
 		int   ObjectEnum(){_error_("Not implemented yet.");};
 		Object* copy(){_error_("Not implemented yet.");};
+		void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ _error_("not implemented yet!");};
 		/*}}}*/
 
 };

Modified: issm/trunk/src/c/kml/KML_LineString.h
===================================================================
--- issm/trunk/src/c/kml/KML_LineString.h	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/kml/KML_LineString.h	2016-04-13 04:32:01 UTC (rev 20500)
@@ -37,6 +37,7 @@
 		int   Id(){_error_("Not implemented yet.");};
 		int   ObjectEnum(){_error_("Not implemented yet.");};
 		Object* copy(){_error_("Not implemented yet.");};
+		void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ _error_("not implemented yet!");};
 		/*}}}*/
 
 };

Modified: issm/trunk/src/c/kml/KML_LineStyle.h
===================================================================
--- issm/trunk/src/c/kml/KML_LineStyle.h	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/kml/KML_LineStyle.h	2016-04-13 04:32:01 UTC (rev 20500)
@@ -30,6 +30,7 @@
 		int   Id(){_error_("Not implemented yet.");};
 		int   ObjectEnum(){_error_("Not implemented yet.");};
 		Object* copy(){_error_("Not implemented yet.");};
+		void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ _error_("not implemented yet!");};
 		/*}}}*/
 
 };

Modified: issm/trunk/src/c/kml/KML_LinearRing.h
===================================================================
--- issm/trunk/src/c/kml/KML_LinearRing.h	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/kml/KML_LinearRing.h	2016-04-13 04:32:01 UTC (rev 20500)
@@ -37,6 +37,7 @@
 		int   Id(){_error_("Not implemented yet.");};
 		int   ObjectEnum(){_error_("Not implemented yet.");};
 		Object* copy(){_error_("Not implemented yet.");};
+		void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ _error_("not implemented yet!");};
 		/*}}}*/
 
 };

Modified: issm/trunk/src/c/kml/KML_MultiGeometry.h
===================================================================
--- issm/trunk/src/c/kml/KML_MultiGeometry.h	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/kml/KML_MultiGeometry.h	2016-04-13 04:32:01 UTC (rev 20500)
@@ -33,6 +33,7 @@
 		int   Id(){_error_("Not implemented yet.");};
 		int   ObjectEnum(){_error_("Not implemented yet.");};
 		Object* copy(){_error_("Not implemented yet.");};
+		void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ _error_("not implemented yet!");};
 		/*}}}*/
 
 };

Modified: issm/trunk/src/c/kml/KML_Object.h
===================================================================
--- issm/trunk/src/c/kml/KML_Object.h	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/kml/KML_Object.h	2016-04-13 04:32:01 UTC (rev 20500)
@@ -29,6 +29,7 @@
 		int   Id(){_error_("Not implemented yet.");};
 		int   ObjectEnum(){_error_("Not implemented yet.");};
 		Object* copy(){_error_("Not implemented yet.");};
+		void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ _error_("not implemented yet!");};
 		/*}}}*/
 
 		/*virtual functions: */

Modified: issm/trunk/src/c/kml/KML_Overlay.h
===================================================================
--- issm/trunk/src/c/kml/KML_Overlay.h	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/kml/KML_Overlay.h	2016-04-13 04:32:01 UTC (rev 20500)
@@ -35,6 +35,7 @@
 		int   Id(){_error_("Not implemented yet.");};
 		int   ObjectEnum(){_error_("Not implemented yet.");};
 		Object* copy(){_error_("Not implemented yet.");};
+		void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ _error_("not implemented yet!");};
 		/*}}}*/
 
 };

Modified: issm/trunk/src/c/kml/KML_Placemark.h
===================================================================
--- issm/trunk/src/c/kml/KML_Placemark.h	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/kml/KML_Placemark.h	2016-04-13 04:32:01 UTC (rev 20500)
@@ -33,6 +33,7 @@
 		int   Id(){_error_("Not implemented yet.");};
 		int   ObjectEnum(){_error_("Not implemented yet.");};
 		Object* copy(){_error_("Not implemented yet.");};
+		void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ _error_("not implemented yet!");};
 		/*}}}*/
 
 };

Modified: issm/trunk/src/c/kml/KML_Point.h
===================================================================
--- issm/trunk/src/c/kml/KML_Point.h	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/kml/KML_Point.h	2016-04-13 04:32:01 UTC (rev 20500)
@@ -35,6 +35,7 @@
 		int   Id(){_error_("Not implemented yet.");};
 		int   ObjectEnum(){_error_("Not implemented yet.");};
 		Object* copy(){_error_("Not implemented yet.");};
+		void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ _error_("not implemented yet!");};
 		/*}}}*/
 
 };

Modified: issm/trunk/src/c/kml/KML_PolyStyle.h
===================================================================
--- issm/trunk/src/c/kml/KML_PolyStyle.h	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/kml/KML_PolyStyle.h	2016-04-13 04:32:01 UTC (rev 20500)
@@ -31,6 +31,7 @@
 		int   Id(){_error_("Not implemented yet.");};
 		int   ObjectEnum(){_error_("Not implemented yet.");};
 		Object* copy(){_error_("Not implemented yet.");};
+		void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ _error_("not implemented yet!");};
 		/*}}}*/
 
 };

Modified: issm/trunk/src/c/kml/KML_Polygon.h
===================================================================
--- issm/trunk/src/c/kml/KML_Polygon.h	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/kml/KML_Polygon.h	2016-04-13 04:32:01 UTC (rev 20500)
@@ -39,6 +39,7 @@
 		int   Id(){_error_("Not implemented yet.");};
 		int   ObjectEnum(){_error_("Not implemented yet.");};
 		Object* copy(){_error_("Not implemented yet.");};
+		void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ _error_("not implemented yet!");};
 		/*}}}*/
 
 };

Modified: issm/trunk/src/c/kml/KML_Style.h
===================================================================
--- issm/trunk/src/c/kml/KML_Style.h	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/kml/KML_Style.h	2016-04-13 04:32:01 UTC (rev 20500)
@@ -37,6 +37,7 @@
 		int   Id(){_error_("Not implemented yet.");};
 		int   ObjectEnum(){_error_("Not implemented yet.");};
 		Object* copy(){_error_("Not implemented yet.");};
+		void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ _error_("not implemented yet!");};
 		/*}}}*/
 
 };

Modified: issm/trunk/src/c/kml/KML_StyleSelector.h
===================================================================
--- issm/trunk/src/c/kml/KML_StyleSelector.h	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/kml/KML_StyleSelector.h	2016-04-13 04:32:01 UTC (rev 20500)
@@ -28,6 +28,7 @@
 		int   Id(){_error_("Not implemented yet.");};
 		int   ObjectEnum(){_error_("Not implemented yet.");};
 		Object* copy(){_error_("Not implemented yet.");};
+		void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ _error_("not implemented yet!");};
 		/*}}}*/
 
 };

Modified: issm/trunk/src/c/kml/KML_SubStyle.h
===================================================================
--- issm/trunk/src/c/kml/KML_SubStyle.h	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/kml/KML_SubStyle.h	2016-04-13 04:32:01 UTC (rev 20500)
@@ -28,6 +28,7 @@
 		int   Id(){_error_("Not implemented yet.");};
 		int   ObjectEnum(){_error_("Not implemented yet.");};
 		Object* copy(){_error_("Not implemented yet.");};
+		void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ _error_("not implemented yet!");};
 		/*}}}*/
 
 };

Modified: issm/trunk/src/c/kml/KML_Unknown.h
===================================================================
--- issm/trunk/src/c/kml/KML_Unknown.h	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/kml/KML_Unknown.h	2016-04-13 04:32:01 UTC (rev 20500)
@@ -31,6 +31,7 @@
 		int   Id(){_error_("Not implemented yet.");};
 		int   ObjectEnum(){_error_("Not implemented yet.");};
 		Object* copy(){_error_("Not implemented yet.");};
+		void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ _error_("not implemented yet!");};
 		/*}}}*/
 
 };

Modified: issm/trunk/src/c/main/globals.h
===================================================================
--- issm/trunk/src/c/main/globals.h	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/main/globals.h	2016-04-13 04:32:01 UTC (rev 20500)
@@ -4,11 +4,11 @@
 
 #ifndef _GLOBALS_H_
 #define _GLOBALS_H_
-
 #include "../shared/io/Comm/IssmComm.h"
 #include "../toolkits/ToolkitOptions.h"
 
 /*Communicators: */
+#ifndef _DO_NOT_LOAD_GLOBALS_ 
 ISSM_MPI_Comm IssmComm::comm;
 bool IssmComm::parallel;
 
@@ -16,5 +16,6 @@
  * database if we use Petsc. Can also be used to characterize the ISSM toolkit,
  * often used when Petsc is not allowed*/
 char* ToolkitOptions::toolkitoptions;
+#endif
 
 #endif

Modified: issm/trunk/src/c/modules/Calvingx/Calvingx.cpp
===================================================================
--- issm/trunk/src/c/modules/Calvingx/Calvingx.cpp	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/modules/Calvingx/Calvingx.cpp	2016-04-13 04:32:01 UTC (rev 20500)
@@ -22,12 +22,6 @@
 			femmodel->StrainRateperpendicularx();
 			femmodel->CalvingRateLevermannx();
 			break;
-		case CalvingPiEnum:
-			if(VerboseModule()) _printf0_("   computing Pi's calving rate\n");
-			femmodel->StrainRateparallelx();
-			femmodel->DeviatoricStressx();
-			femmodel->CalvingRatePix();
-			break;
 		case CalvingDevEnum:
 			femmodel->CalvingRateDevx();
 			femmodel->ElementOperationx(&Element::CalvingRateDev);


Property changes on: issm/trunk/src/c/modules/Damagex
___________________________________________________________________
Added: svn:ignore
   + *.deps
*.dirstamp


Modified: issm/trunk/src/c/modules/FloatingiceMeltingRatex/FloatingiceMeltingRatex.cpp
===================================================================
--- issm/trunk/src/c/modules/FloatingiceMeltingRatex/FloatingiceMeltingRatex.cpp	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/modules/FloatingiceMeltingRatex/FloatingiceMeltingRatex.cpp	2016-04-13 04:32:01 UTC (rev 20500)
@@ -17,12 +17,17 @@
 	/*branch to correct module*/
 	switch(basalforcing_model){
 		case FloatingMeltRateEnum:
+		case MantlePlumeGeothermalFluxEnum:
 			/*Nothing to be done*/
 			break;
 		case LinearFloatingMeltRateEnum:
-			if(VerboseSolution())_printf_("	call Linear Floating melting rate module\n");
+			if(VerboseSolution())_printf0_("	call Linear Floating melting rate module\n");
 			LinearFloatingiceMeltingRatex(femmodel);
 			break;
+		case MismipFloatingMeltRateEnum:
+			if(VerboseSolution())_printf0_("	call Mismip Floating melting rate module\n");
+			MismipFloatingiceMeltingRatex(femmodel);
+			break;
 		default:
 			_error_("Basal forcing model "<<EnumToStringx(basalforcing_model)<<" not supported yet");
 	}
@@ -37,3 +42,11 @@
 	}
 
 }/*}}}*/
+void MismipFloatingiceMeltingRatex(FemModel* femmodel){/*{{{*/
+
+	for(int i=0;i<femmodel->elements->Size();i++){
+		Element* element=xDynamicCast<Element*>(femmodel->elements->GetObjectByOffset(i));
+		element->MismipFloatingiceMeltingRate();
+	}
+
+}/*}}}*/

Modified: issm/trunk/src/c/modules/FloatingiceMeltingRatex/FloatingiceMeltingRatex.h
===================================================================
--- issm/trunk/src/c/modules/FloatingiceMeltingRatex/FloatingiceMeltingRatex.h	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/modules/FloatingiceMeltingRatex/FloatingiceMeltingRatex.h	2016-04-13 04:32:01 UTC (rev 20500)
@@ -10,5 +10,6 @@
 /* local prototypes: */
 void FloatingiceMeltingRatex(FemModel* femmodel);
 void LinearFloatingiceMeltingRatex(FemModel* femmodel);
+void MismipFloatingiceMeltingRatex(FemModel* femmodel);
 
 #endif  /* _FloatingiceMeltingRatex_H*/

Modified: issm/trunk/src/c/modules/InterpFromMeshToMesh2dx/InterpFromMeshToMesh2dx.cpp
===================================================================
--- issm/trunk/src/c/modules/InterpFromMeshToMesh2dx/InterpFromMeshToMesh2dx.cpp	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/modules/InterpFromMeshToMesh2dx/InterpFromMeshToMesh2dx.cpp	2016-04-13 04:32:01 UTC (rev 20500)
@@ -133,12 +133,23 @@
 			}
 		}
 		else{
-			for (j=0;j<N_data;j++){
-				if (it<0 || it>=nels_data){
-					_error_("Triangle number " << it << " not in [0 " << nels_data << "], report bug to developers");
+			/*For the P0 implementation*/
+			/*If we fall outside of the convex or outside of the mesh, return NaN*/
+			if(tb.det<0 || reft[it]<0){
+				for (j=0;j<N_data;j++){
+					data_interp[i*N_data+j]=NAN;
 				}
-				data_interp[i*N_data+j]=data[N_data*it+j];
 			}
+			else{
+				if(it<0 || it>=nels_data){
+					_error_("Triangle number " << it << " not in [0 " << nels_data
+								<< "], report bug to developers (interpolation point: " <<x_interp[i]<<" "<<y_interp[i]<<")");
+				}
+				for (j=0;j<N_data;j++){
+
+					data_interp[i*N_data+j]=data[N_data*it+j];
+				}
+			}
 		}
 	}
 	//if(N_interp>=100) _printf_("\r      interpolation progress: "<<fixed<<setw(6)<<setprecision(2)<<100.<<"%  \n");

Modified: issm/trunk/src/c/modules/IoModelToConstraintsx/IoModelToConstraintsx.cpp
===================================================================
--- issm/trunk/src/c/modules/IoModelToConstraintsx/IoModelToConstraintsx.cpp	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/modules/IoModelToConstraintsx/IoModelToConstraintsx.cpp	2016-04-13 04:32:01 UTC (rev 20500)
@@ -28,9 +28,30 @@
 	/*Clean up*/
 	xDelete<IssmDouble>(spcdata);
 }
+void IoModelToDynamicConstraintsx(Constraints* constraints,IoModel* iomodel,int vector_enum,int analysis_type,int finite_element,int dof){
 
-void IoModelToConstraintsx(Constraints* constraints,IoModel* iomodel,IssmDouble* spcdata,int M,int N,int analysis_type,int finite_element,int dof){
+	/*intermediary: */
+	int         code,vector_layout;
+	IssmDouble *spcdata = NULL;
+	int         M,N;
 
+	/*First of, find the record for the enum, and get code  of data type: */
+	iomodel->SetFilePointerToData(&code, &vector_layout,vector_enum);
+	if(code!=7)_error_("expecting a IssmDouble vector for constraints with enum " << EnumToStringx(vector_enum));
+	if(vector_layout!=1)_error_("expecting a nodal vector for constraints with enum " << EnumToStringx(vector_enum));
+
+	/*Fetch vector:*/
+	iomodel->FetchData(&spcdata,&M,&N,vector_enum);
+
+	/*Call IoModelToConstraintsx*/
+	IoModelToDynamicConstraintsx(constraints,iomodel,spcdata,M,N,analysis_type,finite_element,dof);
+
+	/*Clean up*/
+	xDelete<IssmDouble>(spcdata);
+}
+
+void IoModelToConstraintsx(Constraints* constraints,IoModel* iomodel,IssmDouble* spcdata,int M,int N,int analysis_type,int finite_element,int dof){/*{{{*/
+
 	/*intermediary: */
 	int         i,j,count,elementnbv,numfacevertices;
 	IssmDouble  value;
@@ -536,4 +557,38 @@
 	xDelete<bool>(my_edges);
 	xDelete<bool>(my_faces);
 	xDelete<bool>(boundaryedge);
-}
+}/*}}}*/
+void IoModelToDynamicConstraintsx(Constraints* constraints,IoModel* iomodel,IssmDouble* spcdata,int M,int N,int analysis_type,int finite_element,int dof){/*{{{*/
+
+	/*intermediary: */
+	int i,count;
+
+	switch(finite_element){
+		case P1Enum: 
+			/*Nothing else to do*/
+			break;
+		default:
+			_error_("Finite element "<<EnumToStringx(finite_element)<<" not supported yet");
+	}
+
+	count=0;
+	if(M==iomodel->numberofvertices){
+		switch(finite_element){
+			case P1Enum:
+				for(i=0;i<iomodel->numberofvertices;i++){
+					if((iomodel->my_vertices[i])){
+						if (!xIsNan<IssmDouble>(spcdata[i])){
+							constraints->AddObject(new SpcDynamic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,dof,analysis_type));
+							count++;
+						}
+					}
+				}
+				break;
+			default:
+				_error_("Finite element "<<EnumToStringx(finite_element)<<" not supported yet");
+		}
+	}
+	else{
+		_error_("Size of spc field not supported");
+	}
+}/*}}}*/

Modified: issm/trunk/src/c/modules/IoModelToConstraintsx/IoModelToConstraintsx.h
===================================================================
--- issm/trunk/src/c/modules/IoModelToConstraintsx/IoModelToConstraintsx.h	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/modules/IoModelToConstraintsx/IoModelToConstraintsx.h	2016-04-13 04:32:01 UTC (rev 20500)
@@ -9,5 +9,7 @@
 /* local prototypes: */
 void IoModelToConstraintsx(Constraints* constraints,IoModel* iomodel,int vector_enum,int analysis_type,int finite_element,int dof=0);
 void IoModelToConstraintsx(Constraints* constraints,IoModel* iomodel,IssmDouble* spcdata,int M,int N,int analysis_type,int finite_element,int dof=0);
+void IoModelToDynamicConstraintsx(Constraints* constraints,IoModel* iomodel,int vector_enum,int analysis_type,int finite_element,int dof=0);
+void IoModelToDynamicConstraintsx(Constraints* constraints,IoModel* iomodel,IssmDouble* spcdata,int M,int N,int analysis_type,int finite_element,int dof=0);
 
 #endif  /* _IOMODELTOELEMENTINPUTX_H */

Modified: issm/trunk/src/c/modules/Krigingx/pKrigingx.cpp
===================================================================
--- issm/trunk/src/c/modules/Krigingx/pKrigingx.cpp	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/modules/Krigingx/pKrigingx.cpp	2016-04-13 04:32:01 UTC (rev 20500)
@@ -97,7 +97,7 @@
 
 		/*partition loop across threads: */
 		for(int idx=my_rank;idx<n_interp;idx+=num_procs){
-			_printf0_("      interpolation progress: "<<setw(6)<<setprecision(4)<<double(idx)/double(n_interp)*100.<<"%  \n");
+			_printf0_("      interpolation progress: "<<fixed<<setw(6)<<setprecision(4)<<double(idx)/double(n_interp)*100.<<"%  \n");
 			observations->InterpolationNearestNeighbor(&predictions[idx],x_interp[idx],y_interp[idx],radius);
 		}
 		_printf0_("      interpolation progress: "<<fixed<<setw(6)<<setprecision(4)<<100.<<"%  \n");
@@ -110,7 +110,7 @@
 
 		/*partition loop across threads: */
 		for(int idx=my_rank;idx<n_interp;idx+=num_procs){
-			_printf0_("      interpolation progress: "<<setw(6)<<setprecision(4)<<double(idx)/double(n_interp)*100.<<"%  \n");
+			_printf0_("      interpolation progress: "<<fixed<<setw(6)<<setprecision(4)<<double(idx)/double(n_interp)*100.<<"%  \n");
 			observations->Distances(&predictions[idx],&x_interp[idx],&y_interp[idx],1,radius);
 		}
 		_printf0_("      interpolation progress: "<<fixed<<setw(6)<<setprecision(4)<<100.<<"%  \n");
@@ -125,7 +125,7 @@
 
 		/*partition loop across threads: */
 		for(int idx=my_rank;idx<n_interp;idx+=num_procs){
-			_printf0_("      interpolation progress: "<<setw(6)<<setprecision(4)<<double(idx)/double(n_interp)*100.<<"%  \n");
+			_printf0_("      interpolation progress: "<<fixed<<setw(6)<<setprecision(4)<<double(idx)/double(n_interp)*100.<<"%  \n");
 			observations->InterpolationIDW(&predictions[idx],x_interp[idx],y_interp[idx],radius,mindata,maxdata,power);
 		}
 		_printf0_("      interpolation progress: "<<fixed<<setw(6)<<setprecision(4)<<100.<<"%  \n");

Modified: issm/trunk/src/c/modules/MeshProfileIntersectionx/MeshProfileIntersectionx.cpp
===================================================================
--- issm/trunk/src/c/modules/MeshProfileIntersectionx/MeshProfileIntersectionx.cpp	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/modules/MeshProfileIntersectionx/MeshProfileIntersectionx.cpp	2016-04-13 04:32:01 UTC (rev 20500)
@@ -251,7 +251,6 @@
 				IsIdenticalNode(xnodes[2],ynodes[2],xsegment[0],ysegment[0],tolerance)){
 				
 				/*ok, segments[0] is common to one of our vertices: */
-				//if (el==318 && contouri==9){ _printf_("ok1" << "\n"); }
 				coord1=0;
 				if(edge1==IntersectEnum){coord2=alpha1;}
 				if(edge2==IntersectEnum){coord2=beta1;}
@@ -391,7 +390,7 @@
 		}
 
 		//test if the 2 segments have the same middle (->intersects=true)
-		if (O2O1==0){
+		if(O2O1[0]==0 && O2O1[1]){
 			alpha=0; beta=0;
 			*palpha=alpha;*pbeta=beta;
 			return ColinearEnum;

Modified: issm/trunk/src/c/modules/ModelProcessorx/Autodiff/CreateParametersAutodiff.cpp
===================================================================
--- issm/trunk/src/c/modules/ModelProcessorx/Autodiff/CreateParametersAutodiff.cpp	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/modules/ModelProcessorx/Autodiff/CreateParametersAutodiff.cpp	2016-04-13 04:32:01 UTC (rev 20500)
@@ -29,10 +29,49 @@
 	/*retrieve some parameters: */
 	iomodel->Constant(&autodiff_analysis,AutodiffIsautodiffEnum);
 
-	if(autodiff_analysis){
+	#ifdef _HAVE_ADOLC_
+		/*initialize a placeholder to store solver pointers: {{{*/
+		GenericParam<Adolc_edf> *theAdolcEDF_p=new GenericParam<Adolc_edf>(AdolcParamEnum);
 
-		#ifdef _HAVE_ADOLC_
+		/*Solver pointers depend on what type of solver we are implementing: */
+		options=OptionsFromAnalysis(parameters,DefaultAnalysisEnum); //options database is not filled in yet, use default.
+		ToolkitOptions::Init(options);
 
+		switch(IssmSolverTypeFromToolkitOptions()){
+			case MumpsEnum:{
+				#ifdef _HAVE_MUMPS_
+				theAdolcEDF_p->GetParameterValue().myEDF_for_solverx_p=reg_ext_fct(mumpsSolveEDF);
+				#else
+				_error_("requesting mumps solver without MUMPS being compiled in!");
+				#endif
+				break;
+							}
+			case GslEnum: {
+				#ifdef _HAVE_GSL_
+				theAdolcEDF_p->GetParameterValue().myEDF_for_solverx_p=reg_ext_fct(EDF_for_solverx);
+				#else
+				_error_("requesting GSL solver without GSL being compiled in!");
+				#endif
+			    break;
+						  }
+			default:
+				_error_("solver type not supported yet!");
+		}
+
+		// to save some space:
+		// we know we won't use adolc inside of  the solver:
+		theAdolcEDF_p->GetParameterValue().myEDF_for_solverx_p->nestedAdolc=false;
+		// the solution vector is just allocated and doesn't have a meaningful prior value
+		theAdolcEDF_p->GetParameterValue().myEDF_for_solverx_p->dp_y_priorRequired=false;
+		// the solver wrapper makes sure the matrix and the right hand side don't change
+		theAdolcEDF_p->GetParameterValue().myEDF_for_solverx_p->dp_x_changes=false;
+		parameters->AddObject(theAdolcEDF_p);
+
+		/*Free ressources: */
+		xDelete<char>(options);
+		/*}}}*/
+
+	if(autodiff_analysis){
 		/*Copy some parameters from IoModel to parameters dataset: {{{*/
 		parameters->AddObject(iomodel->CopyConstantObject(AutodiffKeepEnum));
 		parameters->AddObject(iomodel->CopyConstantObject(AutodiffObufsizeEnum));
@@ -114,44 +153,6 @@
 		/*Don't forget to copy  iomodel->independent_objects to parameters: */
 		parameters->AddObject(new DataSetParam(AutodiffIndependentObjectsEnum,iomodel->independent_objects));
 		/*}}}*/
-		/*initialize a placeholder to store solver pointers: {{{*/
-		GenericParam<Adolc_edf> *theAdolcEDF_p=new GenericParam<Adolc_edf>(AdolcParamEnum);
-
-		/*Solver pointers depend on what type of solver we are implementing: */
-		options=OptionsFromAnalysis(parameters,DefaultAnalysisEnum); //options database is not filled in yet, use default.
-		ToolkitOptions::Init(options);
-
-		switch(IssmSolverTypeFromToolkitOptions()){
-			case MumpsEnum:{
-				#ifdef _HAVE_MUMPS_
-				theAdolcEDF_p->GetParameterValue().myEDF_for_solverx_p=reg_ext_fct(mumpsSolveEDF);
-				#else
-				_error_("requesting mumps solver without MUMPS being compiled in!");
-				#endif
-				break;
-							}
-			case GslEnum: {
-				#ifdef _HAVE_GSL_
-				theAdolcEDF_p->GetParameterValue().myEDF_for_solverx_p=reg_ext_fct(EDF_for_solverx);
-				#endif
-			    break;
-						  }
-			default:
-				_error_("solver type not supported yet!");
-		}
-
-		// to save some space:
-		// we know we won't use adolc inside of  the solver:
-		theAdolcEDF_p->GetParameterValue().myEDF_for_solverx_p->nestedAdolc=false;
-		// the solution vector is just allocated and doesn't have a meaningful prior value
-		theAdolcEDF_p->GetParameterValue().myEDF_for_solverx_p->dp_y_priorRequired=false;
-		// the solver wrapper makes sure the matrix and the right hand side don't change
-		theAdolcEDF_p->GetParameterValue().myEDF_for_solverx_p->dp_x_changes=false;
-		parameters->AddObject(theAdolcEDF_p);
-
-		/*Free ressources: */
-		xDelete<char>(options);
-		/*}}}*/
+	}
 	#endif
-	}
 }

Modified: issm/trunk/src/c/modules/ModelProcessorx/Control/UpdateElementsAndMaterialsControl.cpp
===================================================================
--- issm/trunk/src/c/modules/ModelProcessorx/Control/UpdateElementsAndMaterialsControl.cpp	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/modules/ModelProcessorx/Control/UpdateElementsAndMaterialsControl.cpp	2016-04-13 04:32:01 UTC (rev 20500)
@@ -31,6 +31,7 @@
 	iomodel->Constant(&domaintype,DomainTypeEnum);
 	for(int i=0;i<num_cost_functions;i++){
 		cost_function= reCast<int,IssmDouble>(iomodel->Data(InversionCostFunctionsEnum)[i]);
+		//iomodel->FetchDataToInput(elements,InversionThicknessObsEnum);
 		if(     cost_function==ThicknessAbsMisfitEnum) iomodel->FetchDataToInput(elements,InversionThicknessObsEnum);
 		else if(cost_function==SurfaceAbsMisfitEnum)   iomodel->FetchDataToInput(elements,InversionSurfaceObsEnum);
 		else if(cost_function==SurfaceAbsVelMisfitEnum

Modified: issm/trunk/src/c/modules/ModelProcessorx/CreateElementsVerticesAndMaterials.cpp
===================================================================
--- issm/trunk/src/c/modules/ModelProcessorx/CreateElementsVerticesAndMaterials.cpp	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/modules/ModelProcessorx/CreateElementsVerticesAndMaterials.cpp	2016-04-13 04:32:01 UTC (rev 20500)
@@ -94,6 +94,8 @@
 
 	/*Fetch data:*/
 	iomodel->FetchData(6,MeshXEnum,MeshYEnum,MeshZEnum,BaseEnum,ThicknessEnum,MaskIceLevelsetEnum);
+	if (iomodel->domaintype == Domain3DsurfaceEnum) iomodel->FetchData(3,MeshLatEnum,MeshLongEnum,MeshREnum);
+	
 	CreateNumberNodeToElementConnectivity(iomodel);
 
 	for(i=0;i<iomodel->numberofvertices;i++){
@@ -102,4 +104,5 @@
 
 	/*Free data: */
 	iomodel->DeleteData(6,MeshXEnum,MeshYEnum,MeshZEnum,BaseEnum,ThicknessEnum,MaskIceLevelsetEnum);
+	if (iomodel->domaintype == Domain3DsurfaceEnum) iomodel->DeleteData(3,MeshLatEnum,MeshLongEnum,MeshREnum);
 }

Modified: issm/trunk/src/c/modules/ModelProcessorx/CreateNodes.cpp
===================================================================
--- issm/trunk/src/c/modules/ModelProcessorx/CreateNodes.cpp	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/modules/ModelProcessorx/CreateNodes.cpp	2016-04-13 04:32:01 UTC (rev 20500)
@@ -62,7 +62,7 @@
 			for(i=0;i<iomodel->numberofelements;i++){
 				if(iomodel->my_elements[i]){
 					node = new Node(id0+iomodel->numberofvertices+i+1,iomodel->numberofvertices+i,lid++,0,iomodel,analysis,approximation);
-					node->Deactivate();
+					node->HardDeactivate();
 					nodes->AddObject(node);
 				}
 			}
@@ -296,7 +296,7 @@
 			for(i=0;i<iomodel->numberofelements;i++){
 				if(iomodel->my_elements[i]){
 					node = new Node(id0+iomodel->numberofvertices+i+1,iomodel->numberofvertices+i,lid++,0,iomodel,analysis,FSvelocityEnum);
-					node->Deactivate();
+					node->HardDeactivate();
 					nodes->AddObject(node);
 				}
 			}

Modified: issm/trunk/src/c/modules/ModelProcessorx/CreateOutputDefinitions.cpp
===================================================================
--- issm/trunk/src/c/modules/ModelProcessorx/CreateOutputDefinitions.cpp	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/modules/ModelProcessorx/CreateOutputDefinitions.cpp	2016-04-13 04:32:01 UTC (rev 20500)
@@ -122,6 +122,40 @@
 				xDelete<int>(misfit_weights_enum_s);
 				/*}}}*/
 			}
+			else if (output_definition_enums[i]==NodalvalueEnum){
+				/*Deal with nodal values: {{{*/
+				
+				/*nodal value variables: */
+				int          numnodalvalues;
+				char**       nodalvalue_name_s             = NULL;    
+				int*         nodalvalue_definitionenums_s             = NULL;    
+				int*         nodalvalue_model_enum_s        = NULL;
+				int*         nodalvalue_node_s = NULL;
+
+				/*Fetch name, model_enum, etc ... (see src/m/classes/nodalvalue.m): */
+				iomodel->FetchMultipleData(&nodalvalue_name_s,&numnodalvalues,NodalvalueNameEnum);
+				iomodel->FetchMultipleData(&nodalvalue_definitionenums_s,&numnodalvalues,NodalvalueDefinitionenumEnum);
+				iomodel->FetchMultipleData(&nodalvalue_model_enum_s,&numnodalvalues,NodalvalueModelEnumEnum);
+				iomodel->FetchMultipleData(&nodalvalue_node_s,&numnodalvalues,NodalvalueNodeEnum);
+
+				for(j=0;j<numnodalvalues;j++){
+
+					/*First create a nodalvalue object for that specific enum (nodalvalue_model_enum_s[j]):*/
+					output_definitions->AddObject(new Nodalvalue(nodalvalue_name_s[j],nodalvalue_definitionenums_s[j],nodalvalue_model_enum_s[j],nodalvalue_node_s[j]-1)); //-1 because matlab to c indexing.
+				}
+					
+				/*Free ressources:*/
+				for(j=0;j<numnodalvalues;j++){
+					char* string=NULL;
+					IssmDouble* matrix = NULL;
+					string = nodalvalue_name_s[j];    xDelete<char>(string);
+				}
+				xDelete<char*>(nodalvalue_name_s);
+				xDelete<int>(nodalvalue_model_enum_s);
+				xDelete<int>(nodalvalue_definitionenums_s);
+				xDelete<int>(nodalvalue_node_s);
+				/*}}}*/
+			}
 			else if (output_definition_enums[i]==MassconEnum){
 				/*Deal with masscons: {{{*/
 				

Modified: issm/trunk/src/c/modules/ModelProcessorx/CreateParameters.cpp
===================================================================
--- issm/trunk/src/c/modules/ModelProcessorx/CreateParameters.cpp	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/modules/ModelProcessorx/CreateParameters.cpp	2016-04-13 04:32:01 UTC (rev 20500)
@@ -21,7 +21,6 @@
 	int         numoutputs,materialtype,smb_model,basalforcing_model;
 	char**      requestedoutputs = NULL;
 	IssmDouble  time;
-	bool        isdelta18o,ismungsm;
 
 	/*parameters for mass flux:*/
 	int          mass_flux_num_profiles     = 0;
@@ -47,6 +46,7 @@
 	parameters->AddObject(iomodel->CopyConstantObject(DomainTypeEnum));
 	parameters->AddObject(iomodel->CopyConstantObject(DomainDimensionEnum));
 	parameters->AddObject(iomodel->CopyConstantObject(SettingsOutputFrequencyEnum));
+	parameters->AddObject(iomodel->CopyConstantObject(SettingsRecordingFrequencyEnum));
 	parameters->AddObject(iomodel->CopyConstantObject(ConstantsYtsEnum));
 	parameters->AddObject(iomodel->CopyConstantObject(TimesteppingStartTimeEnum));
 	parameters->AddObject(iomodel->CopyConstantObject(TimesteppingFinalTimeEnum));
@@ -75,13 +75,15 @@
 		parameters->AddObject(iomodel->CopyConstantObject(GroundinglineMigrationEnum));
 		parameters->AddObject(iomodel->CopyConstantObject(TransientIsstressbalanceEnum));
 		parameters->AddObject(iomodel->CopyConstantObject(TransientIsmasstransportEnum));
+		parameters->AddObject(iomodel->CopyConstantObject(TransientIssmbEnum));
 		parameters->AddObject(iomodel->CopyConstantObject(TransientIsthermalEnum));
 		parameters->AddObject(iomodel->CopyConstantObject(TransientIsgroundinglineEnum));
 		parameters->AddObject(iomodel->CopyConstantObject(TransientIsgiaEnum));
-		parameters->AddObject(iomodel->CopyConstantObject(TransientIslevelsetEnum));
 		parameters->AddObject(iomodel->CopyConstantObject(TransientIsdamageevolutionEnum));
 		parameters->AddObject(iomodel->CopyConstantObject(TransientIshydrologyEnum));
-		parameters->AddObject(iomodel->CopyConstantObject(TransientIscalvingEnum));
+		parameters->AddObject(iomodel->CopyConstantObject(TransientIsmovingfrontEnum));
+		parameters->AddObject(iomodel->CopyConstantObject(TransientIsslrEnum));
+		parameters->AddObject(iomodel->CopyConstantObject(TransientIscouplerEnum));
 		parameters->AddObject(iomodel->CopyConstantObject(MaterialsRheologyLawEnum));
 		parameters->AddObject(iomodel->CopyConstantObject(GiaCrossSectionShapeEnum));
 
@@ -96,71 +98,7 @@
 		 parameters->AddObject(iomodel->CopyConstantObject(MeshNumberoflayersEnum));
 	}
 
-	/*Surface mass balance parameters*/
-	parameters->AddObject(iomodel->CopyConstantObject(SurfaceforcingsEnum));
-	iomodel->Constant(&smb_model,SurfaceforcingsEnum);
-	switch(smb_model){
-		case SMBEnum:
-			/*Nothing to add to parameters*/
-			break;
-		case SMBpddEnum:
-			parameters->AddObject(iomodel->CopyConstantObject(SurfaceforcingsIsdelta18oEnum));
-			parameters->AddObject(iomodel->CopyConstantObject(SurfaceforcingsIsmungsmEnum));
-			parameters->AddObject(iomodel->CopyConstantObject(SurfaceforcingsDesfacEnum));
-			parameters->AddObject(iomodel->CopyConstantObject(SurfaceforcingsS0pEnum));
-			parameters->AddObject(iomodel->CopyConstantObject(SurfaceforcingsS0tEnum));
-			parameters->AddObject(iomodel->CopyConstantObject(SurfaceforcingsRlapsEnum));
-			parameters->AddObject(iomodel->CopyConstantObject(SurfaceforcingsRlapslgmEnum));
-			iomodel->Constant(&isdelta18o,SurfaceforcingsIsdelta18oEnum);
-			iomodel->Constant(&ismungsm,SurfaceforcingsIsmungsmEnum);
-
-			if(ismungsm){
-			  iomodel->FetchData(&temp,&N,&M,SurfaceforcingsPfacEnum); _assert_(N==2);
-			  for(i=0;i<M;i++) temp[M+i]=temp[M+i];
-			  parameters->AddObject(new TransientParam(SurfaceforcingsPfacEnum,&temp[0],&temp[M],M));
-			  iomodel->DeleteData(temp,SurfaceforcingsPfacEnum);
-			
-			  iomodel->FetchData(&temp,&N,&M,SurfaceforcingsTdiffEnum); _assert_(N==2);
-			  for(i=0;i<M;i++) temp[M+i]=temp[M+i];
-			  parameters->AddObject(new TransientParam(SurfaceforcingsTdiffEnum,&temp[0],&temp[M],M));
-			  iomodel->DeleteData(temp,SurfaceforcingsTdiffEnum);
-
-			  iomodel->FetchData(&temp,&N,&M,SurfaceforcingsSealevEnum); _assert_(N==2);
-			  for(i=0;i<M;i++) temp[M+i]=temp[M+i];
-			  parameters->AddObject(new TransientParam(SurfaceforcingsSealevEnum,&temp[0],&temp[M],M));
-			  iomodel->DeleteData(temp,SurfaceforcingsSealevEnum);
-			}
-
-			if(isdelta18o){
-				iomodel->Constant(&yts,ConstantsYtsEnum);
-
-				iomodel->FetchData(&temp,&N,&M,SurfaceforcingsDelta18oEnum); _assert_(N==2);
-				for(i=0;i<M;i++) temp[M+i]=yts*temp[M+i];
-				parameters->AddObject(new TransientParam(SurfaceforcingsDelta18oEnum,&temp[0],&temp[M],M));
-				iomodel->DeleteData(temp,SurfaceforcingsDelta18oEnum);
-
-				iomodel->FetchData(&temp,&N,&M,SurfaceforcingsDelta18oSurfaceEnum); _assert_(N==2);
-				for(i=0;i<M;i++) temp[M+i]=yts*temp[M+i];
-				parameters->AddObject(new TransientParam(SurfaceforcingsDelta18oSurfaceEnum,&temp[0],&temp[M],M));
-				iomodel->DeleteData(temp,SurfaceforcingsDelta18oSurfaceEnum);
-			}
-			break;
-		case SMBgradientsEnum:
-			/*Nothing to add to parameters*/
-			break;
-		case SMBhenningEnum:
-			/*Nothing to add to parameters*/
-			break;
-		case SMBcomponentsEnum:
-			/*Nothing to add to parameters*/
-			break;
-		case SMBmeltcomponentsEnum:
-			/*Nothing to add to parameters*/
-			break;
-		default:
-			_error_("Surface mass balance model "<<EnumToStringx(smb_model)<<" not supported yet");
-	}
-
+	
 	/*Basal forcing parameters*/
 	parameters->AddObject(iomodel->CopyConstantObject(BasalforcingsEnum));
 	iomodel->Constant(&basalforcing_model,BasalforcingsEnum);
@@ -173,6 +111,25 @@
 			parameters->AddObject(iomodel->CopyConstantObject(BasalforcingsDeepwaterElevationEnum));
 			parameters->AddObject(iomodel->CopyConstantObject(BasalforcingsUpperwaterElevationEnum));
 			break;
+		case MismipFloatingMeltRateEnum:
+			parameters->AddObject(iomodel->CopyConstantObject(BasalforcingsMeltrateFactorEnum));
+			parameters->AddObject(iomodel->CopyConstantObject(BasalforcingsThresholdThicknessEnum));
+			parameters->AddObject(iomodel->CopyConstantObject(BasalforcingsUpperdepthMeltEnum));
+			break;
+		case MantlePlumeGeothermalFluxEnum:
+			parameters->AddObject(iomodel->CopyConstantObject(BasalforcingsMantleconductivityEnum));
+			parameters->AddObject(iomodel->CopyConstantObject(BasalforcingsNusseltEnum));
+			parameters->AddObject(iomodel->CopyConstantObject(BasalforcingsDtbgEnum));
+			parameters->AddObject(iomodel->CopyConstantObject(BasalforcingsPlumeradiusEnum));
+			parameters->AddObject(iomodel->CopyConstantObject(BasalforcingsTopplumedepthEnum));
+			parameters->AddObject(iomodel->CopyConstantObject(BasalforcingsBottomplumedepthEnum));
+			parameters->AddObject(iomodel->CopyConstantObject(BasalforcingsPlumexEnum));
+			parameters->AddObject(iomodel->CopyConstantObject(BasalforcingsPlumeyEnum));
+			parameters->AddObject(iomodel->CopyConstantObject(BasalforcingsCrustthicknessEnum));
+			parameters->AddObject(iomodel->CopyConstantObject(BasalforcingsUppercrustthicknessEnum));
+			parameters->AddObject(iomodel->CopyConstantObject(BasalforcingsUppercrustheatEnum));
+			parameters->AddObject(iomodel->CopyConstantObject(BasalforcingsLowercrustheatEnum));
+			break;
 		default:
 			_error_("Basal forcing model "<<EnumToStringx(smb_model)<<" not supported yet");
 	}
@@ -182,7 +139,7 @@
 
 	iomodel->Constant(&time,TimesteppingStartTimeEnum);
 	parameters->AddObject(new DoubleParam(TimeEnum,time));  
-	parameters->AddObject(new IntParam(StepEnum,1));  
+	parameters->AddObject(new IntParam(StepEnum,0));  
 
 	/*By default, save all results*/
 	parameters->AddObject(new BoolParam(SaveResultsEnum,true));

Modified: issm/trunk/src/c/modules/ModelProcessorx/ModelProcessorx.cpp
===================================================================
--- issm/trunk/src/c/modules/ModelProcessorx/ModelProcessorx.cpp	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/modules/ModelProcessorx/ModelProcessorx.cpp	2016-04-13 04:32:01 UTC (rev 20500)
@@ -58,9 +58,12 @@
 		/* Update counters, because we have created more nodes, loads and
 		 * constraints, and ids for objects created in next call to CreateDataSets
 		 * will need to start at the end of the updated counters: */
-		iomodel->nodecounter       = nodes->MaximumId();
+		if(nodes->Size()) iomodel->nodecounter = nodes->MaximumId();
 		iomodel->loadcounter       = loads->NumberOfLoads();
 		iomodel->constraintcounter = constraints->NumberOfConstraints();
+
+		/*Make sure nodecounter is at least 0 (if no node exists, maxid will be -1*/
+		_assert_(iomodel->nodecounter>=0);
 	}
 
 	/*Solution specific updates*/

Modified: issm/trunk/src/c/modules/NodalValuex/NodalValuex.cpp
===================================================================
--- issm/trunk/src/c/modules/NodalValuex/NodalValuex.cpp	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/modules/NodalValuex/NodalValuex.cpp	2016-04-13 04:32:01 UTC (rev 20500)
@@ -11,13 +11,16 @@
 
 	IssmDouble value;
 	int        index;
-	int        found,sumfound,cpu_found;
+	int        found,sumfound,cpu_found,cpu;
 
 	/*retrieve element we are interested in: */
 	parameters->FindParam(&index,IndexEnum);
 
 	/*This is the vertex id for which we want to collect the data. Go through elements, and for each 
 	 *element, figure out  if they hold the vertex, and the data. If so, return it: */
+	cpu_found=-1;
+	found=0;
+	
 	for(int i=0;i<elements->Size();i++){
 		Element* element=xDynamicCast<Element*>(elements->GetObjectByOffset(i));
 		found=element->NodalValue(&value,index,natureofdataenum);
@@ -29,11 +32,11 @@
 
 	/*Broadcast whether we found the element: */
 	ISSM_MPI_Allreduce(&found,&sumfound,1,ISSM_MPI_INT,ISSM_MPI_SUM,IssmComm::GetComm());
-	if(!sumfound)_error_("could not find element with vertex with id" << index << " to compute nodal value " << EnumToStringx(natureofdataenum));
+	if(!sumfound)_error_("could not find element with vertex with id " << index << " to compute nodal value " << EnumToStringx(natureofdataenum));
 
 	/*Broadcast and plug into response: */
-	ISSM_MPI_Allreduce ( &cpu_found,&cpu_found,1,ISSM_MPI_INT,ISSM_MPI_MAX,IssmComm::GetComm());
-	ISSM_MPI_Bcast(&value,1,ISSM_MPI_DOUBLE,cpu_found,IssmComm::GetComm()); 
+	ISSM_MPI_Allreduce ( &cpu_found,&cpu,1,ISSM_MPI_INT,ISSM_MPI_MAX,IssmComm::GetComm());
+	ISSM_MPI_Bcast(&value,1,ISSM_MPI_DOUBLE,cpu,IssmComm::GetComm()); 
 
 	*pnodalvalue=value;
 }

Modified: issm/trunk/src/c/modules/OutputResultsx/OutputResultsx.cpp
===================================================================
--- issm/trunk/src/c/modules/OutputResultsx/OutputResultsx.cpp	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/modules/OutputResultsx/OutputResultsx.cpp	2016-04-13 04:32:01 UTC (rev 20500)
@@ -41,7 +41,7 @@
 	if(my_rank==0){
 		femmodel->parameters->FindParam(&solutiontype,SolutionTypeEnum);
 		EnumToStringx(&solutiontypestring,solutiontype);
-		femmodel->results->AddResult(new GenericExternalResult<char*>(femmodel->results->Size()+1,SolutionTypeEnum,solutiontypestring,1));
+		femmodel->results->AddResult(new GenericExternalResult<char*>(femmodel->results->Size()+1,SolutionTypeEnum,solutiontypestring));
 		xDelete<char>(solutiontypestring);
 	}
 

Modified: issm/trunk/src/c/modules/SetActiveNodesLSMx/SetActiveNodesLSMx.cpp
===================================================================
--- issm/trunk/src/c/modules/SetActiveNodesLSMx/SetActiveNodesLSMx.cpp	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/modules/SetActiveNodesLSMx/SetActiveNodesLSMx.cpp	2016-04-13 04:32:01 UTC (rev 20500)
@@ -26,7 +26,9 @@
 		IssmDouble *mask     = xNew<IssmDouble>(numnodes);
 		// include switch for elements with multiple different sets of nodes
 		switch(element->GetElementType()){
-			case MINIEnum:case TaylorHoodEnum:{
+			case MINIEnum:case MINIcondensedEnum:
+			case TaylorHoodEnum:case XTaylorHoodEnum:case LATaylorHoodEnum:
+			case CrouzeixRaviartEnum:case LACrouzeixRaviartEnum:case OneLayerP4zEnum:{
 				Input* input=element->GetInput(IceMaskNodeActivationEnum);
 				if(!input) _error_("Input " << EnumToStringx(IceMaskNodeActivationEnum) << " not found in element");
 
@@ -48,38 +50,6 @@
 				break;
 		}
 
-		/* if solving 2d problem on vertically extende mesh, solve on basal layer only*/
-		if(domaintype!=Domain2DhorizontalEnum){
-			femmodel->parameters->FindParam(&analysis_type,AnalysisTypeEnum);
-			if(
-					analysis_type==FreeSurfaceBaseAnalysisEnum || 
-					analysis_type==MasstransportAnalysisEnum || 
-					analysis_type==MeltingAnalysisEnum || 
-					analysis_type==L2ProjectionBaseAnalysisEnum || 
-					analysis_type==BalancethicknessAnalysisEnum ||
-					analysis_type==HydrologyDCInefficientAnalysisEnum ||
-					//analysis_type==DamageEvolutionAnalysisEnum || 
-					analysis_type==HydrologyDCEfficientAnalysisEnum ||
-					analysis_type==LevelsetAnalysisEnum ||
-					analysis_type==ExtrapolationAnalysisEnum
-					){ solvein2d=true;}
-
-			if(analysis_type==StressbalanceAnalysisEnum){
-				bool isSIA,isSSA;
-				femmodel->parameters->FindParam(&isSIA,FlowequationIsSIAEnum);
-				femmodel->parameters->FindParam(&isSSA,FlowequationIsSSAEnum);
-				if(isSIA || isSSA)
-					solvein2d=true;
-			}
-
-			if(solvein2d){
-				IssmDouble *mask_isonbase = xNew<IssmDouble>(numnodes);
-				element->GetInputListOnNodes(&mask_isonbase[0],MeshVertexonbaseEnum);
-				for(in=0;in<numnodes;in++)	 mask[in]*=mask_isonbase[in];
-				xDelete<IssmDouble>(mask_isonbase);
-			}
-		}
-
 		for(in=0;in<numnodes;in++){
 			Node* node=element->GetNode(in);
 			if(mask[in]==1.){

Modified: issm/trunk/src/c/modules/SurfaceMassBalancex/SurfaceMassBalancex.cpp
===================================================================
--- issm/trunk/src/c/modules/SurfaceMassBalancex/SurfaceMassBalancex.cpp	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/modules/SurfaceMassBalancex/SurfaceMassBalancex.cpp	2016-04-13 04:32:01 UTC (rev 20500)
@@ -6,56 +6,7 @@
 #include "../../shared/shared.h"
 #include "../../toolkits/toolkits.h"
 
-void SurfaceMassBalancex(FemModel* femmodel){/*{{{*/
 
-	/*Intermediaties*/
-	int  smb_model;
-	bool isdelta18o,ismungsm;
-
-	/*First, get SMB model from parameters*/
-	femmodel->parameters->FindParam(&smb_model,SurfaceforcingsEnum);
-
-	/*branch to correct module*/
-	switch(smb_model){
-		case SMBEnum:
-			/*Nothing to be done*/
-			break;
-		case SMBpddEnum:
-			femmodel->parameters->FindParam(&isdelta18o,SurfaceforcingsIsdelta18oEnum);
-			femmodel->parameters->FindParam(&ismungsm,SurfaceforcingsIsmungsmEnum);
-			if(isdelta18o){
-				if(VerboseSolution()) _printf0_("   call Delta18oParameterization module\n");
-				Delta18oParameterizationx(femmodel);
-			} 
-			if(ismungsm){
-				if(VerboseSolution()) _printf0_("   call MungsmtpParameterization module\n");
-				MungsmtpParameterizationx(femmodel);
-			} 
-			if(VerboseSolution()) _printf0_("   call positive degree day module\n");
-			PositiveDegreeDayx(femmodel);
-			break;
-		case SMBgradientsEnum:
-			if(VerboseSolution())_printf0_("	call smb gradients module\n");
-			SmbGradientsx(femmodel);
-			break;
-		case SMBhenningEnum:
-			if(VerboseSolution())_printf0_("  call smb Henning module\n");
-			SmbHenningx(femmodel);
-			break;
-		case SMBcomponentsEnum:
-			if(VerboseSolution())_printf0_("  call smb Components module\n");
-			SmbComponentsx(femmodel);
-			break;
-		case SMBmeltcomponentsEnum:
-			if(VerboseSolution())_printf0_("  call smb Melt Components module\n");
-			SmbMeltComponentsx(femmodel);
-			break;
-		default:
-			_error_("Surface mass balance model "<<EnumToStringx(smb_model)<<" not supported yet");
-	}
-
-}/*}}}*/
-
 void SmbGradientsx(FemModel* femmodel){/*{{{*/
 
 	// void SurfaceMassBalancex(hd,agd,ni){
@@ -80,10 +31,10 @@
 		IssmDouble* smb         = xNew<IssmDouble>(numvertices);
 
 		/*Recover SmbGradients*/
-		element->GetInputListOnVertices(Href,SurfaceforcingsHrefEnum);
-		element->GetInputListOnVertices(Smbref,SurfaceforcingsSmbrefEnum);
-		element->GetInputListOnVertices(b_pos,SurfaceforcingsBPosEnum);
-		element->GetInputListOnVertices(b_neg,SurfaceforcingsBNegEnum);
+		element->GetInputListOnVertices(Href,SmbHrefEnum);
+		element->GetInputListOnVertices(Smbref,SmbSmbrefEnum);
+		element->GetInputListOnVertices(b_pos,SmbBPosEnum);
+		element->GetInputListOnVertices(b_neg,SmbBNegEnum);
 
 		/*Recover surface elevation at vertices: */
 		element->GetInputListOnVertices(s,SurfaceEnum);
@@ -104,7 +55,7 @@
 		}  //end of the loop over the vertices
 
 		/*Add input to element and Free memory*/
-		element->AddInput(SurfaceforcingsMassBalanceEnum,smb,P1Enum);
+		element->AddInput(SmbMassBalanceEnum,smb,P1Enum);
 		xDelete<IssmDouble>(Href);
 		xDelete<IssmDouble>(Smbref);
 		xDelete<IssmDouble>(b_pos);
@@ -130,6 +81,14 @@
 	}
 
 }/*}}}*/
+void Delta18opdParameterizationx(FemModel* femmodel){/*{{{*/
+
+	for(int i=0;i<femmodel->elements->Size();i++){
+		Element* element=xDynamicCast<Element*>(femmodel->elements->GetObjectByOffset(i));
+		element->Delta18opdParameterization();
+	}
+
+}/*}}}*/
 void PositiveDegreeDayx(FemModel* femmodel){/*{{{*/
 
 	// void PositiveDegreeDayx(hd,vTempsea,vPrec,agd,Tsurf,ni){
@@ -166,7 +125,7 @@
 	pds=xNew<IssmDouble>(NPDCMAX+1); 
 
 	// Get ismungsm parameter
-	femmodel->parameters->FindParam(&ismungsm,SurfaceforcingsIsmungsmEnum);
+	femmodel->parameters->FindParam(&ismungsm,SmbIsmungsmEnum);
 
 	/* initialize PDD (creation of a lookup table)*/
 	tstep    = 0.1;
@@ -258,7 +217,7 @@
 		IssmDouble* smblistref  = xNew<IssmDouble>(numvertices);
 		IssmDouble* smblist     = xNew<IssmDouble>(numvertices);
 		element->GetInputListOnVertices(surfacelist,SurfaceEnum);
-		element->GetInputListOnVertices(smblistref,SurfaceforcingsSmbrefEnum);
+		element->GetInputListOnVertices(smblistref,SmbSmbrefEnum);
 
 		/*Loop over all vertices of element and correct SMB as a function of altitude z*/
 		for(int v=0;v<numvertices;v++){
@@ -290,7 +249,7 @@
 		}
 
 		/*Add input to element and Free memory*/
-		element->AddInput(SurfaceforcingsMassBalanceEnum,smblist,P1Enum);
+		element->AddInput(SmbMassBalanceEnum,smblist,P1Enum);
 		xDelete<IssmDouble>(surfacelist);
 		xDelete<IssmDouble>(smblistref);
 		xDelete<IssmDouble>(smblist);
@@ -319,9 +278,9 @@
 		IssmDouble* smb         = xNew<IssmDouble>(numvertices);
 
 		/*Recover Smb Components*/
-		element->GetInputListOnVertices(acc,SurfaceforcingsAccumulationEnum);
-		element->GetInputListOnVertices(evap,SurfaceforcingsEvaporationEnum);
-		element->GetInputListOnVertices(runoff,SurfaceforcingsRunoffEnum);
+		element->GetInputListOnVertices(acc,SmbAccumulationEnum);
+		element->GetInputListOnVertices(evap,SmbEvaporationEnum);
+		element->GetInputListOnVertices(runoff,SmbRunoffEnum);
 
 		// loop over all vertices
 		for(v=0;v<numvertices;v++){
@@ -329,7 +288,7 @@
 		}  //end of the loop over the vertices
 
 		/*Add input to element and Free memory*/
-		element->AddInput(SurfaceforcingsMassBalanceEnum,smb,P1Enum);
+		element->AddInput(SmbMassBalanceEnum,smb,P1Enum);
 		xDelete<IssmDouble>(acc);
 		xDelete<IssmDouble>(evap);
 		xDelete<IssmDouble>(runoff);
@@ -361,10 +320,10 @@
 		IssmDouble* smb         = xNew<IssmDouble>(numvertices);
 
 		/*Recover Smb Components*/
-		element->GetInputListOnVertices(acc,SurfaceforcingsAccumulationEnum);
-		element->GetInputListOnVertices(evap,SurfaceforcingsEvaporationEnum);
-		element->GetInputListOnVertices(melt,SurfaceforcingsMeltEnum);
-		element->GetInputListOnVertices(refreeze,SurfaceforcingsRefreezeEnum);
+		element->GetInputListOnVertices(acc,SmbAccumulationEnum);
+		element->GetInputListOnVertices(evap,SmbEvaporationEnum);
+		element->GetInputListOnVertices(melt,SmbMeltEnum);
+		element->GetInputListOnVertices(refreeze,SmbRefreezeEnum);
 
 		// loop over all vertices
 		for(v=0;v<numvertices;v++){
@@ -372,7 +331,7 @@
 		}  //end of the loop over the vertices
 
 		/*Add input to element and Free memory*/
-		element->AddInput(SurfaceforcingsMassBalanceEnum,smb,P1Enum);
+		element->AddInput(SmbMassBalanceEnum,smb,P1Enum);
 		xDelete<IssmDouble>(acc);
 		xDelete<IssmDouble>(evap);
 		xDelete<IssmDouble>(melt);

Modified: issm/trunk/src/c/modules/SurfaceMassBalancex/SurfaceMassBalancex.h
===================================================================
--- issm/trunk/src/c/modules/SurfaceMassBalancex/SurfaceMassBalancex.h	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/modules/SurfaceMassBalancex/SurfaceMassBalancex.h	2016-04-13 04:32:01 UTC (rev 20500)
@@ -12,9 +12,22 @@
 void SmbGradientsx(FemModel* femmodel);
 void Delta18oParameterizationx(FemModel* femmodel);
 void MungsmtpParameterizationx(FemModel* femmodel);
+void Delta18opdParameterizationx(FemModel* femmodel);
 void PositiveDegreeDayx(FemModel* femmodel);
 void SmbHenningx(FemModel* femmodel);
 void SmbComponentsx(FemModel* femmodel);
-void SmbMeltComponentsx(FemModel* femmodel);
+void SmbMeltComponentsx(FemModel* femmodel); 
 
+/*GEMB: */
+void       Gembx(FemModel* femmodel);
+void       GembgridInitialize(IssmDouble** pdz, int* psize, IssmDouble zTop, IssmDouble dzTop, IssmDouble zMax, IssmDouble zY); 
+IssmDouble Marbouty(IssmDouble T, IssmDouble d, IssmDouble dT);
+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* d, IssmDouble cldFrac, IssmDouble aIce, IssmDouble aSnow, IssmDouble* T, IssmDouble* W, IssmDouble P, IssmDouble EC, IssmDouble t0wet, IssmDouble t0dry, IssmDouble K, IssmDouble dt,int m, int sid);
+void shortwave(IssmDouble** pswf, int swIdx, int aIdx, IssmDouble dsw, IssmDouble as, IssmDouble* d, IssmDouble* dz, IssmDouble* re, int m, int sid);
+void thermo(IssmDouble* pEC, IssmDouble* T, IssmDouble* dz, IssmDouble* d, IssmDouble* swf, IssmDouble dlw, IssmDouble Ta, IssmDouble V, IssmDouble eAir, IssmDouble pAir, IssmDouble Ws, IssmDouble dt0, int m, IssmDouble Vz, IssmDouble Tz, int sid);
+void accumulation(IssmDouble** pT, IssmDouble** pdz, IssmDouble** pd, IssmDouble** pW, IssmDouble** pa, IssmDouble** pre, IssmDouble** pgdn, IssmDouble** pgsp, int* pm, IssmDouble Ta, IssmDouble P, IssmDouble dzMin, IssmDouble aSnow, int sid); 
+void melt(IssmDouble* pM, IssmDouble* pR, IssmDouble* pmAdd, IssmDouble** pT, IssmDouble** pd, IssmDouble** pdz, IssmDouble** pW, IssmDouble** pa, IssmDouble** pre, IssmDouble** pgdn, IssmDouble** pgsp, int* pn, IssmDouble dzMin, IssmDouble zMax, IssmDouble zMin, int sid);
+void densification(IssmDouble* d,IssmDouble* dz, IssmDouble* T, IssmDouble* re, int denIdx, IssmDouble C, IssmDouble dt, IssmDouble Tmean,IssmDouble rho_ice,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, int sid);
 #endif  /* _SurfaceMassBalancex_H*/

Modified: issm/trunk/src/c/modules/TriMeshx/TriMeshx.cpp
===================================================================
--- issm/trunk/src/c/modules/TriMeshx/TriMeshx.cpp	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/modules/TriMeshx/TriMeshx.cpp	2016-04-13 04:32:01 UTC (rev 20500)
@@ -10,11 +10,9 @@
 #if defined(_HAVE_TRIANGLE_)
 	#ifndef ANSI_DECLARATORS
 	#define ANSI_DECLARATORS
+	#endif
 	#include "triangle.h"
 	#undef ANSI_DECLARATORS
-	#else
-	#include "triangle.h"
-	#endif
 #endif
 /*}}}*/
 

Modified: issm/trunk/src/c/modules/VertexCoordinatesx/VertexCoordinatesx.cpp
===================================================================
--- issm/trunk/src/c/modules/VertexCoordinatesx/VertexCoordinatesx.cpp	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/modules/VertexCoordinatesx/VertexCoordinatesx.cpp	2016-04-13 04:32:01 UTC (rev 20500)
@@ -8,7 +8,7 @@
 #include "../../shared/shared.h"
 #include "../../toolkits/toolkits.h"
 
-void VertexCoordinatesx( IssmDouble** px, IssmDouble** py, IssmDouble** pz, Vertices* vertices) {
+void VertexCoordinatesx( IssmDouble** px, IssmDouble** py, IssmDouble** pz, Vertices* vertices,bool spherical) {
 
 	/*output: */
 	IssmDouble* x=NULL;
@@ -33,7 +33,7 @@
 	/*march through our vertices: */
 	for(i=0;i<vertices->Size();i++){
 		Vertex* vertex=(Vertex*)vertices->GetObjectByOffset(i);
-		vertex->VertexCoordinates(vx,vy,vz);
+		vertex->VertexCoordinates(vx,vy,vz,spherical);
 	}
 
 	/*Assemble*/

Modified: issm/trunk/src/c/modules/VertexCoordinatesx/VertexCoordinatesx.h
===================================================================
--- issm/trunk/src/c/modules/VertexCoordinatesx/VertexCoordinatesx.h	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/modules/VertexCoordinatesx/VertexCoordinatesx.h	2016-04-13 04:32:01 UTC (rev 20500)
@@ -7,6 +7,6 @@
 #include "../../classes/classes.h"
 
 /* local prototypes: */
-void VertexCoordinatesx( IssmDouble** px, IssmDouble** py, IssmDouble** pz, Vertices* vertices);
+void VertexCoordinatesx( IssmDouble** px, IssmDouble** py, IssmDouble** pz, Vertices* vertices,bool spherical=false);
 
 #endif  /* _VERTEX_COORDINATESX_H */

Modified: issm/trunk/src/c/modules/modules.h
===================================================================
--- issm/trunk/src/c/modules/modules.h	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/modules/modules.h	2016-04-13 04:32:01 UTC (rev 20500)
@@ -19,9 +19,12 @@
 #include "./ControlInputSetGradientx/ControlInputSetGradientx.h"
 #include "./CreateNodalConstraintsx/CreateNodalConstraintsx.h"
 #include "./CreateJacobianMatrixx/CreateJacobianMatrixx.h"
+#include "./Damagex/Damagex.h"
 #include "./DragCoefficientAbsGradientx/DragCoefficientAbsGradientx.h"
+#include "./DistanceToMaskBoundaryx/DistanceToMaskBoundaryx.h"
 #include "./ExpToLevelSetx/ExpToLevelSetx.h"
 #include "./ElementConnectivityx/ElementConnectivityx.h"
+#include "./GeothermalFluxx/GeothermalFluxx.h"
 #include "./GetSolutionFromInputsx/GetSolutionFromInputsx.h"
 #include "./GetVectorFromInputsx/GetVectorFromInputsx.h"
 #include "./GetVectorFromControlInputsx/GetVectorFromControlInputsx.h"

Modified: issm/trunk/src/c/shared/Elements/ComputeMungsmTemperaturePrecipitation.cpp
===================================================================
--- issm/trunk/src/c/shared/Elements/ComputeMungsmTemperaturePrecipitation.cpp	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/shared/Elements/ComputeMungsmTemperaturePrecipitation.cpp	2016-04-13 04:32:01 UTC (rev 20500)
@@ -20,7 +20,7 @@
     tdiffh = TdiffTime*( TemperaturesLgm[imonth] - TemperaturesPresentday[imonth] );
     monthlytemperaturestmp[imonth] = tdiffh + TemperaturesPresentday[imonth] ;
 
-    monthlyprectmp[imonth] =min(1.5, PrecipitationsPresentday[imonth] * pow(PrecipitationsLgm[imonth],PfacTime));   // [m/month]
+    monthlyprectmp[imonth] =min(1.5, PrecipitationsPresentday[imonth] * pow(PrecipitationsLgm[imonth],PfacTime));   // [m/yr]
 
     /*Assign output pointer*/
     *(monthlytemperaturesout+imonth) = monthlytemperaturestmp[imonth];

Modified: issm/trunk/src/c/shared/Elements/LliboutryDuval.cpp
===================================================================
--- issm/trunk/src/c/shared/Elements/LliboutryDuval.cpp	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/shared/Elements/LliboutryDuval.cpp	2016-04-13 04:32:01 UTC (rev 20500)
@@ -8,7 +8,10 @@
 
 /* get ice stiffness B from enthalpy, pressure and flow law exponent*/
 IssmDouble LliboutryDuval(IssmDouble enthalpy, IssmDouble pressure, IssmDouble n, IssmDouble betaCC, IssmDouble referencetemperature, IssmDouble heatcapacity, IssmDouble latentheat){
-  /*Use parameterization for the rheology: Grewe/Blatter 2009, Aschwanden 2012
+  /*Use Lliboutry & Duval's 1985 parameterization for the rheology: 
+	* see also: Grewe/Blatter 2009, Aschwanden et al. 2012
+	*
+	* ISSM uses enthalpy/temperature values that are not corrected for pressure.
    *
    *  A(H,p) = A0 exp(-Q/RT(H,p)), if H < H_s(p)
    *         = A0 exp(-Q/RTpmp) (1+181.25w(H,p)), if H_s(p) \le H < H_l(p)
@@ -33,45 +36,38 @@
    *     = 8.314
    *  
    *  Convert A to B :  B = A^(-1/n) */
-
 	/*check feasibility*/
-  _assert_(pressure>=0);
-  _assert_(n>0);
-  _assert_(betaCC>=0);
-  _assert_(referencetemperature>=0);
-  _assert_(heatcapacity>0);
-  _assert_(latentheat>0);
+	_assert_(pressure+1.e-4>=0); // deal with pressure instability at ice surface
+	_assert_(n>0);
+	_assert_(betaCC>=0);
+	_assert_(referencetemperature>=0);
+	_assert_(heatcapacity>0);
+	_assert_(latentheat>0);
 
-  /*Some physical constants*/
-  IssmDouble R=8.314; 
+	/*Some physical constants*/
+	IssmDouble R=8.314; 
 
-  /*Intermediaries*/
-  IssmDouble A,B,Tstar,Tpmp,H_sp,waterfraction;
+	/*Intermediaries*/
+	IssmDouble A,B,Tstar,Tpmp,H_sp,waterfraction;
 
-  Tpmp=273.15-betaCC*pressure; 
-  H_sp=heatcapacity*(Tpmp - referencetemperature);
-  if (enthalpy < H_sp){
-    Tstar = referencetemperature + enthalpy/heatcapacity - betaCC*pressure;	
-    waterfraction = 0.;
-  }
-  else{
-    Tstar=Tpmp;
-    waterfraction=(enthalpy - H_sp)/latentheat;
-		if (waterfraction > 0.01)
-			waterfraction = 0.01;
-  }
+	Tpmp=273.15-betaCC*pressure; //pressure melting point temperature
+	H_sp=heatcapacity*(Tpmp-referencetemperature); //pressure melting point enthalpy
+	if (enthalpy<H_sp){ //compute homologous temperature and water fraction
+		Tstar=referencetemperature+enthalpy/heatcapacity+betaCC*pressure; 
+		waterfraction=0.;
+	}
+	else{
+		Tstar=273.15;
+		waterfraction=(enthalpy-H_sp)/latentheat;
+		if (waterfraction>0.01) waterfraction=0.01; // limit softness of ice
+	}
 
-  /*Get A*/
-  if(Tstar<=263.15){
-    A=3.61e-13 * exp(  -6.e+4/(R*Tstar));
-  }
-  else{
-    A=1.73e3   * exp(-13.9e+4/(R*Tstar));
-  }
-  A*=(1. + 181.25*waterfraction);
+	/*Get A*/
+	if(Tstar<=263.15){A=3.61e-13*exp(-6.e+4/(R*Tstar));}
+	else{A=1.73e3*exp(-13.9e+4/(R*Tstar));}
+	A*=(1.+181.25*waterfraction);
 
-  /*Convert to B*/
-  B=pow(A,-1./n);
-
-  return B;
+	/*Convert to B*/
+	B=pow(A,-1./n);
+	return B;
 }

Modified: issm/trunk/src/c/shared/Elements/PddSurfaceMassBalance.cpp
===================================================================
--- issm/trunk/src/c/shared/Elements/PddSurfaceMassBalance.cpp	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/shared/Elements/PddSurfaceMassBalance.cpp	2016-04-13 04:32:01 UTC (rev 20500)
@@ -7,8 +7,8 @@
 #include "../Numerics/numerics.h"
 
 IssmDouble PddSurfaceMassBalance(IssmDouble* monthlytemperatures, IssmDouble* monthlyprec,
-				 IssmDouble* pdds, IssmDouble* pds, IssmDouble signorm,
-				 IssmDouble yts, IssmDouble h, IssmDouble s, IssmDouble desfac,
+				 IssmDouble* pdds, IssmDouble* pds, IssmDouble* melt, IssmDouble* accu, 
+				 IssmDouble signorm, IssmDouble yts, IssmDouble h, IssmDouble s, IssmDouble desfac,
 				 IssmDouble s0t,IssmDouble s0p, IssmDouble rlaps,IssmDouble rlapslgm,
 				 IssmDouble TdiffTime,IssmDouble sealevTime,
 				 IssmDouble rho_water,IssmDouble rho_ice){
@@ -89,135 +89,137 @@
     tstar = monthlytemperatures[imonth];
     Tsurf = tstar*deltm+Tsurf;        
 
-      /*********compute PD ****************/
-      if (tstar < PDup){
-	pd = 1.;
-	if (tstar >= -siglimc){ pd = pds[reCast<int,IssmDouble>(tstar/DT + siglim0c)];}}
-      else { 
-	pd = 0.;}
+    /*********compute PD ****************/
+    if (tstar < PDup){
+      pd = 1.;
+      if (tstar >= -siglimc){ pd = pds[reCast<int,IssmDouble>(tstar/DT + siglim0c)];}}
+    else { 
+      pd = 0.;}
+    
+    /******exp des/elev precip reduction*******/
+    sp=(s-s0p)/1000.-deselcut; // deselev effect is wrt chng in topo
+    if (sp>0.0){q = exp(-desfac*sp);}
+    else {q = 1.0;}
+    
+    qmt= qmt + monthlyprec[imonth]*sconv;  //*sconv to convert in m of ice equivalent per month  
+    qmpt= q*monthlyprec[imonth]*sconv;
+    qmp= qmp + qmpt;
+    qm= qm + qmpt*pd;
 
-      /******exp des/elev precip reduction*******/
-      sp=(s-s0p)/1000.-deselcut; // deselev effect is wrt chng in topo
-      if (sp>0.0){q = exp(-desfac*sp);}
-      else {q = 1.0;}
-
-      qmt= qmt + monthlyprec[imonth]*sconv;  //*sconv to convert in m of ice equivalent per month  
-      qmpt= q*monthlyprec[imonth]*sconv;           
-      qmp= qmp + qmpt;
-      qm= qm + qmpt*pd;
-
-      /*********compute PDD************/
-      // ndd(month)=-(tstar-pdd(month)) since ndd+pdd gives expectation of
-      // gaussian=T_m, so ndd=-(Tsurf-pdd)
-      if (iqj>5 && iqj<9){ Tsum=Tsum+tstar;} 
-
-      if (tstar >= siglim) {pdd = pdd + tstar*deltm;}
-      else if (tstar> -siglim){
-	pddsig=pdds[reCast<int,IssmDouble>(tstar/DT + siglim0)];
-	pdd = pdd + pddsig*deltm;
-	frzndd = frzndd - (tstar-pddsig)*deltm;}
-      else{frzndd = frzndd - tstar*deltm; }
-
-      /*Assign output pointer*/
-      *(monthlytemperatures+imonth) = monthlytemperatures[imonth];
-      *(monthlyprec+imonth) = monthlyprec[imonth];      
+    /*********compute PDD************/
+    // ndd(month)=-(tstar-pdd(month)) since ndd+pdd gives expectation of
+    // gaussian=T_m, so ndd=-(Tsurf-pdd)
+    if (iqj>5 && iqj<9){ Tsum=Tsum+tstar;} 
+    
+    if (tstar >= siglim) {pdd = pdd + tstar*deltm;}
+    else if (tstar> -siglim){
+      pddsig=pdds[reCast<int,IssmDouble>(tstar/DT + siglim0)];
+      pdd = pdd + pddsig*deltm;
+      frzndd = frzndd - (tstar-pddsig)*deltm;}
+    else{frzndd = frzndd - tstar*deltm; }
+    
+    /*Assign output pointer*/
+    *(monthlytemperatures+imonth) = monthlytemperatures[imonth];
+    *(monthlyprec+imonth) = monthlyprec[imonth];      
   } // end of seasonal loop 
   //******************************************************************
 
-    saccu = qm;
-    prect = qmp;     // total precipitation during 1 year taking into account des. ef.
-    Tsum=Tsum/3;
+  saccu = qm;
+  prect = qmp;     // total precipitation during 1 year taking into account des. ef.
+  Tsum=Tsum/3;
+  
+  /***** determine PDD factors *****/
+  if(Tsum< -1.) {
+    snwmf=2.65*0.001;   //  ablation factor for snow per positive degree day.*0.001 to go from mm to m/ppd
+    smf=17.22*0.001;    //  ablation factor for ice per pdd (Braithwaite 1995 from tarasov 2002)
+  } 
+  else if(Tsum< 10){
+    snwmf = (0.15*Tsum + 2.8)*0.001;
+    smf = (0.0067*pow((10.-Tsum),3) + 8.3)*0.001;
+  }
+  else{
+    snwmf=4.3*0.001;
+    smf=8.3*0.001;
+  }
+  snwmf=0.95*snwmf;
+  smf=0.95*smf;
+  
+  /*****  compute PDD ablation and refreezing *****/
+  pddt = pdd *365;
+  snwm = snwmf*pddt;       // snow that could have been melted in a year
+  hmx2 = min(h,dfrz);   // refreeze active layer max depth: dfrz
+  
+  if(snwm < saccu) {
+    water=prect-saccu + snwm; //water=rain + snowmelt
+    //     l 2.2= capillary factor
+    //     Should refreezing be controlled by frzndd or by mean annual Tsurf?
+    //     dCovrLm concept is of warming of active layer (thickness =d@=1-
+    //     >2m)
+    //     problem with water seepage into ice: should be sealed after
+    //     refreezing
+    //     so everything needs to be predicated on 1 year scale, except for
+    //     thermal
+    //     conductivity through ice
+    //     also, need to account that melt season has low accum, so what's
+    //     going to
+    //     hold the meltwater around for refreezing? And melt-time will have
+    //     low seasonal frzndd
 
-    /***** determine PDD factors *****/
-    if(Tsum< -1.) {
-      snwmf=2.65*0.001;   //  ablation factor for snow per positive degree day.*0.001 to go from mm to m/ppd
-      smf=17.22*0.001;    //  ablation factor for ice per pdd (Braithwaite 1995 from tarasov 2002)
-    } 
-    else if(Tsum< 10){
-      snwmf = (0.15*Tsum + 2.8)*0.001;
-      smf = (0.0067*pow((10.-Tsum),3) + 8.3)*0.001;
-    }
-    else{
-      snwmf=4.3*0.001;
-      smf=8.3*0.001;
-    }
-    snwmf=0.95*snwmf;
-    smf=0.95*smf;
+    //      Superimposed ice :  Pfeffer et al. 1991, Tarasov 2002
 
-    /*****  compute PDD ablation and refreezing *****/
-    pddt = pdd *365;
-    snwm = snwmf*pddt;       // snow that could have been melted in a year
-    hmx2 = min(h,dfrz);   // refreeze active layer max depth: dfrz
+    supice= min(hmx2*CovrLm*frzndd+2.2*(saccu-snwm), water); // superimposed ice
+    supcap=min(2.2*(saccu-snwm),water);
+    runoff=snwm - supice;  //meltwater only, does not include rain
+  }
+  else {  //all snow melted
+    supice= min(hmx2*CovrLm*frzndd, prect );
+    runoff= saccu + smf*(pddt-saccu/snwmf) - supice;
+    supcap=0;
+  }
+  //     pdd melting doesn't cool Tsurf, so ndd refreeze shouldn't warm it
+  //     except pdd melt heat source is atmosphere, while refreeze is
+  //     ground/ice stored interim
+  //     assume pdd=ndd, then melt should equal refreeze and Tsurf should=0
+  //     assume ndd=2*pdd, then all supice is refrozen, but Tsurf should be
+  //     <0
+  //     assume ndd>pdd, little melt => little supice 
+  //     bottom line: compare for Tsurf<0 : supice and no supice case,
+  //     expect Tsurf difference
+  //     except some of cooling flux comes from atmosphere//
+  //     1 dm supice should not raise Tsurf by 1/dCovrLm = 16.675C
+  //     does supice make sense when H< 0.1m? then d=thermoactive ice layer ////
+  //     < 0.1 
 
-    if(snwm < saccu) {
-      water=prect-saccu + snwm; //water=rain + snowmelt
-      //     l 2.2= capillary factor
-      //     Should refreezing be controlled by frzndd or by mean annual Tsurf?
-      //     dCovrLm concept is of warming of active layer (thickness =d@=1-
-      //     >2m)
-      //     problem with water seepage into ice: should be sealed after
-      //     refreezing
-      //     so everything needs to be predicated on 1 year scale, except for
-      //     thermal
-      //     conductivity through ice
-      //     also, need to account that melt season has low accum, so what's
-      //     going to
-      //     hold the meltwater around for refreezing? And melt-time will have
-      //     low seasonal frzndd
+  //     make more sense to just use residual pdd-ndd except that pdd
+  //     residual not clear yet
+  //     frzndd should not be used up by refreezing in snow, so stick in
+  //     supcap.
+  diffndd=0;
+  if (frzndd>0) {
+    diffndd=fsupndd*min((supice-supcap)/dCovrLm ,frzndd);
+    frzndd=frzndd-diffndd;
+  }
+  if(runoff<0){
+    saccu= saccu -runoff;
+    smelt = 0;
+    precrunoff=prect-saccu;
+    //here assume pdd residual is 0, => 
+    Tsurf= max(Tsurf,-frzndd);
+  }
+  else {
+    smelt = runoff;
+    precrunoff=prect-max(0.,supice)-saccu;}
+  //here really need pdd balance, try 0.5 fudge factor?
+  //at least runoff>0 => it's fairly warm, so Tsurf is !<<0,
+  //yet from site plots, can be ice free with Tsurf=-5.5C
+  if(Tsurf<0) {
+    Tsurf= min(Tsurf+fsupT*diffndd , 0.);}
 
-      //      Superimposed ice :  Pfeffer et al. 1991, Tarasov 2002
+  melt[0]=smelt/yts;
+  accu[0]=saccu/yts;
+  B = saccu - smelt;
+  B = B/yts;
+  pddtj=pddt;
 
-      supice= min(hmx2*CovrLm*frzndd+2.2*(saccu-snwm), water); // superimposed ice
-      supcap=min(2.2*(saccu-snwm),water);
-      runoff=snwm - supice;  //meltwater only, does not include rain
-    }
-    else {  //all snow melted
-      supice= min(hmx2*CovrLm*frzndd, prect );
-      runoff= saccu + smf*(pddt-saccu/snwmf) - supice;
-      supcap=0;
-    }
-    //     pdd melting doesn't cool Tsurf, so ndd refreeze shouldn't warm it
-    //     except pdd melt heat source is atmosphere, while refreeze is
-    //     ground/ice stored interim
-    //     assume pdd=ndd, then melt should equal refreeze and Tsurf should=0
-    //     assume ndd=2*pdd, then all supice is refrozen, but Tsurf should be
-    //     <0
-    //     assume ndd>pdd, little melt => little supice 
-    //     bottom line: compare for Tsurf<0 : supice and no supice case,
-    //     expect Tsurf difference
-    //     except some of cooling flux comes from atmosphere//
-    //     1 dm supice should not raise Tsurf by 1/dCovrLm = 16.675C
-    //     does supice make sense when H< 0.1m? then d=thermoactive ice layer ////
-    //     < 0.1 
-
-    //     make more sense to just use residual pdd-ndd except that pdd
-    //     residual not clear yet
-    //     frzndd should not be used up by refreezing in snow, so stick in
-    //     supcap.
-    diffndd=0;
-    if (frzndd>0) {
-      diffndd=fsupndd*min((supice-supcap)/dCovrLm ,frzndd);
-      frzndd=frzndd-diffndd;
-    }
-    if(runoff<0){
-      saccu= saccu -runoff;
-      smelt = 0;
-      precrunoff=prect-saccu;
-      //here assume pdd residual is 0, => 
-      Tsurf= max(Tsurf,-frzndd);
-    }
-    else {
-      smelt = runoff;
-      precrunoff=prect-max(0.,supice)-saccu;}
-    //here really need pdd balance, try 0.5 fudge factor?
-    //at least runoff>0 => it's fairly warm, so Tsurf is !<<0,
-    //yet from site plots, can be ice free with Tsurf=-5.5C
-    if(Tsurf<0) {
-      Tsurf= min(Tsurf+fsupT*diffndd , 0.);}
-
-    B = -smelt+saccu;
-    B = B/yts;
-    pddtj=pddt;
-
   return B;
 }

Modified: issm/trunk/src/c/shared/Elements/elements.h
===================================================================
--- issm/trunk/src/c/shared/Elements/elements.h	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/shared/Elements/elements.h	2016-04-13 04:32:01 UTC (rev 20500)
@@ -13,8 +13,8 @@
 IssmDouble LliboutryDuval(IssmDouble enthalpy, IssmDouble pressure, IssmDouble n, IssmDouble betaCC, IssmDouble referencetemperature, IssmDouble heatcapacity, IssmDouble latentheat);
 // IssmDouble LliboutryDuval(IssmDouble temperature, IssmDouble waterfraction, IssmDouble depth,IssmDouble n);
 IssmDouble PddSurfaceMassBalance(IssmDouble* monthlytemperatures,  IssmDouble* monthlyprec,
-				 IssmDouble* pdds, IssmDouble* pds,IssmDouble signorm, IssmDouble yts,
-				 IssmDouble h, IssmDouble s, IssmDouble desfac,IssmDouble s0t,
+				 IssmDouble* pdds, IssmDouble* pds, IssmDouble* melt, IssmDouble* accu, IssmDouble signorm, 
+				 IssmDouble yts, IssmDouble h, IssmDouble s, IssmDouble desfac,IssmDouble s0t,
 				 IssmDouble s0p, IssmDouble rlaps, IssmDouble rlapslgm,
 				 IssmDouble TdiffTime,IssmDouble sealevTime,
 				 IssmDouble rho_water, IssmDouble rho_ice);
@@ -27,6 +27,9 @@
 					   IssmDouble* PrecipitationsLgm,IssmDouble* PrecipitationsPresentday,
 					   IssmDouble* TemperaturesLgm, IssmDouble* TemperaturesPresentday, 
 					   IssmDouble* monthlytemperaturesout, IssmDouble* monthlyprecout);
+void ComputeD18OTemperaturePrecipitationFromPD(IssmDouble d018,IssmDouble dpermil,
+					       IssmDouble* PrecipitationPresentday,IssmDouble* TemperaturePresentday,
+					       IssmDouble* monthlytemperaturesout, IssmDouble* monthlyprecout);  
 IssmDouble DrainageFunctionWaterfraction(IssmDouble waterfraction, IssmDouble dt=0.);
 IssmDouble StressIntensityIntegralWeight(IssmDouble depth, IssmDouble water_depth, IssmDouble thickness);
 

Modified: issm/trunk/src/c/shared/Enum/EnumDefinitions.h
===================================================================
--- issm/trunk/src/c/shared/Enum/EnumDefinitions.h	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/shared/Enum/EnumDefinitions.h	2016-04-13 04:32:01 UTC (rev 20500)
@@ -7,6 +7,17 @@
 #define _ENUM_DEFINITIONS_
 
 enum definitions{
+	/*General: {{{*/
+	FemModelEnum,
+	/*}}}*/
+	/*Communicators:{{{*/
+	FemModelCommEnum,
+	WorldCommEnum,
+	IcecapToEarthCommEnum,
+	NumModelsEnum,
+	ModelIdEnum,
+	EarthIdEnum,
+	/*}}}*/
 	/*Model fields {{{*/
 	AutodiffIsautodiffEnum, 
 	AutodiffNumDependentsEnum,
@@ -44,12 +55,28 @@
 	BasalforcingsDeepwaterMeltingRateEnum,
 	BasalforcingsDeepwaterElevationEnum,
 	BasalforcingsUpperwaterElevationEnum,
+	BasalforcingsMeltrateFactorEnum,
+	BasalforcingsThresholdThicknessEnum,
+	BasalforcingsUpperdepthMeltEnum,
+	BasalforcingsMantleconductivityEnum,
+	BasalforcingsNusseltEnum,
+	BasalforcingsDtbgEnum,
+	BasalforcingsPlumeradiusEnum,
+	BasalforcingsTopplumedepthEnum,
+	BasalforcingsBottomplumedepthEnum,
+	BasalforcingsPlumexEnum,
+	BasalforcingsPlumeyEnum,
+	BasalforcingsCrustthicknessEnum,
+	BasalforcingsUppercrustthicknessEnum,
+	BasalforcingsUppercrustheatEnum,
+	BasalforcingsLowercrustheatEnum,
 	FloatingMeltRateEnum,
 	LinearFloatingMeltRateEnum,
+	MismipFloatingMeltRateEnum,
+	MantlePlumeGeothermalFluxEnum,
 	BedEnum,
 	BaseEnum,
 	ConstantsGEnum,
-	ConstantsOmegaEnum,
 	ConstantsReferencetemperatureEnum,
 	ConstantsYtsEnum,
 	DependentObjectEnum,
@@ -89,14 +116,17 @@
 	FlowequationVertexEquationEnum,
 	FrictionAsEnum,
 	FrictionCoefficientEnum,
+	FrictionCoefficientcoulombEnum,
 	FrictionPEnum,
 	FrictionQEnum,
 	FrictionMEnum,
 	FrictionCEnum,
 	FrictionLawEnum,
 	FrictionGammaEnum,
+	FrictionFEnum,
 	FrictionWaterLayerEnum,
 	FrictionEffectivePressureEnum,
+	FrictionCouplingEnum,
 	GeometryHydrostaticRatioEnum,
 	HydrologyModelEnum,
 	HydrologyshreveEnum,
@@ -145,6 +175,17 @@
 	HydrologySedimentEnum,
 	HydrologyEfficientEnum,
 	HydrologySedimentKmaxEnum,
+	HydrologysommersEnum,
+	HydrologyHeadEnum,
+	HydrologyGapHeightEnum,
+	HydrologyBumpSpacingEnum,
+	HydrologyBumpHeightEnum,
+	HydrologyEnglacialInputEnum,
+	HydrologyMoulinInputEnum,
+	HydrologyReynoldsEnum,
+	HydrologyNeumannfluxEnum,
+	HydrologySpcheadEnum,
+	HydrologyConductivityEnum,
 	IndependentObjectEnum,
 	InversionControlParametersEnum,
 	InversionControlScalingFactorsEnum,
@@ -177,6 +218,8 @@
 	InversionVyObsEnum,
 	InversionVzObsEnum,
 	MaskIceLevelsetEnum,
+	MaskOceanLevelsetEnum,
+	MaskLandLevelsetEnum,
 	MaterialsBetaEnum,
 	MaterialsHeatcapacityEnum,
 	MaterialsLatentheatEnum,
@@ -198,10 +241,8 @@
 	DamageElementinterpEnum,
 	DamageHealingEnum,
 	DamageStressThresholdEnum,
+	DamageKappaEnum,
 	DamageStabilizationEnum,
-	DamagePenaltyThresholdEnum,
-	DamagePenaltyLockEnum,
-	DamagePenaltyFactorEnum,
 	DamageMaxiterEnum,
 	DamageSpcdamageEnum,
 	DamageMaxDamageEnum,
@@ -215,14 +256,12 @@
 	CalvingCalvingrateEnum,
 	CalvingMeltingrateEnum,
 	CalvingLevermannEnum,
-	CalvingPiEnum,
 	CalvingDevEnum,
 	DefaultCalvingEnum,
 	CalvingRequestedOutputsEnum,
 	CalvinglevermannCoeffEnum,
 	CalvinglevermannMeltingrateEnum,
-	CalvingpiCoeffEnum,
-	CalvingpiMeltingrateEnum,
+	CalvingdevCoeffEnum,
 	CalvingratexEnum,
 	CalvingrateyEnum,
 	CalvingratexAverageEnum,
@@ -241,6 +280,7 @@
 	MaterialsLithosphereDensityEnum,
 	MaterialsMantleShearModulusEnum,
 	MaterialsMantleDensityEnum,
+	MaterialsEarthDensityEnum,
 	MeshAverageVertexConnectivityEnum,
 	MeshElements2dEnum,
 	MeshElementsEnum,
@@ -257,12 +297,17 @@
 	MeshXEnum,
 	MeshYEnum,
 	MeshZEnum,
+	MeshLatEnum,
+	MeshLongEnum,
+	MeshREnum,
 	MeshElementtypeEnum,
+	MeshSegmentsEnum,
 	DomainTypeEnum,
 	DomainDimensionEnum,
 	Domain2DhorizontalEnum,
 	Domain2DverticalEnum,
 	Domain3DEnum,
+	Domain3DsurfaceEnum,
 	MiscellaneousNameEnum, //FIXME: only used by qmu, should not be marshalled (already in queueing script)
 	MasstransportHydrostaticAdjustmentEnum,
 	MasstransportIsfreesurfaceEnum,
@@ -288,12 +333,12 @@
 	SettingsIoGatherEnum,
 	SettingsLowmemEnum,
 	SettingsOutputFrequencyEnum,
+	SettingsRecordingFrequencyEnum,
 	SettingsWaitonlockEnum,
 	DebugProfilingEnum,
 	ProfilingCurrentMemEnum,
 	ProfilingCurrentFlopsEnum,
 	ProfilingSolutionTimeEnum,
-	MaxIterationConvergenceFlagEnum,
 	SteadystateMaxiterEnum,
 	SteadystateNumRequestedOutputsEnum,
 	SteadystateReltolEnum,
@@ -319,6 +364,8 @@
 	TimesteppingTimeAdaptEnum,
 	TimesteppingTimeStepEnum,
 	TimesteppingInterpForcingsEnum,
+	TransientIssmbEnum,
+	TransientIscouplerEnum,
 	TransientIsstressbalanceEnum,
 	TransientIsgroundinglineEnum,
 	TransientIsmasstransportEnum,
@@ -326,7 +373,8 @@
 	TransientIsgiaEnum,
 	TransientIsdamageevolutionEnum,
 	TransientIshydrologyEnum,
-	TransientIscalvingEnum,
+	TransientIsmovingfrontEnum,
+	TransientIsslrEnum,
 	TransientNumRequestedOutputsEnum,
 	TransientRequestedOutputsEnum,
 	PotentialEnum,
@@ -338,45 +386,106 @@
 	BalancethicknessOmegaEnum,
 	BalancethicknessD0Enum,
 	/*}}}*/
-	/*Surfaceforcings{{{*/
-	SurfaceforcingsEnum,
-	SMBEnum,
-	SurfaceforcingsMassBalanceEnum,
-	SMBpddEnum,
-	SurfaceforcingsDelta18oEnum,
-	SurfaceforcingsDelta18oSurfaceEnum,
-	SurfaceforcingsIsdelta18oEnum,
-	SurfaceforcingsIsmungsmEnum,
-	SurfaceforcingsPrecipitationsPresentdayEnum,
-	SurfaceforcingsPrecipitationsLgmEnum,
-	SurfaceforcingsTemperaturesPresentdayEnum,
-	SurfaceforcingsTemperaturesLgmEnum,
-	SurfaceforcingsPrecipitationEnum,
-	SurfaceforcingsDesfacEnum,
-	SurfaceforcingsS0pEnum,
-	SurfaceforcingsS0tEnum,
-	SurfaceforcingsRlapsEnum,
-	SurfaceforcingsRlapslgmEnum,
-	SurfaceforcingsPfacEnum,
-	SurfaceforcingsTdiffEnum,
-	SurfaceforcingsSealevEnum,
+	/*Smb{{{*/
+	SmbEnum,
+	SmbAnalysisEnum,
+	SmbSolutionEnum,
+	SmbNumRequestedOutputsEnum,
+	SmbRequestedOutputsEnum,
+	SmbIsInitializedEnum,
+	/*SMBforcing*/
+	SMBforcingEnum,
+	SmbMassBalanceEnum,
+	/*SMBgemb*/
+	SMBgembEnum,
+	SmbInitDensityScalingEnum,
+	SmbTaEnum,
+	SmbVEnum,
+	SmbDswrfEnum,
+	SmbDlwrfEnum,
+	SmbPEnum, 
+	SmbSwfEnum, 
+	SmbEAirEnum, 
+	SmbPAirEnum,
+	SmbTmeanEnum,
+	SmbCEnum,
+	SmbTzEnum,
+	SmbVzEnum, 
+	SmbDtEnum,
+	SmbDzEnum,
+	SmbAIdxEnum,
+	SmbSwIdxEnum,
+	SmbDenIdxEnum,
+	SmbZTopEnum, 
+	SmbDzTopEnum, 
+	SmbDzMinEnum, 
+	SmbZYEnum, 
+	SmbZMaxEnum, 
+	SmbZMinEnum, 
+	SmbOutputFreqEnum, 
+	SmbASnowEnum, 
+	SmbAIceEnum, 
+	SmbCldFracEnum, 
+	SmbT0wetEnum, 
+	SmbT0dryEnum, 
+	SmbKEnum, 
+	SmbDEnum,
+	SmbReEnum,
+	SmbGdnEnum,
+	SmbGspEnum,
+	SmbECEnum,
+	SmbCondensationEnum,
+	SmbWEnum,
+	SmbAEnum,
+	SmbTEnum,
+	SmbIsgraingrowthEnum,
+	SmbIsalbedoEnum,
+	SmbIsshortwaveEnum,
+	SmbIsthermalEnum,
+	SmbIsaccumulationEnum,
+	SmbIsmeltEnum,
+	SmbIsdensificationEnum,
+	SmbIsturbulentfluxEnum,
+	/*SMBpdd*/
+	SMBpddEnum,	
+	SmbDelta18oEnum,
+	SmbDelta18oSurfaceEnum,
+	SmbIsdelta18oEnum,
+	SmbIsmungsmEnum,
+	SmbIsd18opdEnum,
+	SmbPrecipitationsPresentdayEnum,
+	SmbPrecipitationsLgmEnum,
+	SmbTemperaturesPresentdayEnum,
+	SmbTemperaturesLgmEnum,
+	SmbPrecipitationEnum,
+	SmbDesfacEnum,
+	SmbS0pEnum,
+	SmbS0tEnum,
+	SmbRlapsEnum,
+	SmbRlapslgmEnum,
+	SmbPfacEnum,
+	SmbTdiffEnum,
+	SmbSealevEnum,
+	SMBd18opddEnum,
+	SmbDpermilEnum,
 	SMBgradientsEnum,
-	SurfaceforcingsMonthlytemperaturesEnum,
-	SurfaceforcingsHrefEnum,
-	SurfaceforcingsSmbrefEnum,
-	SurfaceforcingsBPosEnum,
-	SurfaceforcingsBNegEnum,
+	SmbMonthlytemperaturesEnum,
+	SmbHrefEnum,
+	SmbSmbrefEnum,
+	SmbBPosEnum,
+	SmbBNegEnum,
 	SMBhenningEnum,
 	SMBcomponentsEnum,
-	SurfaceforcingsAccumulationEnum,
-	SurfaceforcingsEvaporationEnum,
-	SurfaceforcingsRunoffEnum,
+	SmbAccumulationEnum,
+	SmbEvaporationEnum,
+	SmbRunoffEnum,
 	SMBmeltcomponentsEnum,
-	SurfaceforcingsMeltEnum,
-	SurfaceforcingsRefreezeEnum,
+	SmbMeltEnum,
+	SmbRefreezeEnum,
+	SMBgcmEnum,
 	/*TO BE REMOVED*/
-	SurfaceforcingsIspddEnum,
-	SurfaceforcingsIssmbgradientsEnum,
+	SmbIspddEnum,
+	SmbIssmbgradientsEnum,
 	/*}}}*/
 	/*Solutions and Analyses{{{ */
 	SolutionTypeEnum,
@@ -410,6 +519,7 @@
 	HydrologyShreveAnalysisEnum,
 	HydrologyDCInefficientAnalysisEnum,
 	HydrologyDCEfficientAnalysisEnum,
+	HydrologySommersAnalysisEnum,
 	HydrologySolutionEnum,
 	MeltingAnalysisEnum,
 	MasstransportAnalysisEnum,
@@ -451,6 +561,7 @@
 	FSpressureEnum,
 	/*}}}*/
 	/*Datasets {{{*/
+	DataSetEnum,
 	ConstraintsEnum,
 	LoadsEnum,
 	MaterialsEnum,
@@ -469,12 +580,15 @@
 	ControlInputEnum,
 	DatasetInputEnum,
 	DoubleInputEnum,
+	DoubleArrayInputEnum,
 	DataSetParamEnum,
 	DoubleMatArrayParamEnum,
 	DoubleMatParamEnum,
 	DoubleParamEnum,
 	DoubleVecParamEnum,
 	ElementEnum,
+	ElementHookEnum,
+	HookEnum,
 	ExternalResultEnum,
 	FileParamEnum,
 	InputEnum,
@@ -493,7 +607,9 @@
 	NodeEnum,
 	NumericalfluxEnum,
 	NumericalfluxTypeEnum,
+	NeumannfluxEnum,
 	ParamEnum,
+	MoulinEnum,
 	PengridEnum,
 	PenpairEnum,
 	ProfilerEnum,
@@ -575,6 +691,7 @@
 	SurfaceSlopeYEnum,
 	TemperatureEnum,
 	TemperaturePicardEnum,
+	TemperaturePDDEnum,
 	ThicknessAbsMisfitEnum,
 	SurfaceAbsMisfitEnum,
 	VelEnum,
@@ -598,6 +715,7 @@
 	ThicknessAbsGradientEnum,
 	ThicknessAlongGradientEnum,
 	ThicknessAcrossGradientEnum,
+	ThicknessPositiveEnum,
 	IntMatParamEnum,
 	RheologyBbarAbsGradientEnum,
 	RheologyBAbsGradientEnum,
@@ -627,6 +745,7 @@
 	DeviatoricStressyyEnum,
 	DeviatoricStressyzEnum,
 	DeviatoricStresszzEnum,
+	DeviatoricStresseffectiveEnum,
 	StrainRateEnum,
 	StrainRatexxEnum,
 	StrainRatexyEnum,
@@ -642,6 +761,7 @@
 	/*}}}*/
 	/*Element Interpolations{{{*/
 	P0Enum,
+	P0ArrayEnum,
 	P1Enum,
 	P1DGEnum,
 	P1bubbleEnum,
@@ -783,6 +903,11 @@
 	MassfluxatgateNameEnum,
 	MassfluxatgateDefinitionenumEnum,
 	MassfluxatgateSegmentsEnum,
+	NodalvalueEnum,
+	NodalvalueNameEnum,
+	NodalvalueDefinitionenumEnum,
+	NodalvalueModelEnumEnum,
+	NodalvalueNodeEnum,
 	MisfitNameEnum,
 	MisfitDefinitionenumEnum,
 	MisfitModelEnumEnum,
@@ -811,9 +936,13 @@
 	MinVzEnum,
 	MaxVzEnum,
 	MaxAbsVzEnum,
+	FloatingAreaEnum,
+	GroundedAreaEnum,
 	IceMassEnum,
 	IceVolumeEnum,
 	IceVolumeAboveFloatationEnum,
+	TotalFloatingBmbEnum,
+	TotalGroundedBmbEnum,
 	TotalSmbEnum,
 	/*}}}*/
 	/*Relaxation{{{*/
@@ -860,12 +989,15 @@
 	IntersectEnum,
 	NodalEnum,
 	OldGradientEnum,
+	OutputBufferPointerEnum,
+	OutputBufferSizePointerEnum,
 	OutputFilePointerEnum,
 	ToolkitsFileNameEnum,
 	RootPathEnum,
 	OutputFileNameEnum,
 	InputFileNameEnum,
 	LockFileNameEnum,
+	RestartFileNameEnum,
 	ToolkitsOptionsAnalysesEnum,
 	ToolkitsOptionsStringsEnum,
 	QmuErrNameEnum,
@@ -908,13 +1040,36 @@
 	LliboutryDuvalEnum,
 	/*}}}*/
 	/*Levelset related enums (will be moved to appropriate place when finished){{{*/
-	TransientIslevelsetEnum,
+	SpclevelsetEnum,
 	ExtrapolationVariableEnum,
 	IceMaskNodeActivationEnum,
 	LevelsetfunctionSlopeXEnum,
 	LevelsetfunctionSlopeYEnum,
 	LevelsetfunctionPicardEnum,
+	LevelsetReinitFrequencyEnum,
 	/*}}}*/
+	/*Sea Level Rise{{{*/
+	SealevelriseSolutionEnum,
+	SealevelriseAnalysisEnum,
+	SealevelEnum,
+	SealevelEustaticEnum,
+	SealevelriseDeltathicknessEnum,
+	SealevelriseMaxiterEnum,
+	SealevelriseReltolEnum,
+	SealevelriseAbstolEnum,
+	SealevelriseLoveHEnum,
+	SealevelriseLoveKEnum,
+	SealevelriseTideLoveHEnum,
+	SealevelriseTideLoveKEnum,
+	SealevelriseRigidEnum,
+	SealevelriseElasticEnum,
+	SealevelriseRotationEnum,
+	SealevelriseGElasticEnum,
+	SealevelriseDegaccEnum,
+	SealevelriseTransitionsEnum,
+	SealevelriseRequestedOutputsEnum,
+	SealevelriseNumRequestedOutputsEnum,
+	/*}}}*/
 	MaximumNumberOfDefinitionsEnum
 };
 

Modified: issm/trunk/src/c/shared/Enum/EnumToStringx.cpp
===================================================================
--- issm/trunk/src/c/shared/Enum/EnumToStringx.cpp	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/shared/Enum/EnumToStringx.cpp	2016-04-13 04:32:01 UTC (rev 20500)
@@ -16,6 +16,13 @@
 
 	switch(en){
 
+		case FemModelEnum : return "FemModel";
+		case FemModelCommEnum : return "FemModelComm";
+		case WorldCommEnum : return "WorldComm";
+		case IcecapToEarthCommEnum : return "IcecapToEarthComm";
+		case NumModelsEnum : return "NumModels";
+		case ModelIdEnum : return "ModelId";
+		case EarthIdEnum : return "EarthId";
 		case AutodiffIsautodiffEnum : return "AutodiffIsautodiff";
 		case AutodiffNumDependentsEnum : return "AutodiffNumDependents";
 		case AutodiffNumDependentObjectsEnum : return "AutodiffNumDependentObjects";
@@ -52,12 +59,28 @@
 		case BasalforcingsDeepwaterMeltingRateEnum : return "BasalforcingsDeepwaterMeltingRate";
 		case BasalforcingsDeepwaterElevationEnum : return "BasalforcingsDeepwaterElevation";
 		case BasalforcingsUpperwaterElevationEnum : return "BasalforcingsUpperwaterElevation";
+		case BasalforcingsMeltrateFactorEnum : return "BasalforcingsMeltrateFactor";
+		case BasalforcingsThresholdThicknessEnum : return "BasalforcingsThresholdThickness";
+		case BasalforcingsUpperdepthMeltEnum : return "BasalforcingsUpperdepthMelt";
+		case BasalforcingsMantleconductivityEnum : return "BasalforcingsMantleconductivity";
+		case BasalforcingsNusseltEnum : return "BasalforcingsNusselt";
+		case BasalforcingsDtbgEnum : return "BasalforcingsDtbg";
+		case BasalforcingsPlumeradiusEnum : return "BasalforcingsPlumeradius";
+		case BasalforcingsTopplumedepthEnum : return "BasalforcingsTopplumedepth";
+		case BasalforcingsBottomplumedepthEnum : return "BasalforcingsBottomplumedepth";
+		case BasalforcingsPlumexEnum : return "BasalforcingsPlumex";
+		case BasalforcingsPlumeyEnum : return "BasalforcingsPlumey";
+		case BasalforcingsCrustthicknessEnum : return "BasalforcingsCrustthickness";
+		case BasalforcingsUppercrustthicknessEnum : return "BasalforcingsUppercrustthickness";
+		case BasalforcingsUppercrustheatEnum : return "BasalforcingsUppercrustheat";
+		case BasalforcingsLowercrustheatEnum : return "BasalforcingsLowercrustheat";
 		case FloatingMeltRateEnum : return "FloatingMeltRate";
 		case LinearFloatingMeltRateEnum : return "LinearFloatingMeltRate";
+		case MismipFloatingMeltRateEnum : return "MismipFloatingMeltRate";
+		case MantlePlumeGeothermalFluxEnum : return "MantlePlumeGeothermalFlux";
 		case BedEnum : return "Bed";
 		case BaseEnum : return "Base";
 		case ConstantsGEnum : return "ConstantsG";
-		case ConstantsOmegaEnum : return "ConstantsOmega";
 		case ConstantsReferencetemperatureEnum : return "ConstantsReferencetemperature";
 		case ConstantsYtsEnum : return "ConstantsYts";
 		case DependentObjectEnum : return "DependentObject";
@@ -97,14 +120,17 @@
 		case FlowequationVertexEquationEnum : return "FlowequationVertexEquation";
 		case FrictionAsEnum : return "FrictionAs";
 		case FrictionCoefficientEnum : return "FrictionCoefficient";
+		case FrictionCoefficientcoulombEnum : return "FrictionCoefficientcoulomb";
 		case FrictionPEnum : return "FrictionP";
 		case FrictionQEnum : return "FrictionQ";
 		case FrictionMEnum : return "FrictionM";
 		case FrictionCEnum : return "FrictionC";
 		case FrictionLawEnum : return "FrictionLaw";
 		case FrictionGammaEnum : return "FrictionGamma";
+		case FrictionFEnum : return "FrictionF";
 		case FrictionWaterLayerEnum : return "FrictionWaterLayer";
 		case FrictionEffectivePressureEnum : return "FrictionEffectivePressure";
+		case FrictionCouplingEnum : return "FrictionCoupling";
 		case GeometryHydrostaticRatioEnum : return "GeometryHydrostaticRatio";
 		case HydrologyModelEnum : return "HydrologyModel";
 		case HydrologyshreveEnum : return "Hydrologyshreve";
@@ -153,6 +179,17 @@
 		case HydrologySedimentEnum : return "HydrologySediment";
 		case HydrologyEfficientEnum : return "HydrologyEfficient";
 		case HydrologySedimentKmaxEnum : return "HydrologySedimentKmax";
+		case HydrologysommersEnum : return "Hydrologysommers";
+		case HydrologyHeadEnum : return "HydrologyHead";
+		case HydrologyGapHeightEnum : return "HydrologyGapHeight";
+		case HydrologyBumpSpacingEnum : return "HydrologyBumpSpacing";
+		case HydrologyBumpHeightEnum : return "HydrologyBumpHeight";
+		case HydrologyEnglacialInputEnum : return "HydrologyEnglacialInput";
+		case HydrologyMoulinInputEnum : return "HydrologyMoulinInput";
+		case HydrologyReynoldsEnum : return "HydrologyReynolds";
+		case HydrologyNeumannfluxEnum : return "HydrologyNeumannflux";
+		case HydrologySpcheadEnum : return "HydrologySpchead";
+		case HydrologyConductivityEnum : return "HydrologyConductivity";
 		case IndependentObjectEnum : return "IndependentObject";
 		case InversionControlParametersEnum : return "InversionControlParameters";
 		case InversionControlScalingFactorsEnum : return "InversionControlScalingFactors";
@@ -185,6 +222,8 @@
 		case InversionVyObsEnum : return "InversionVyObs";
 		case InversionVzObsEnum : return "InversionVzObs";
 		case MaskIceLevelsetEnum : return "MaskIceLevelset";
+		case MaskOceanLevelsetEnum : return "MaskOceanLevelset";
+		case MaskLandLevelsetEnum : return "MaskLandLevelset";
 		case MaterialsBetaEnum : return "MaterialsBeta";
 		case MaterialsHeatcapacityEnum : return "MaterialsHeatcapacity";
 		case MaterialsLatentheatEnum : return "MaterialsLatentheat";
@@ -206,10 +245,8 @@
 		case DamageElementinterpEnum : return "DamageElementinterp";
 		case DamageHealingEnum : return "DamageHealing";
 		case DamageStressThresholdEnum : return "DamageStressThreshold";
+		case DamageKappaEnum : return "DamageKappa";
 		case DamageStabilizationEnum : return "DamageStabilization";
-		case DamagePenaltyThresholdEnum : return "DamagePenaltyThreshold";
-		case DamagePenaltyLockEnum : return "DamagePenaltyLock";
-		case DamagePenaltyFactorEnum : return "DamagePenaltyFactor";
 		case DamageMaxiterEnum : return "DamageMaxiter";
 		case DamageSpcdamageEnum : return "DamageSpcdamage";
 		case DamageMaxDamageEnum : return "DamageMaxDamage";
@@ -223,14 +260,12 @@
 		case CalvingCalvingrateEnum : return "CalvingCalvingrate";
 		case CalvingMeltingrateEnum : return "CalvingMeltingrate";
 		case CalvingLevermannEnum : return "CalvingLevermann";
-		case CalvingPiEnum : return "CalvingPi";
 		case CalvingDevEnum : return "CalvingDev";
 		case DefaultCalvingEnum : return "DefaultCalving";
 		case CalvingRequestedOutputsEnum : return "CalvingRequestedOutputs";
 		case CalvinglevermannCoeffEnum : return "CalvinglevermannCoeff";
 		case CalvinglevermannMeltingrateEnum : return "CalvinglevermannMeltingrate";
-		case CalvingpiCoeffEnum : return "CalvingpiCoeff";
-		case CalvingpiMeltingrateEnum : return "CalvingpiMeltingrate";
+		case CalvingdevCoeffEnum : return "CalvingdevCoeff";
 		case CalvingratexEnum : return "Calvingratex";
 		case CalvingrateyEnum : return "Calvingratey";
 		case CalvingratexAverageEnum : return "CalvingratexAverage";
@@ -249,6 +284,7 @@
 		case MaterialsLithosphereDensityEnum : return "MaterialsLithosphereDensity";
 		case MaterialsMantleShearModulusEnum : return "MaterialsMantleShearModulus";
 		case MaterialsMantleDensityEnum : return "MaterialsMantleDensity";
+		case MaterialsEarthDensityEnum : return "MaterialsEarthDensity";
 		case MeshAverageVertexConnectivityEnum : return "MeshAverageVertexConnectivity";
 		case MeshElements2dEnum : return "MeshElements2d";
 		case MeshElementsEnum : return "MeshElements";
@@ -265,12 +301,17 @@
 		case MeshXEnum : return "MeshX";
 		case MeshYEnum : return "MeshY";
 		case MeshZEnum : return "MeshZ";
+		case MeshLatEnum : return "MeshLat";
+		case MeshLongEnum : return "MeshLong";
+		case MeshREnum : return "MeshR";
 		case MeshElementtypeEnum : return "MeshElementtype";
+		case MeshSegmentsEnum : return "MeshSegments";
 		case DomainTypeEnum : return "DomainType";
 		case DomainDimensionEnum : return "DomainDimension";
 		case Domain2DhorizontalEnum : return "Domain2Dhorizontal";
 		case Domain2DverticalEnum : return "Domain2Dvertical";
 		case Domain3DEnum : return "Domain3D";
+		case Domain3DsurfaceEnum : return "Domain3Dsurface";
 		case MiscellaneousNameEnum : return "MiscellaneousName";
 		case MasstransportHydrostaticAdjustmentEnum : return "MasstransportHydrostaticAdjustment";
 		case MasstransportIsfreesurfaceEnum : return "MasstransportIsfreesurface";
@@ -296,12 +337,12 @@
 		case SettingsIoGatherEnum : return "SettingsIoGather";
 		case SettingsLowmemEnum : return "SettingsLowmem";
 		case SettingsOutputFrequencyEnum : return "SettingsOutputFrequency";
+		case SettingsRecordingFrequencyEnum : return "SettingsRecordingFrequency";
 		case SettingsWaitonlockEnum : return "SettingsWaitonlock";
 		case DebugProfilingEnum : return "DebugProfiling";
 		case ProfilingCurrentMemEnum : return "ProfilingCurrentMem";
 		case ProfilingCurrentFlopsEnum : return "ProfilingCurrentFlops";
 		case ProfilingSolutionTimeEnum : return "ProfilingSolutionTime";
-		case MaxIterationConvergenceFlagEnum : return "MaxIterationConvergenceFlag";
 		case SteadystateMaxiterEnum : return "SteadystateMaxiter";
 		case SteadystateNumRequestedOutputsEnum : return "SteadystateNumRequestedOutputs";
 		case SteadystateReltolEnum : return "SteadystateReltol";
@@ -327,6 +368,8 @@
 		case TimesteppingTimeAdaptEnum : return "TimesteppingTimeAdapt";
 		case TimesteppingTimeStepEnum : return "TimesteppingTimeStep";
 		case TimesteppingInterpForcingsEnum : return "TimesteppingInterpForcings";
+		case TransientIssmbEnum : return "TransientIssmb";
+		case TransientIscouplerEnum : return "TransientIscoupler";
 		case TransientIsstressbalanceEnum : return "TransientIsstressbalance";
 		case TransientIsgroundinglineEnum : return "TransientIsgroundingline";
 		case TransientIsmasstransportEnum : return "TransientIsmasstransport";
@@ -334,7 +377,8 @@
 		case TransientIsgiaEnum : return "TransientIsgia";
 		case TransientIsdamageevolutionEnum : return "TransientIsdamageevolution";
 		case TransientIshydrologyEnum : return "TransientIshydrology";
-		case TransientIscalvingEnum : return "TransientIscalving";
+		case TransientIsmovingfrontEnum : return "TransientIsmovingfront";
+		case TransientIsslrEnum : return "TransientIsslr";
 		case TransientNumRequestedOutputsEnum : return "TransientNumRequestedOutputs";
 		case TransientRequestedOutputsEnum : return "TransientRequestedOutputs";
 		case PotentialEnum : return "Potential";
@@ -345,43 +389,101 @@
 		case BalancethicknessCmuEnum : return "BalancethicknessCmu";
 		case BalancethicknessOmegaEnum : return "BalancethicknessOmega";
 		case BalancethicknessD0Enum : return "BalancethicknessD0";
-		case SurfaceforcingsEnum : return "Surfaceforcings";
-		case SMBEnum : return "SMB";
-		case SurfaceforcingsMassBalanceEnum : return "SurfaceforcingsMassBalance";
+		case SmbEnum : return "Smb";
+		case SmbAnalysisEnum : return "SmbAnalysis";
+		case SmbSolutionEnum : return "SmbSolution";
+		case SmbNumRequestedOutputsEnum : return "SmbNumRequestedOutputs";
+		case SmbRequestedOutputsEnum : return "SmbRequestedOutputs";
+		case SmbIsInitializedEnum : return "SmbIsInitialized";
+		case SMBforcingEnum : return "SMBforcing";
+		case SmbMassBalanceEnum : return "SmbMassBalance";
+		case SMBgembEnum : return "SMBgemb";
+		case SmbInitDensityScalingEnum : return "SmbInitDensityScaling";
+		case SmbTaEnum : return "SmbTa";
+		case SmbVEnum : return "SmbV";
+		case SmbDswrfEnum : return "SmbDswrf";
+		case SmbDlwrfEnum : return "SmbDlwrf";
+		case SmbPEnum : return "SmbP";
+		case SmbSwfEnum : return "SmbSwf";
+		case SmbEAirEnum : return "SmbEAir";
+		case SmbPAirEnum : return "SmbPAir";
+		case SmbTmeanEnum : return "SmbTmean";
+		case SmbCEnum : return "SmbC";
+		case SmbTzEnum : return "SmbTz";
+		case SmbVzEnum : return "SmbVz";
+		case SmbDtEnum : return "SmbDt";
+		case SmbDzEnum : return "SmbDz";
+		case SmbAIdxEnum : return "SmbAIdx";
+		case SmbSwIdxEnum : return "SmbSwIdx";
+		case SmbDenIdxEnum : return "SmbDenIdx";
+		case SmbZTopEnum : return "SmbZTop";
+		case SmbDzTopEnum : return "SmbDzTop";
+		case SmbDzMinEnum : return "SmbDzMin";
+		case SmbZYEnum : return "SmbZY";
+		case SmbZMaxEnum : return "SmbZMax";
+		case SmbZMinEnum : return "SmbZMin";
+		case SmbOutputFreqEnum : return "SmbOutputFreq";
+		case SmbASnowEnum : return "SmbASnow";
+		case SmbAIceEnum : return "SmbAIce";
+		case SmbCldFracEnum : return "SmbCldFrac";
+		case SmbT0wetEnum : return "SmbT0wet";
+		case SmbT0dryEnum : return "SmbT0dry";
+		case SmbKEnum : return "SmbK";
+		case SmbDEnum : return "SmbD";
+		case SmbReEnum : return "SmbRe";
+		case SmbGdnEnum : return "SmbGdn";
+		case SmbGspEnum : return "SmbGsp";
+		case SmbECEnum : return "SmbEC";
+		case SmbCondensationEnum : return "SmbCondensation";
+		case SmbWEnum : return "SmbW";
+		case SmbAEnum : return "SmbA";
+		case SmbTEnum : return "SmbT";
+		case SmbIsgraingrowthEnum : return "SmbIsgraingrowth";
+		case SmbIsalbedoEnum : return "SmbIsalbedo";
+		case SmbIsshortwaveEnum : return "SmbIsshortwave";
+		case SmbIsthermalEnum : return "SmbIsthermal";
+		case SmbIsaccumulationEnum : return "SmbIsaccumulation";
+		case SmbIsmeltEnum : return "SmbIsmelt";
+		case SmbIsdensificationEnum : return "SmbIsdensification";
+		case SmbIsturbulentfluxEnum : return "SmbIsturbulentflux";
 		case SMBpddEnum : return "SMBpdd";
-		case SurfaceforcingsDelta18oEnum : return "SurfaceforcingsDelta18o";
-		case SurfaceforcingsDelta18oSurfaceEnum : return "SurfaceforcingsDelta18oSurface";
-		case SurfaceforcingsIsdelta18oEnum : return "SurfaceforcingsIsdelta18o";
-		case SurfaceforcingsIsmungsmEnum : return "SurfaceforcingsIsmungsm";
-		case SurfaceforcingsPrecipitationsPresentdayEnum : return "SurfaceforcingsPrecipitationsPresentday";
-		case SurfaceforcingsPrecipitationsLgmEnum : return "SurfaceforcingsPrecipitationsLgm";
-		case SurfaceforcingsTemperaturesPresentdayEnum : return "SurfaceforcingsTemperaturesPresentday";
-		case SurfaceforcingsTemperaturesLgmEnum : return "SurfaceforcingsTemperaturesLgm";
-		case SurfaceforcingsPrecipitationEnum : return "SurfaceforcingsPrecipitation";
-		case SurfaceforcingsDesfacEnum : return "SurfaceforcingsDesfac";
-		case SurfaceforcingsS0pEnum : return "SurfaceforcingsS0p";
-		case SurfaceforcingsS0tEnum : return "SurfaceforcingsS0t";
-		case SurfaceforcingsRlapsEnum : return "SurfaceforcingsRlaps";
-		case SurfaceforcingsRlapslgmEnum : return "SurfaceforcingsRlapslgm";
-		case SurfaceforcingsPfacEnum : return "SurfaceforcingsPfac";
-		case SurfaceforcingsTdiffEnum : return "SurfaceforcingsTdiff";
-		case SurfaceforcingsSealevEnum : return "SurfaceforcingsSealev";
+		case SmbDelta18oEnum : return "SmbDelta18o";
+		case SmbDelta18oSurfaceEnum : return "SmbDelta18oSurface";
+		case SmbIsdelta18oEnum : return "SmbIsdelta18o";
+		case SmbIsmungsmEnum : return "SmbIsmungsm";
+		case SmbIsd18opdEnum : return "SmbIsd18opd";
+		case SmbPrecipitationsPresentdayEnum : return "SmbPrecipitationsPresentday";
+		case SmbPrecipitationsLgmEnum : return "SmbPrecipitationsLgm";
+		case SmbTemperaturesPresentdayEnum : return "SmbTemperaturesPresentday";
+		case SmbTemperaturesLgmEnum : return "SmbTemperaturesLgm";
+		case SmbPrecipitationEnum : return "SmbPrecipitation";
+		case SmbDesfacEnum : return "SmbDesfac";
+		case SmbS0pEnum : return "SmbS0p";
+		case SmbS0tEnum : return "SmbS0t";
+		case SmbRlapsEnum : return "SmbRlaps";
+		case SmbRlapslgmEnum : return "SmbRlapslgm";
+		case SmbPfacEnum : return "SmbPfac";
+		case SmbTdiffEnum : return "SmbTdiff";
+		case SmbSealevEnum : return "SmbSealev";
+		case SMBd18opddEnum : return "SMBd18opdd";
+		case SmbDpermilEnum : return "SmbDpermil";
 		case SMBgradientsEnum : return "SMBgradients";
-		case SurfaceforcingsMonthlytemperaturesEnum : return "SurfaceforcingsMonthlytemperatures";
-		case SurfaceforcingsHrefEnum : return "SurfaceforcingsHref";
-		case SurfaceforcingsSmbrefEnum : return "SurfaceforcingsSmbref";
-		case SurfaceforcingsBPosEnum : return "SurfaceforcingsBPos";
-		case SurfaceforcingsBNegEnum : return "SurfaceforcingsBNeg";
+		case SmbMonthlytemperaturesEnum : return "SmbMonthlytemperatures";
+		case SmbHrefEnum : return "SmbHref";
+		case SmbSmbrefEnum : return "SmbSmbref";
+		case SmbBPosEnum : return "SmbBPos";
+		case SmbBNegEnum : return "SmbBNeg";
 		case SMBhenningEnum : return "SMBhenning";
 		case SMBcomponentsEnum : return "SMBcomponents";
-		case SurfaceforcingsAccumulationEnum : return "SurfaceforcingsAccumulation";
-		case SurfaceforcingsEvaporationEnum : return "SurfaceforcingsEvaporation";
-		case SurfaceforcingsRunoffEnum : return "SurfaceforcingsRunoff";
+		case SmbAccumulationEnum : return "SmbAccumulation";
+		case SmbEvaporationEnum : return "SmbEvaporation";
+		case SmbRunoffEnum : return "SmbRunoff";
 		case SMBmeltcomponentsEnum : return "SMBmeltcomponents";
-		case SurfaceforcingsMeltEnum : return "SurfaceforcingsMelt";
-		case SurfaceforcingsRefreezeEnum : return "SurfaceforcingsRefreeze";
-		case SurfaceforcingsIspddEnum : return "SurfaceforcingsIspdd";
-		case SurfaceforcingsIssmbgradientsEnum : return "SurfaceforcingsIssmbgradients";
+		case SmbMeltEnum : return "SmbMelt";
+		case SmbRefreezeEnum : return "SmbRefreeze";
+		case SMBgcmEnum : return "SMBgcm";
+		case SmbIspddEnum : return "SmbIspdd";
+		case SmbIssmbgradientsEnum : return "SmbIssmbgradients";
 		case SolutionTypeEnum : return "SolutionType";
 		case AnalysisTypeEnum : return "AnalysisType";
 		case ConfigurationTypeEnum : return "ConfigurationType";
@@ -413,6 +515,7 @@
 		case HydrologyShreveAnalysisEnum : return "HydrologyShreveAnalysis";
 		case HydrologyDCInefficientAnalysisEnum : return "HydrologyDCInefficientAnalysis";
 		case HydrologyDCEfficientAnalysisEnum : return "HydrologyDCEfficientAnalysis";
+		case HydrologySommersAnalysisEnum : return "HydrologySommersAnalysis";
 		case HydrologySolutionEnum : return "HydrologySolution";
 		case MeltingAnalysisEnum : return "MeltingAnalysis";
 		case MasstransportAnalysisEnum : return "MasstransportAnalysis";
@@ -450,6 +553,7 @@
 		case FSApproximationEnum : return "FSApproximation";
 		case FSvelocityEnum : return "FSvelocity";
 		case FSpressureEnum : return "FSpressure";
+		case DataSetEnum : return "DataSet";
 		case ConstraintsEnum : return "Constraints";
 		case LoadsEnum : return "Loads";
 		case MaterialsEnum : return "Materials";
@@ -466,12 +570,15 @@
 		case ControlInputEnum : return "ControlInput";
 		case DatasetInputEnum : return "DatasetInput";
 		case DoubleInputEnum : return "DoubleInput";
+		case DoubleArrayInputEnum : return "DoubleArrayInput";
 		case DataSetParamEnum : return "DataSetParam";
 		case DoubleMatArrayParamEnum : return "DoubleMatArrayParam";
 		case DoubleMatParamEnum : return "DoubleMatParam";
 		case DoubleParamEnum : return "DoubleParam";
 		case DoubleVecParamEnum : return "DoubleVecParam";
 		case ElementEnum : return "Element";
+		case ElementHookEnum : return "ElementHook";
+		case HookEnum : return "Hook";
 		case ExternalResultEnum : return "ExternalResult";
 		case FileParamEnum : return "FileParam";
 		case InputEnum : return "Input";
@@ -490,7 +597,9 @@
 		case NodeEnum : return "Node";
 		case NumericalfluxEnum : return "Numericalflux";
 		case NumericalfluxTypeEnum : return "NumericalfluxType";
+		case NeumannfluxEnum : return "Neumannflux";
 		case ParamEnum : return "Param";
+		case MoulinEnum : return "Moulin";
 		case PengridEnum : return "Pengrid";
 		case PenpairEnum : return "Penpair";
 		case ProfilerEnum : return "Profiler";
@@ -566,6 +675,7 @@
 		case SurfaceSlopeYEnum : return "SurfaceSlopeY";
 		case TemperatureEnum : return "Temperature";
 		case TemperaturePicardEnum : return "TemperaturePicard";
+		case TemperaturePDDEnum : return "TemperaturePDD";
 		case ThicknessAbsMisfitEnum : return "ThicknessAbsMisfit";
 		case SurfaceAbsMisfitEnum : return "SurfaceAbsMisfit";
 		case VelEnum : return "Vel";
@@ -589,6 +699,7 @@
 		case ThicknessAbsGradientEnum : return "ThicknessAbsGradient";
 		case ThicknessAlongGradientEnum : return "ThicknessAlongGradient";
 		case ThicknessAcrossGradientEnum : return "ThicknessAcrossGradient";
+		case ThicknessPositiveEnum : return "ThicknessPositive";
 		case IntMatParamEnum : return "IntMatParam";
 		case RheologyBbarAbsGradientEnum : return "RheologyBbarAbsGradient";
 		case RheologyBAbsGradientEnum : return "RheologyBAbsGradient";
@@ -618,6 +729,7 @@
 		case DeviatoricStressyyEnum : return "DeviatoricStressyy";
 		case DeviatoricStressyzEnum : return "DeviatoricStressyz";
 		case DeviatoricStresszzEnum : return "DeviatoricStresszz";
+		case DeviatoricStresseffectiveEnum : return "DeviatoricStresseffective";
 		case StrainRateEnum : return "StrainRate";
 		case StrainRatexxEnum : return "StrainRatexx";
 		case StrainRatexyEnum : return "StrainRatexy";
@@ -631,6 +743,7 @@
 		case GiadWdtEnum : return "GiadWdt";
 		case GiaWEnum : return "GiaW";
 		case P0Enum : return "P0";
+		case P0ArrayEnum : return "P0Array";
 		case P1Enum : return "P1";
 		case P1DGEnum : return "P1DG";
 		case P1bubbleEnum : return "P1bubble";
@@ -768,6 +881,11 @@
 		case MassfluxatgateNameEnum : return "MassfluxatgateName";
 		case MassfluxatgateDefinitionenumEnum : return "MassfluxatgateDefinitionenum";
 		case MassfluxatgateSegmentsEnum : return "MassfluxatgateSegments";
+		case NodalvalueEnum : return "Nodalvalue";
+		case NodalvalueNameEnum : return "NodalvalueName";
+		case NodalvalueDefinitionenumEnum : return "NodalvalueDefinitionenum";
+		case NodalvalueModelEnumEnum : return "NodalvalueModelEnum";
+		case NodalvalueNodeEnum : return "NodalvalueNode";
 		case MisfitNameEnum : return "MisfitName";
 		case MisfitDefinitionenumEnum : return "MisfitDefinitionenum";
 		case MisfitModelEnumEnum : return "MisfitModelEnum";
@@ -794,9 +912,13 @@
 		case MinVzEnum : return "MinVz";
 		case MaxVzEnum : return "MaxVz";
 		case MaxAbsVzEnum : return "MaxAbsVz";
+		case FloatingAreaEnum : return "FloatingArea";
+		case GroundedAreaEnum : return "GroundedArea";
 		case IceMassEnum : return "IceMass";
 		case IceVolumeEnum : return "IceVolume";
 		case IceVolumeAboveFloatationEnum : return "IceVolumeAboveFloatation";
+		case TotalFloatingBmbEnum : return "TotalFloatingBmb";
+		case TotalGroundedBmbEnum : return "TotalGroundedBmb";
 		case TotalSmbEnum : return "TotalSmb";
 		case AbsoluteEnum : return "Absolute";
 		case IncrementalEnum : return "Incremental";
@@ -833,12 +955,15 @@
 		case IntersectEnum : return "Intersect";
 		case NodalEnum : return "Nodal";
 		case OldGradientEnum : return "OldGradient";
+		case OutputBufferPointerEnum : return "OutputBufferPointer";
+		case OutputBufferSizePointerEnum : return "OutputBufferSizePointer";
 		case OutputFilePointerEnum : return "OutputFilePointer";
 		case ToolkitsFileNameEnum : return "ToolkitsFileName";
 		case RootPathEnum : return "RootPath";
 		case OutputFileNameEnum : return "OutputFileName";
 		case InputFileNameEnum : return "InputFileName";
 		case LockFileNameEnum : return "LockFileName";
+		case RestartFileNameEnum : return "RestartFileName";
 		case ToolkitsOptionsAnalysesEnum : return "ToolkitsOptionsAnalyses";
 		case ToolkitsOptionsStringsEnum : return "ToolkitsOptionsStrings";
 		case QmuErrNameEnum : return "QmuErrName";
@@ -869,12 +994,33 @@
 		case PatersonEnum : return "Paterson";
 		case ArrheniusEnum : return "Arrhenius";
 		case LliboutryDuvalEnum : return "LliboutryDuval";
-		case TransientIslevelsetEnum : return "TransientIslevelset";
+		case SpclevelsetEnum : return "Spclevelset";
 		case ExtrapolationVariableEnum : return "ExtrapolationVariable";
 		case IceMaskNodeActivationEnum : return "IceMaskNodeActivation";
 		case LevelsetfunctionSlopeXEnum : return "LevelsetfunctionSlopeX";
 		case LevelsetfunctionSlopeYEnum : return "LevelsetfunctionSlopeY";
 		case LevelsetfunctionPicardEnum : return "LevelsetfunctionPicard";
+		case LevelsetReinitFrequencyEnum : return "LevelsetReinitFrequency";
+		case SealevelriseSolutionEnum : return "SealevelriseSolution";
+		case SealevelriseAnalysisEnum : return "SealevelriseAnalysis";
+		case SealevelEnum : return "Sealevel";
+		case SealevelEustaticEnum : return "SealevelEustatic";
+		case SealevelriseDeltathicknessEnum : return "SealevelriseDeltathickness";
+		case SealevelriseMaxiterEnum : return "SealevelriseMaxiter";
+		case SealevelriseReltolEnum : return "SealevelriseReltol";
+		case SealevelriseAbstolEnum : return "SealevelriseAbstol";
+		case SealevelriseLoveHEnum : return "SealevelriseLoveH";
+		case SealevelriseLoveKEnum : return "SealevelriseLoveK";
+		case SealevelriseTideLoveHEnum : return "SealevelriseTideLoveH";
+		case SealevelriseTideLoveKEnum : return "SealevelriseTideLoveK";
+		case SealevelriseRigidEnum : return "SealevelriseRigid";
+		case SealevelriseElasticEnum : return "SealevelriseElastic";
+		case SealevelriseRotationEnum : return "SealevelriseRotation";
+		case SealevelriseGElasticEnum : return "SealevelriseGElastic";
+		case SealevelriseDegaccEnum : return "SealevelriseDegacc";
+		case SealevelriseTransitionsEnum : return "SealevelriseTransitions";
+		case SealevelriseRequestedOutputsEnum : return "SealevelriseRequestedOutputs";
+		case SealevelriseNumRequestedOutputsEnum : return "SealevelriseNumRequestedOutputs";
 		case MaximumNumberOfDefinitionsEnum : return "MaximumNumberOfDefinitions";
 		default : return "unknown";
 

Modified: issm/trunk/src/c/shared/Enum/StringToEnumx.cpp
===================================================================
--- issm/trunk/src/c/shared/Enum/StringToEnumx.cpp	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/shared/Enum/StringToEnumx.cpp	2016-04-13 04:32:01 UTC (rev 20500)
@@ -16,7 +16,14 @@
    int  stage=1;
 
    if(stage==1){
-	      if (strcmp(name,"AutodiffIsautodiff")==0) return AutodiffIsautodiffEnum;
+	      if (strcmp(name,"FemModel")==0) return FemModelEnum;
+	      else if (strcmp(name,"FemModelComm")==0) return FemModelCommEnum;
+	      else if (strcmp(name,"WorldComm")==0) return WorldCommEnum;
+	      else if (strcmp(name,"IcecapToEarthComm")==0) return IcecapToEarthCommEnum;
+	      else if (strcmp(name,"NumModels")==0) return NumModelsEnum;
+	      else if (strcmp(name,"ModelId")==0) return ModelIdEnum;
+	      else if (strcmp(name,"EarthId")==0) return EarthIdEnum;
+	      else if (strcmp(name,"AutodiffIsautodiff")==0) return AutodiffIsautodiffEnum;
 	      else if (strcmp(name,"AutodiffNumDependents")==0) return AutodiffNumDependentsEnum;
 	      else if (strcmp(name,"AutodiffNumDependentObjects")==0) return AutodiffNumDependentObjectsEnum;
 	      else if (strcmp(name,"AutodiffDependentObjectNames")==0) return AutodiffDependentObjectNamesEnum;
@@ -52,12 +59,28 @@
 	      else if (strcmp(name,"BasalforcingsDeepwaterMeltingRate")==0) return BasalforcingsDeepwaterMeltingRateEnum;
 	      else if (strcmp(name,"BasalforcingsDeepwaterElevation")==0) return BasalforcingsDeepwaterElevationEnum;
 	      else if (strcmp(name,"BasalforcingsUpperwaterElevation")==0) return BasalforcingsUpperwaterElevationEnum;
+	      else if (strcmp(name,"BasalforcingsMeltrateFactor")==0) return BasalforcingsMeltrateFactorEnum;
+	      else if (strcmp(name,"BasalforcingsThresholdThickness")==0) return BasalforcingsThresholdThicknessEnum;
+	      else if (strcmp(name,"BasalforcingsUpperdepthMelt")==0) return BasalforcingsUpperdepthMeltEnum;
+	      else if (strcmp(name,"BasalforcingsMantleconductivity")==0) return BasalforcingsMantleconductivityEnum;
+	      else if (strcmp(name,"BasalforcingsNusselt")==0) return BasalforcingsNusseltEnum;
+	      else if (strcmp(name,"BasalforcingsDtbg")==0) return BasalforcingsDtbgEnum;
+	      else if (strcmp(name,"BasalforcingsPlumeradius")==0) return BasalforcingsPlumeradiusEnum;
+	      else if (strcmp(name,"BasalforcingsTopplumedepth")==0) return BasalforcingsTopplumedepthEnum;
+	      else if (strcmp(name,"BasalforcingsBottomplumedepth")==0) return BasalforcingsBottomplumedepthEnum;
+	      else if (strcmp(name,"BasalforcingsPlumex")==0) return BasalforcingsPlumexEnum;
+	      else if (strcmp(name,"BasalforcingsPlumey")==0) return BasalforcingsPlumeyEnum;
+	      else if (strcmp(name,"BasalforcingsCrustthickness")==0) return BasalforcingsCrustthicknessEnum;
+	      else if (strcmp(name,"BasalforcingsUppercrustthickness")==0) return BasalforcingsUppercrustthicknessEnum;
+	      else if (strcmp(name,"BasalforcingsUppercrustheat")==0) return BasalforcingsUppercrustheatEnum;
+	      else if (strcmp(name,"BasalforcingsLowercrustheat")==0) return BasalforcingsLowercrustheatEnum;
 	      else if (strcmp(name,"FloatingMeltRate")==0) return FloatingMeltRateEnum;
 	      else if (strcmp(name,"LinearFloatingMeltRate")==0) return LinearFloatingMeltRateEnum;
+	      else if (strcmp(name,"MismipFloatingMeltRate")==0) return MismipFloatingMeltRateEnum;
+	      else if (strcmp(name,"MantlePlumeGeothermalFlux")==0) return MantlePlumeGeothermalFluxEnum;
 	      else if (strcmp(name,"Bed")==0) return BedEnum;
 	      else if (strcmp(name,"Base")==0) return BaseEnum;
 	      else if (strcmp(name,"ConstantsG")==0) return ConstantsGEnum;
-	      else if (strcmp(name,"ConstantsOmega")==0) return ConstantsOmegaEnum;
 	      else if (strcmp(name,"ConstantsReferencetemperature")==0) return ConstantsReferencetemperatureEnum;
 	      else if (strcmp(name,"ConstantsYts")==0) return ConstantsYtsEnum;
 	      else if (strcmp(name,"DependentObject")==0) return DependentObjectEnum;
@@ -97,20 +120,26 @@
 	      else if (strcmp(name,"FlowequationVertexEquation")==0) return FlowequationVertexEquationEnum;
 	      else if (strcmp(name,"FrictionAs")==0) return FrictionAsEnum;
 	      else if (strcmp(name,"FrictionCoefficient")==0) return FrictionCoefficientEnum;
+	      else if (strcmp(name,"FrictionCoefficientcoulomb")==0) return FrictionCoefficientcoulombEnum;
 	      else if (strcmp(name,"FrictionP")==0) return FrictionPEnum;
 	      else if (strcmp(name,"FrictionQ")==0) return FrictionQEnum;
 	      else if (strcmp(name,"FrictionM")==0) return FrictionMEnum;
 	      else if (strcmp(name,"FrictionC")==0) return FrictionCEnum;
 	      else if (strcmp(name,"FrictionLaw")==0) return FrictionLawEnum;
 	      else if (strcmp(name,"FrictionGamma")==0) return FrictionGammaEnum;
+	      else if (strcmp(name,"FrictionF")==0) return FrictionFEnum;
 	      else if (strcmp(name,"FrictionWaterLayer")==0) return FrictionWaterLayerEnum;
 	      else if (strcmp(name,"FrictionEffectivePressure")==0) return FrictionEffectivePressureEnum;
+	      else if (strcmp(name,"FrictionCoupling")==0) return FrictionCouplingEnum;
 	      else if (strcmp(name,"GeometryHydrostaticRatio")==0) return GeometryHydrostaticRatioEnum;
 	      else if (strcmp(name,"HydrologyModel")==0) return HydrologyModelEnum;
 	      else if (strcmp(name,"Hydrologyshreve")==0) return HydrologyshreveEnum;
 	      else if (strcmp(name,"HydrologyshreveSpcwatercolumn")==0) return HydrologyshreveSpcwatercolumnEnum;
 	      else if (strcmp(name,"HydrologyshreveStabilization")==0) return HydrologyshreveStabilizationEnum;
-	      else if (strcmp(name,"Hydrologydc")==0) return HydrologydcEnum;
+         else stage=2;
+   }
+   if(stage==2){
+	      if (strcmp(name,"Hydrologydc")==0) return HydrologydcEnum;
 	      else if (strcmp(name,"SedimentHead")==0) return SedimentHeadEnum;
 	      else if (strcmp(name,"SedimentHeadOld")==0) return SedimentHeadOldEnum;
 	      else if (strcmp(name,"SedimentHeadResidual")==0) return SedimentHeadResidualEnum;
@@ -136,10 +165,7 @@
 	      else if (strcmp(name,"HydrologydcEplInitialThickness")==0) return HydrologydcEplInitialThicknessEnum;
 	      else if (strcmp(name,"HydrologydcEplColapseThickness")==0) return HydrologydcEplColapseThicknessEnum;
 	      else if (strcmp(name,"HydrologydcEplMaxThickness")==0) return HydrologydcEplMaxThicknessEnum;
-         else stage=2;
-   }
-   if(stage==2){
-	      if (strcmp(name,"HydrologydcEplThickness")==0) return HydrologydcEplThicknessEnum;
+	      else if (strcmp(name,"HydrologydcEplThickness")==0) return HydrologydcEplThicknessEnum;
 	      else if (strcmp(name,"HydrologydcEplThicknessOld")==0) return HydrologydcEplThicknessOldEnum;
 	      else if (strcmp(name,"HydrologydcEplThickComp")==0) return HydrologydcEplThickCompEnum;
 	      else if (strcmp(name,"HydrologydcEplConductivity")==0) return HydrologydcEplConductivityEnum;
@@ -156,6 +182,17 @@
 	      else if (strcmp(name,"HydrologySediment")==0) return HydrologySedimentEnum;
 	      else if (strcmp(name,"HydrologyEfficient")==0) return HydrologyEfficientEnum;
 	      else if (strcmp(name,"HydrologySedimentKmax")==0) return HydrologySedimentKmaxEnum;
+	      else if (strcmp(name,"Hydrologysommers")==0) return HydrologysommersEnum;
+	      else if (strcmp(name,"HydrologyHead")==0) return HydrologyHeadEnum;
+	      else if (strcmp(name,"HydrologyGapHeight")==0) return HydrologyGapHeightEnum;
+	      else if (strcmp(name,"HydrologyBumpSpacing")==0) return HydrologyBumpSpacingEnum;
+	      else if (strcmp(name,"HydrologyBumpHeight")==0) return HydrologyBumpHeightEnum;
+	      else if (strcmp(name,"HydrologyEnglacialInput")==0) return HydrologyEnglacialInputEnum;
+	      else if (strcmp(name,"HydrologyMoulinInput")==0) return HydrologyMoulinInputEnum;
+	      else if (strcmp(name,"HydrologyReynolds")==0) return HydrologyReynoldsEnum;
+	      else if (strcmp(name,"HydrologyNeumannflux")==0) return HydrologyNeumannfluxEnum;
+	      else if (strcmp(name,"HydrologySpchead")==0) return HydrologySpcheadEnum;
+	      else if (strcmp(name,"HydrologyConductivity")==0) return HydrologyConductivityEnum;
 	      else if (strcmp(name,"IndependentObject")==0) return IndependentObjectEnum;
 	      else if (strcmp(name,"InversionControlParameters")==0) return InversionControlParametersEnum;
 	      else if (strcmp(name,"InversionControlScalingFactors")==0) return InversionControlScalingFactorsEnum;
@@ -188,6 +225,8 @@
 	      else if (strcmp(name,"InversionVyObs")==0) return InversionVyObsEnum;
 	      else if (strcmp(name,"InversionVzObs")==0) return InversionVzObsEnum;
 	      else if (strcmp(name,"MaskIceLevelset")==0) return MaskIceLevelsetEnum;
+	      else if (strcmp(name,"MaskOceanLevelset")==0) return MaskOceanLevelsetEnum;
+	      else if (strcmp(name,"MaskLandLevelset")==0) return MaskLandLevelsetEnum;
 	      else if (strcmp(name,"MaterialsBeta")==0) return MaterialsBetaEnum;
 	      else if (strcmp(name,"MaterialsHeatcapacity")==0) return MaterialsHeatcapacityEnum;
 	      else if (strcmp(name,"MaterialsLatentheat")==0) return MaterialsLatentheatEnum;
@@ -209,10 +248,8 @@
 	      else if (strcmp(name,"DamageElementinterp")==0) return DamageElementinterpEnum;
 	      else if (strcmp(name,"DamageHealing")==0) return DamageHealingEnum;
 	      else if (strcmp(name,"DamageStressThreshold")==0) return DamageStressThresholdEnum;
+	      else if (strcmp(name,"DamageKappa")==0) return DamageKappaEnum;
 	      else if (strcmp(name,"DamageStabilization")==0) return DamageStabilizationEnum;
-	      else if (strcmp(name,"DamagePenaltyThreshold")==0) return DamagePenaltyThresholdEnum;
-	      else if (strcmp(name,"DamagePenaltyLock")==0) return DamagePenaltyLockEnum;
-	      else if (strcmp(name,"DamagePenaltyFactor")==0) return DamagePenaltyFactorEnum;
 	      else if (strcmp(name,"DamageMaxiter")==0) return DamageMaxiterEnum;
 	      else if (strcmp(name,"DamageSpcdamage")==0) return DamageSpcdamageEnum;
 	      else if (strcmp(name,"DamageMaxDamage")==0) return DamageMaxDamageEnum;
@@ -222,18 +259,19 @@
 	      else if (strcmp(name,"Damage")==0) return DamageEnum;
 	      else if (strcmp(name,"NewDamage")==0) return NewDamageEnum;
 	      else if (strcmp(name,"StressIntensityFactor")==0) return StressIntensityFactorEnum;
-	      else if (strcmp(name,"CalvingLaw")==0) return CalvingLawEnum;
+         else stage=3;
+   }
+   if(stage==3){
+	      if (strcmp(name,"CalvingLaw")==0) return CalvingLawEnum;
 	      else if (strcmp(name,"CalvingCalvingrate")==0) return CalvingCalvingrateEnum;
 	      else if (strcmp(name,"CalvingMeltingrate")==0) return CalvingMeltingrateEnum;
 	      else if (strcmp(name,"CalvingLevermann")==0) return CalvingLevermannEnum;
-	      else if (strcmp(name,"CalvingPi")==0) return CalvingPiEnum;
 	      else if (strcmp(name,"CalvingDev")==0) return CalvingDevEnum;
 	      else if (strcmp(name,"DefaultCalving")==0) return DefaultCalvingEnum;
 	      else if (strcmp(name,"CalvingRequestedOutputs")==0) return CalvingRequestedOutputsEnum;
 	      else if (strcmp(name,"CalvinglevermannCoeff")==0) return CalvinglevermannCoeffEnum;
 	      else if (strcmp(name,"CalvinglevermannMeltingrate")==0) return CalvinglevermannMeltingrateEnum;
-	      else if (strcmp(name,"CalvingpiCoeff")==0) return CalvingpiCoeffEnum;
-	      else if (strcmp(name,"CalvingpiMeltingrate")==0) return CalvingpiMeltingrateEnum;
+	      else if (strcmp(name,"CalvingdevCoeff")==0) return CalvingdevCoeffEnum;
 	      else if (strcmp(name,"Calvingratex")==0) return CalvingratexEnum;
 	      else if (strcmp(name,"Calvingratey")==0) return CalvingrateyEnum;
 	      else if (strcmp(name,"CalvingratexAverage")==0) return CalvingratexAverageEnum;
@@ -252,6 +290,7 @@
 	      else if (strcmp(name,"MaterialsLithosphereDensity")==0) return MaterialsLithosphereDensityEnum;
 	      else if (strcmp(name,"MaterialsMantleShearModulus")==0) return MaterialsMantleShearModulusEnum;
 	      else if (strcmp(name,"MaterialsMantleDensity")==0) return MaterialsMantleDensityEnum;
+	      else if (strcmp(name,"MaterialsEarthDensity")==0) return MaterialsEarthDensityEnum;
 	      else if (strcmp(name,"MeshAverageVertexConnectivity")==0) return MeshAverageVertexConnectivityEnum;
 	      else if (strcmp(name,"MeshElements2d")==0) return MeshElements2dEnum;
 	      else if (strcmp(name,"MeshElements")==0) return MeshElementsEnum;
@@ -259,10 +298,7 @@
 	      else if (strcmp(name,"MeshNumberofelements2d")==0) return MeshNumberofelements2dEnum;
 	      else if (strcmp(name,"MeshNumberofelements")==0) return MeshNumberofelementsEnum;
 	      else if (strcmp(name,"MeshNumberoflayers")==0) return MeshNumberoflayersEnum;
-         else stage=3;
-   }
-   if(stage==3){
-	      if (strcmp(name,"MeshNumberofvertices2d")==0) return MeshNumberofvertices2dEnum;
+	      else if (strcmp(name,"MeshNumberofvertices2d")==0) return MeshNumberofvertices2dEnum;
 	      else if (strcmp(name,"MeshNumberofvertices")==0) return MeshNumberofverticesEnum;
 	      else if (strcmp(name,"MeshUpperelements")==0) return MeshUpperelementsEnum;
 	      else if (strcmp(name,"MeshVertexonbase")==0) return MeshVertexonbaseEnum;
@@ -271,12 +307,17 @@
 	      else if (strcmp(name,"MeshX")==0) return MeshXEnum;
 	      else if (strcmp(name,"MeshY")==0) return MeshYEnum;
 	      else if (strcmp(name,"MeshZ")==0) return MeshZEnum;
+	      else if (strcmp(name,"MeshLat")==0) return MeshLatEnum;
+	      else if (strcmp(name,"MeshLong")==0) return MeshLongEnum;
+	      else if (strcmp(name,"MeshR")==0) return MeshREnum;
 	      else if (strcmp(name,"MeshElementtype")==0) return MeshElementtypeEnum;
+	      else if (strcmp(name,"MeshSegments")==0) return MeshSegmentsEnum;
 	      else if (strcmp(name,"DomainType")==0) return DomainTypeEnum;
 	      else if (strcmp(name,"DomainDimension")==0) return DomainDimensionEnum;
 	      else if (strcmp(name,"Domain2Dhorizontal")==0) return Domain2DhorizontalEnum;
 	      else if (strcmp(name,"Domain2Dvertical")==0) return Domain2DverticalEnum;
 	      else if (strcmp(name,"Domain3D")==0) return Domain3DEnum;
+	      else if (strcmp(name,"Domain3Dsurface")==0) return Domain3DsurfaceEnum;
 	      else if (strcmp(name,"MiscellaneousName")==0) return MiscellaneousNameEnum;
 	      else if (strcmp(name,"MasstransportHydrostaticAdjustment")==0) return MasstransportHydrostaticAdjustmentEnum;
 	      else if (strcmp(name,"MasstransportIsfreesurface")==0) return MasstransportIsfreesurfaceEnum;
@@ -302,12 +343,12 @@
 	      else if (strcmp(name,"SettingsIoGather")==0) return SettingsIoGatherEnum;
 	      else if (strcmp(name,"SettingsLowmem")==0) return SettingsLowmemEnum;
 	      else if (strcmp(name,"SettingsOutputFrequency")==0) return SettingsOutputFrequencyEnum;
+	      else if (strcmp(name,"SettingsRecordingFrequency")==0) return SettingsRecordingFrequencyEnum;
 	      else if (strcmp(name,"SettingsWaitonlock")==0) return SettingsWaitonlockEnum;
 	      else if (strcmp(name,"DebugProfiling")==0) return DebugProfilingEnum;
 	      else if (strcmp(name,"ProfilingCurrentMem")==0) return ProfilingCurrentMemEnum;
 	      else if (strcmp(name,"ProfilingCurrentFlops")==0) return ProfilingCurrentFlopsEnum;
 	      else if (strcmp(name,"ProfilingSolutionTime")==0) return ProfilingSolutionTimeEnum;
-	      else if (strcmp(name,"MaxIterationConvergenceFlag")==0) return MaxIterationConvergenceFlagEnum;
 	      else if (strcmp(name,"SteadystateMaxiter")==0) return SteadystateMaxiterEnum;
 	      else if (strcmp(name,"SteadystateNumRequestedOutputs")==0) return SteadystateNumRequestedOutputsEnum;
 	      else if (strcmp(name,"SteadystateReltol")==0) return SteadystateReltolEnum;
@@ -333,14 +374,20 @@
 	      else if (strcmp(name,"TimesteppingTimeAdapt")==0) return TimesteppingTimeAdaptEnum;
 	      else if (strcmp(name,"TimesteppingTimeStep")==0) return TimesteppingTimeStepEnum;
 	      else if (strcmp(name,"TimesteppingInterpForcings")==0) return TimesteppingInterpForcingsEnum;
+	      else if (strcmp(name,"TransientIssmb")==0) return TransientIssmbEnum;
+	      else if (strcmp(name,"TransientIscoupler")==0) return TransientIscouplerEnum;
 	      else if (strcmp(name,"TransientIsstressbalance")==0) return TransientIsstressbalanceEnum;
 	      else if (strcmp(name,"TransientIsgroundingline")==0) return TransientIsgroundinglineEnum;
 	      else if (strcmp(name,"TransientIsmasstransport")==0) return TransientIsmasstransportEnum;
 	      else if (strcmp(name,"TransientIsthermal")==0) return TransientIsthermalEnum;
 	      else if (strcmp(name,"TransientIsgia")==0) return TransientIsgiaEnum;
 	      else if (strcmp(name,"TransientIsdamageevolution")==0) return TransientIsdamageevolutionEnum;
-	      else if (strcmp(name,"TransientIshydrology")==0) return TransientIshydrologyEnum;
-	      else if (strcmp(name,"TransientIscalving")==0) return TransientIscalvingEnum;
+         else stage=4;
+   }
+   if(stage==4){
+	      if (strcmp(name,"TransientIshydrology")==0) return TransientIshydrologyEnum;
+	      else if (strcmp(name,"TransientIsmovingfront")==0) return TransientIsmovingfrontEnum;
+	      else if (strcmp(name,"TransientIsslr")==0) return TransientIsslrEnum;
 	      else if (strcmp(name,"TransientNumRequestedOutputs")==0) return TransientNumRequestedOutputsEnum;
 	      else if (strcmp(name,"TransientRequestedOutputs")==0) return TransientRequestedOutputsEnum;
 	      else if (strcmp(name,"Potential")==0) return PotentialEnum;
@@ -351,46 +398,101 @@
 	      else if (strcmp(name,"BalancethicknessCmu")==0) return BalancethicknessCmuEnum;
 	      else if (strcmp(name,"BalancethicknessOmega")==0) return BalancethicknessOmegaEnum;
 	      else if (strcmp(name,"BalancethicknessD0")==0) return BalancethicknessD0Enum;
-	      else if (strcmp(name,"Surfaceforcings")==0) return SurfaceforcingsEnum;
-	      else if (strcmp(name,"SMB")==0) return SMBEnum;
-	      else if (strcmp(name,"SurfaceforcingsMassBalance")==0) return SurfaceforcingsMassBalanceEnum;
+	      else if (strcmp(name,"Smb")==0) return SmbEnum;
+	      else if (strcmp(name,"SmbAnalysis")==0) return SmbAnalysisEnum;
+	      else if (strcmp(name,"SmbSolution")==0) return SmbSolutionEnum;
+	      else if (strcmp(name,"SmbNumRequestedOutputs")==0) return SmbNumRequestedOutputsEnum;
+	      else if (strcmp(name,"SmbRequestedOutputs")==0) return SmbRequestedOutputsEnum;
+	      else if (strcmp(name,"SmbIsInitialized")==0) return SmbIsInitializedEnum;
+	      else if (strcmp(name,"SMBforcing")==0) return SMBforcingEnum;
+	      else if (strcmp(name,"SmbMassBalance")==0) return SmbMassBalanceEnum;
+	      else if (strcmp(name,"SMBgemb")==0) return SMBgembEnum;
+	      else if (strcmp(name,"SmbInitDensityScaling")==0) return SmbInitDensityScalingEnum;
+	      else if (strcmp(name,"SmbTa")==0) return SmbTaEnum;
+	      else if (strcmp(name,"SmbV")==0) return SmbVEnum;
+	      else if (strcmp(name,"SmbDswrf")==0) return SmbDswrfEnum;
+	      else if (strcmp(name,"SmbDlwrf")==0) return SmbDlwrfEnum;
+	      else if (strcmp(name,"SmbP")==0) return SmbPEnum;
+	      else if (strcmp(name,"SmbSwf")==0) return SmbSwfEnum;
+	      else if (strcmp(name,"SmbEAir")==0) return SmbEAirEnum;
+	      else if (strcmp(name,"SmbPAir")==0) return SmbPAirEnum;
+	      else if (strcmp(name,"SmbTmean")==0) return SmbTmeanEnum;
+	      else if (strcmp(name,"SmbC")==0) return SmbCEnum;
+	      else if (strcmp(name,"SmbTz")==0) return SmbTzEnum;
+	      else if (strcmp(name,"SmbVz")==0) return SmbVzEnum;
+	      else if (strcmp(name,"SmbDt")==0) return SmbDtEnum;
+	      else if (strcmp(name,"SmbDz")==0) return SmbDzEnum;
+	      else if (strcmp(name,"SmbAIdx")==0) return SmbAIdxEnum;
+	      else if (strcmp(name,"SmbSwIdx")==0) return SmbSwIdxEnum;
+	      else if (strcmp(name,"SmbDenIdx")==0) return SmbDenIdxEnum;
+	      else if (strcmp(name,"SmbZTop")==0) return SmbZTopEnum;
+	      else if (strcmp(name,"SmbDzTop")==0) return SmbDzTopEnum;
+	      else if (strcmp(name,"SmbDzMin")==0) return SmbDzMinEnum;
+	      else if (strcmp(name,"SmbZY")==0) return SmbZYEnum;
+	      else if (strcmp(name,"SmbZMax")==0) return SmbZMaxEnum;
+	      else if (strcmp(name,"SmbZMin")==0) return SmbZMinEnum;
+	      else if (strcmp(name,"SmbOutputFreq")==0) return SmbOutputFreqEnum;
+	      else if (strcmp(name,"SmbASnow")==0) return SmbASnowEnum;
+	      else if (strcmp(name,"SmbAIce")==0) return SmbAIceEnum;
+	      else if (strcmp(name,"SmbCldFrac")==0) return SmbCldFracEnum;
+	      else if (strcmp(name,"SmbT0wet")==0) return SmbT0wetEnum;
+	      else if (strcmp(name,"SmbT0dry")==0) return SmbT0dryEnum;
+	      else if (strcmp(name,"SmbK")==0) return SmbKEnum;
+	      else if (strcmp(name,"SmbD")==0) return SmbDEnum;
+	      else if (strcmp(name,"SmbRe")==0) return SmbReEnum;
+	      else if (strcmp(name,"SmbGdn")==0) return SmbGdnEnum;
+	      else if (strcmp(name,"SmbGsp")==0) return SmbGspEnum;
+	      else if (strcmp(name,"SmbEC")==0) return SmbECEnum;
+	      else if (strcmp(name,"SmbCondensation")==0) return SmbCondensationEnum;
+	      else if (strcmp(name,"SmbW")==0) return SmbWEnum;
+	      else if (strcmp(name,"SmbA")==0) return SmbAEnum;
+	      else if (strcmp(name,"SmbT")==0) return SmbTEnum;
+	      else if (strcmp(name,"SmbIsgraingrowth")==0) return SmbIsgraingrowthEnum;
+	      else if (strcmp(name,"SmbIsalbedo")==0) return SmbIsalbedoEnum;
+	      else if (strcmp(name,"SmbIsshortwave")==0) return SmbIsshortwaveEnum;
+	      else if (strcmp(name,"SmbIsthermal")==0) return SmbIsthermalEnum;
+	      else if (strcmp(name,"SmbIsaccumulation")==0) return SmbIsaccumulationEnum;
+	      else if (strcmp(name,"SmbIsmelt")==0) return SmbIsmeltEnum;
+	      else if (strcmp(name,"SmbIsdensification")==0) return SmbIsdensificationEnum;
+	      else if (strcmp(name,"SmbIsturbulentflux")==0) return SmbIsturbulentfluxEnum;
 	      else if (strcmp(name,"SMBpdd")==0) return SMBpddEnum;
-	      else if (strcmp(name,"SurfaceforcingsDelta18o")==0) return SurfaceforcingsDelta18oEnum;
-	      else if (strcmp(name,"SurfaceforcingsDelta18oSurface")==0) return SurfaceforcingsDelta18oSurfaceEnum;
-	      else if (strcmp(name,"SurfaceforcingsIsdelta18o")==0) return SurfaceforcingsIsdelta18oEnum;
-	      else if (strcmp(name,"SurfaceforcingsIsmungsm")==0) return SurfaceforcingsIsmungsmEnum;
-	      else if (strcmp(name,"SurfaceforcingsPrecipitationsPresentday")==0) return SurfaceforcingsPrecipitationsPresentdayEnum;
-	      else if (strcmp(name,"SurfaceforcingsPrecipitationsLgm")==0) return SurfaceforcingsPrecipitationsLgmEnum;
-	      else if (strcmp(name,"SurfaceforcingsTemperaturesPresentday")==0) return SurfaceforcingsTemperaturesPresentdayEnum;
-	      else if (strcmp(name,"SurfaceforcingsTemperaturesLgm")==0) return SurfaceforcingsTemperaturesLgmEnum;
-	      else if (strcmp(name,"SurfaceforcingsPrecipitation")==0) return SurfaceforcingsPrecipitationEnum;
-	      else if (strcmp(name,"SurfaceforcingsDesfac")==0) return SurfaceforcingsDesfacEnum;
-	      else if (strcmp(name,"SurfaceforcingsS0p")==0) return SurfaceforcingsS0pEnum;
-	      else if (strcmp(name,"SurfaceforcingsS0t")==0) return SurfaceforcingsS0tEnum;
-	      else if (strcmp(name,"SurfaceforcingsRlaps")==0) return SurfaceforcingsRlapsEnum;
-	      else if (strcmp(name,"SurfaceforcingsRlapslgm")==0) return SurfaceforcingsRlapslgmEnum;
-	      else if (strcmp(name,"SurfaceforcingsPfac")==0) return SurfaceforcingsPfacEnum;
-	      else if (strcmp(name,"SurfaceforcingsTdiff")==0) return SurfaceforcingsTdiffEnum;
-	      else if (strcmp(name,"SurfaceforcingsSealev")==0) return SurfaceforcingsSealevEnum;
+	      else if (strcmp(name,"SmbDelta18o")==0) return SmbDelta18oEnum;
+	      else if (strcmp(name,"SmbDelta18oSurface")==0) return SmbDelta18oSurfaceEnum;
+	      else if (strcmp(name,"SmbIsdelta18o")==0) return SmbIsdelta18oEnum;
+	      else if (strcmp(name,"SmbIsmungsm")==0) return SmbIsmungsmEnum;
+	      else if (strcmp(name,"SmbIsd18opd")==0) return SmbIsd18opdEnum;
+	      else if (strcmp(name,"SmbPrecipitationsPresentday")==0) return SmbPrecipitationsPresentdayEnum;
+	      else if (strcmp(name,"SmbPrecipitationsLgm")==0) return SmbPrecipitationsLgmEnum;
+	      else if (strcmp(name,"SmbTemperaturesPresentday")==0) return SmbTemperaturesPresentdayEnum;
+	      else if (strcmp(name,"SmbTemperaturesLgm")==0) return SmbTemperaturesLgmEnum;
+	      else if (strcmp(name,"SmbPrecipitation")==0) return SmbPrecipitationEnum;
+	      else if (strcmp(name,"SmbDesfac")==0) return SmbDesfacEnum;
+	      else if (strcmp(name,"SmbS0p")==0) return SmbS0pEnum;
+	      else if (strcmp(name,"SmbS0t")==0) return SmbS0tEnum;
+	      else if (strcmp(name,"SmbRlaps")==0) return SmbRlapsEnum;
+	      else if (strcmp(name,"SmbRlapslgm")==0) return SmbRlapslgmEnum;
+	      else if (strcmp(name,"SmbPfac")==0) return SmbPfacEnum;
+	      else if (strcmp(name,"SmbTdiff")==0) return SmbTdiffEnum;
+	      else if (strcmp(name,"SmbSealev")==0) return SmbSealevEnum;
+	      else if (strcmp(name,"SMBd18opdd")==0) return SMBd18opddEnum;
+	      else if (strcmp(name,"SmbDpermil")==0) return SmbDpermilEnum;
 	      else if (strcmp(name,"SMBgradients")==0) return SMBgradientsEnum;
-	      else if (strcmp(name,"SurfaceforcingsMonthlytemperatures")==0) return SurfaceforcingsMonthlytemperaturesEnum;
-	      else if (strcmp(name,"SurfaceforcingsHref")==0) return SurfaceforcingsHrefEnum;
-	      else if (strcmp(name,"SurfaceforcingsSmbref")==0) return SurfaceforcingsSmbrefEnum;
-	      else if (strcmp(name,"SurfaceforcingsBPos")==0) return SurfaceforcingsBPosEnum;
-	      else if (strcmp(name,"SurfaceforcingsBNeg")==0) return SurfaceforcingsBNegEnum;
+	      else if (strcmp(name,"SmbMonthlytemperatures")==0) return SmbMonthlytemperaturesEnum;
+	      else if (strcmp(name,"SmbHref")==0) return SmbHrefEnum;
+	      else if (strcmp(name,"SmbSmbref")==0) return SmbSmbrefEnum;
+	      else if (strcmp(name,"SmbBPos")==0) return SmbBPosEnum;
+	      else if (strcmp(name,"SmbBNeg")==0) return SmbBNegEnum;
 	      else if (strcmp(name,"SMBhenning")==0) return SMBhenningEnum;
 	      else if (strcmp(name,"SMBcomponents")==0) return SMBcomponentsEnum;
-	      else if (strcmp(name,"SurfaceforcingsAccumulation")==0) return SurfaceforcingsAccumulationEnum;
-	      else if (strcmp(name,"SurfaceforcingsEvaporation")==0) return SurfaceforcingsEvaporationEnum;
-         else stage=4;
-   }
-   if(stage==4){
-	      if (strcmp(name,"SurfaceforcingsRunoff")==0) return SurfaceforcingsRunoffEnum;
+	      else if (strcmp(name,"SmbAccumulation")==0) return SmbAccumulationEnum;
+	      else if (strcmp(name,"SmbEvaporation")==0) return SmbEvaporationEnum;
+	      else if (strcmp(name,"SmbRunoff")==0) return SmbRunoffEnum;
 	      else if (strcmp(name,"SMBmeltcomponents")==0) return SMBmeltcomponentsEnum;
-	      else if (strcmp(name,"SurfaceforcingsMelt")==0) return SurfaceforcingsMeltEnum;
-	      else if (strcmp(name,"SurfaceforcingsRefreeze")==0) return SurfaceforcingsRefreezeEnum;
-	      else if (strcmp(name,"SurfaceforcingsIspdd")==0) return SurfaceforcingsIspddEnum;
-	      else if (strcmp(name,"SurfaceforcingsIssmbgradients")==0) return SurfaceforcingsIssmbgradientsEnum;
+	      else if (strcmp(name,"SmbMelt")==0) return SmbMeltEnum;
+	      else if (strcmp(name,"SmbRefreeze")==0) return SmbRefreezeEnum;
+	      else if (strcmp(name,"SMBgcm")==0) return SMBgcmEnum;
+	      else if (strcmp(name,"SmbIspdd")==0) return SmbIspddEnum;
+	      else if (strcmp(name,"SmbIssmbgradients")==0) return SmbIssmbgradientsEnum;
 	      else if (strcmp(name,"SolutionType")==0) return SolutionTypeEnum;
 	      else if (strcmp(name,"AnalysisType")==0) return AnalysisTypeEnum;
 	      else if (strcmp(name,"ConfigurationType")==0) return ConfigurationTypeEnum;
@@ -403,7 +505,10 @@
 	      else if (strcmp(name,"BalancethicknessSolution")==0) return BalancethicknessSolutionEnum;
 	      else if (strcmp(name,"Balancethickness2Analysis")==0) return Balancethickness2AnalysisEnum;
 	      else if (strcmp(name,"Balancethickness2Solution")==0) return Balancethickness2SolutionEnum;
-	      else if (strcmp(name,"BalancethicknessSoftAnalysis")==0) return BalancethicknessSoftAnalysisEnum;
+         else stage=5;
+   }
+   if(stage==5){
+	      if (strcmp(name,"BalancethicknessSoftAnalysis")==0) return BalancethicknessSoftAnalysisEnum;
 	      else if (strcmp(name,"BalancethicknessSoftSolution")==0) return BalancethicknessSoftSolutionEnum;
 	      else if (strcmp(name,"BalancevelocityAnalysis")==0) return BalancevelocityAnalysisEnum;
 	      else if (strcmp(name,"BalancevelocitySolution")==0) return BalancevelocitySolutionEnum;
@@ -422,6 +527,7 @@
 	      else if (strcmp(name,"HydrologyShreveAnalysis")==0) return HydrologyShreveAnalysisEnum;
 	      else if (strcmp(name,"HydrologyDCInefficientAnalysis")==0) return HydrologyDCInefficientAnalysisEnum;
 	      else if (strcmp(name,"HydrologyDCEfficientAnalysis")==0) return HydrologyDCEfficientAnalysisEnum;
+	      else if (strcmp(name,"HydrologySommersAnalysis")==0) return HydrologySommersAnalysisEnum;
 	      else if (strcmp(name,"HydrologySolution")==0) return HydrologySolutionEnum;
 	      else if (strcmp(name,"MeltingAnalysis")==0) return MeltingAnalysisEnum;
 	      else if (strcmp(name,"MasstransportAnalysis")==0) return MasstransportAnalysisEnum;
@@ -459,6 +565,7 @@
 	      else if (strcmp(name,"FSApproximation")==0) return FSApproximationEnum;
 	      else if (strcmp(name,"FSvelocity")==0) return FSvelocityEnum;
 	      else if (strcmp(name,"FSpressure")==0) return FSpressureEnum;
+	      else if (strcmp(name,"DataSet")==0) return DataSetEnum;
 	      else if (strcmp(name,"Constraints")==0) return ConstraintsEnum;
 	      else if (strcmp(name,"Loads")==0) return LoadsEnum;
 	      else if (strcmp(name,"Materials")==0) return MaterialsEnum;
@@ -475,12 +582,15 @@
 	      else if (strcmp(name,"ControlInput")==0) return ControlInputEnum;
 	      else if (strcmp(name,"DatasetInput")==0) return DatasetInputEnum;
 	      else if (strcmp(name,"DoubleInput")==0) return DoubleInputEnum;
+	      else if (strcmp(name,"DoubleArrayInput")==0) return DoubleArrayInputEnum;
 	      else if (strcmp(name,"DataSetParam")==0) return DataSetParamEnum;
 	      else if (strcmp(name,"DoubleMatArrayParam")==0) return DoubleMatArrayParamEnum;
 	      else if (strcmp(name,"DoubleMatParam")==0) return DoubleMatParamEnum;
 	      else if (strcmp(name,"DoubleParam")==0) return DoubleParamEnum;
 	      else if (strcmp(name,"DoubleVecParam")==0) return DoubleVecParamEnum;
 	      else if (strcmp(name,"Element")==0) return ElementEnum;
+	      else if (strcmp(name,"ElementHook")==0) return ElementHookEnum;
+	      else if (strcmp(name,"Hook")==0) return HookEnum;
 	      else if (strcmp(name,"ExternalResult")==0) return ExternalResultEnum;
 	      else if (strcmp(name,"FileParam")==0) return FileParamEnum;
 	      else if (strcmp(name,"Input")==0) return InputEnum;
@@ -499,16 +609,15 @@
 	      else if (strcmp(name,"Node")==0) return NodeEnum;
 	      else if (strcmp(name,"Numericalflux")==0) return NumericalfluxEnum;
 	      else if (strcmp(name,"NumericalfluxType")==0) return NumericalfluxTypeEnum;
+	      else if (strcmp(name,"Neumannflux")==0) return NeumannfluxEnum;
 	      else if (strcmp(name,"Param")==0) return ParamEnum;
+	      else if (strcmp(name,"Moulin")==0) return MoulinEnum;
 	      else if (strcmp(name,"Pengrid")==0) return PengridEnum;
 	      else if (strcmp(name,"Penpair")==0) return PenpairEnum;
 	      else if (strcmp(name,"Profiler")==0) return ProfilerEnum;
 	      else if (strcmp(name,"MatrixParam")==0) return MatrixParamEnum;
 	      else if (strcmp(name,"Masscon")==0) return MassconEnum;
-         else stage=5;
-   }
-   if(stage==5){
-	      if (strcmp(name,"MassconName")==0) return MassconNameEnum;
+	      else if (strcmp(name,"MassconName")==0) return MassconNameEnum;
 	      else if (strcmp(name,"MassconDefinitionenum")==0) return MassconDefinitionenumEnum;
 	      else if (strcmp(name,"MassconLevelset")==0) return MassconLevelsetEnum;
 	      else if (strcmp(name,"Massconaxpby")==0) return MassconaxpbyEnum;
@@ -519,7 +628,10 @@
 	      else if (strcmp(name,"MassconaxpbyAlpha")==0) return MassconaxpbyAlphaEnum;
 	      else if (strcmp(name,"MassconaxpbyBeta")==0) return MassconaxpbyBetaEnum;
 	      else if (strcmp(name,"NodeSId")==0) return NodeSIdEnum;
-	      else if (strcmp(name,"VectorParam")==0) return VectorParamEnum;
+         else stage=6;
+   }
+   if(stage==6){
+	      if (strcmp(name,"VectorParam")==0) return VectorParamEnum;
 	      else if (strcmp(name,"Riftfront")==0) return RiftfrontEnum;
 	      else if (strcmp(name,"RiftfrontType")==0) return RiftfrontTypeEnum;
 	      else if (strcmp(name,"Segment")==0) return SegmentEnum;
@@ -578,6 +690,7 @@
 	      else if (strcmp(name,"SurfaceSlopeY")==0) return SurfaceSlopeYEnum;
 	      else if (strcmp(name,"Temperature")==0) return TemperatureEnum;
 	      else if (strcmp(name,"TemperaturePicard")==0) return TemperaturePicardEnum;
+	      else if (strcmp(name,"TemperaturePDD")==0) return TemperaturePDDEnum;
 	      else if (strcmp(name,"ThicknessAbsMisfit")==0) return ThicknessAbsMisfitEnum;
 	      else if (strcmp(name,"SurfaceAbsMisfit")==0) return SurfaceAbsMisfitEnum;
 	      else if (strcmp(name,"Vel")==0) return VelEnum;
@@ -601,6 +714,7 @@
 	      else if (strcmp(name,"ThicknessAbsGradient")==0) return ThicknessAbsGradientEnum;
 	      else if (strcmp(name,"ThicknessAlongGradient")==0) return ThicknessAlongGradientEnum;
 	      else if (strcmp(name,"ThicknessAcrossGradient")==0) return ThicknessAcrossGradientEnum;
+	      else if (strcmp(name,"ThicknessPositive")==0) return ThicknessPositiveEnum;
 	      else if (strcmp(name,"IntMatParam")==0) return IntMatParamEnum;
 	      else if (strcmp(name,"RheologyBbarAbsGradient")==0) return RheologyBbarAbsGradientEnum;
 	      else if (strcmp(name,"RheologyBAbsGradient")==0) return RheologyBAbsGradientEnum;
@@ -628,24 +742,26 @@
 	      else if (strcmp(name,"DeviatoricStressxy")==0) return DeviatoricStressxyEnum;
 	      else if (strcmp(name,"DeviatoricStressxz")==0) return DeviatoricStressxzEnum;
 	      else if (strcmp(name,"DeviatoricStressyy")==0) return DeviatoricStressyyEnum;
-         else stage=6;
-   }
-   if(stage==6){
-	      if (strcmp(name,"DeviatoricStressyz")==0) return DeviatoricStressyzEnum;
+	      else if (strcmp(name,"DeviatoricStressyz")==0) return DeviatoricStressyzEnum;
 	      else if (strcmp(name,"DeviatoricStresszz")==0) return DeviatoricStresszzEnum;
+	      else if (strcmp(name,"DeviatoricStresseffective")==0) return DeviatoricStresseffectiveEnum;
 	      else if (strcmp(name,"StrainRate")==0) return StrainRateEnum;
 	      else if (strcmp(name,"StrainRatexx")==0) return StrainRatexxEnum;
 	      else if (strcmp(name,"StrainRatexy")==0) return StrainRatexyEnum;
 	      else if (strcmp(name,"StrainRatexz")==0) return StrainRatexzEnum;
 	      else if (strcmp(name,"StrainRateyy")==0) return StrainRateyyEnum;
 	      else if (strcmp(name,"StrainRateyz")==0) return StrainRateyzEnum;
-	      else if (strcmp(name,"StrainRatezz")==0) return StrainRatezzEnum;
+         else stage=7;
+   }
+   if(stage==7){
+	      if (strcmp(name,"StrainRatezz")==0) return StrainRatezzEnum;
 	      else if (strcmp(name,"Divergence")==0) return DivergenceEnum;
 	      else if (strcmp(name,"MaxDivergence")==0) return MaxDivergenceEnum;
 	      else if (strcmp(name,"GiaCrossSectionShape")==0) return GiaCrossSectionShapeEnum;
 	      else if (strcmp(name,"GiadWdt")==0) return GiadWdtEnum;
 	      else if (strcmp(name,"GiaW")==0) return GiaWEnum;
 	      else if (strcmp(name,"P0")==0) return P0Enum;
+	      else if (strcmp(name,"P0Array")==0) return P0ArrayEnum;
 	      else if (strcmp(name,"P1")==0) return P1Enum;
 	      else if (strcmp(name,"P1DG")==0) return P1DGEnum;
 	      else if (strcmp(name,"P1bubble")==0) return P1bubbleEnum;
@@ -751,17 +867,17 @@
 	      else if (strcmp(name,"Outputdefinition71")==0) return Outputdefinition71Enum;
 	      else if (strcmp(name,"Outputdefinition72")==0) return Outputdefinition72Enum;
 	      else if (strcmp(name,"Outputdefinition73")==0) return Outputdefinition73Enum;
-         else stage=7;
-   }
-   if(stage==7){
-	      if (strcmp(name,"Outputdefinition74")==0) return Outputdefinition74Enum;
+	      else if (strcmp(name,"Outputdefinition74")==0) return Outputdefinition74Enum;
 	      else if (strcmp(name,"Outputdefinition75")==0) return Outputdefinition75Enum;
 	      else if (strcmp(name,"Outputdefinition76")==0) return Outputdefinition76Enum;
 	      else if (strcmp(name,"Outputdefinition77")==0) return Outputdefinition77Enum;
 	      else if (strcmp(name,"Outputdefinition78")==0) return Outputdefinition78Enum;
 	      else if (strcmp(name,"Outputdefinition79")==0) return Outputdefinition79Enum;
 	      else if (strcmp(name,"Outputdefinition80")==0) return Outputdefinition80Enum;
-	      else if (strcmp(name,"Outputdefinition81")==0) return Outputdefinition81Enum;
+         else stage=8;
+   }
+   if(stage==8){
+	      if (strcmp(name,"Outputdefinition81")==0) return Outputdefinition81Enum;
 	      else if (strcmp(name,"Outputdefinition82")==0) return Outputdefinition82Enum;
 	      else if (strcmp(name,"Outputdefinition83")==0) return Outputdefinition83Enum;
 	      else if (strcmp(name,"Outputdefinition84")==0) return Outputdefinition84Enum;
@@ -786,6 +902,11 @@
 	      else if (strcmp(name,"MassfluxatgateName")==0) return MassfluxatgateNameEnum;
 	      else if (strcmp(name,"MassfluxatgateDefinitionenum")==0) return MassfluxatgateDefinitionenumEnum;
 	      else if (strcmp(name,"MassfluxatgateSegments")==0) return MassfluxatgateSegmentsEnum;
+	      else if (strcmp(name,"Nodalvalue")==0) return NodalvalueEnum;
+	      else if (strcmp(name,"NodalvalueName")==0) return NodalvalueNameEnum;
+	      else if (strcmp(name,"NodalvalueDefinitionenum")==0) return NodalvalueDefinitionenumEnum;
+	      else if (strcmp(name,"NodalvalueModelEnum")==0) return NodalvalueModelEnumEnum;
+	      else if (strcmp(name,"NodalvalueNode")==0) return NodalvalueNodeEnum;
 	      else if (strcmp(name,"MisfitName")==0) return MisfitNameEnum;
 	      else if (strcmp(name,"MisfitDefinitionenum")==0) return MisfitDefinitionenumEnum;
 	      else if (strcmp(name,"MisfitModelEnum")==0) return MisfitModelEnumEnum;
@@ -812,9 +933,13 @@
 	      else if (strcmp(name,"MinVz")==0) return MinVzEnum;
 	      else if (strcmp(name,"MaxVz")==0) return MaxVzEnum;
 	      else if (strcmp(name,"MaxAbsVz")==0) return MaxAbsVzEnum;
+	      else if (strcmp(name,"FloatingArea")==0) return FloatingAreaEnum;
+	      else if (strcmp(name,"GroundedArea")==0) return GroundedAreaEnum;
 	      else if (strcmp(name,"IceMass")==0) return IceMassEnum;
 	      else if (strcmp(name,"IceVolume")==0) return IceVolumeEnum;
 	      else if (strcmp(name,"IceVolumeAboveFloatation")==0) return IceVolumeAboveFloatationEnum;
+	      else if (strcmp(name,"TotalFloatingBmb")==0) return TotalFloatingBmbEnum;
+	      else if (strcmp(name,"TotalGroundedBmb")==0) return TotalGroundedBmbEnum;
 	      else if (strcmp(name,"TotalSmb")==0) return TotalSmbEnum;
 	      else if (strcmp(name,"Absolute")==0) return AbsoluteEnum;
 	      else if (strcmp(name,"Incremental")==0) return IncrementalEnum;
@@ -851,12 +976,15 @@
 	      else if (strcmp(name,"Intersect")==0) return IntersectEnum;
 	      else if (strcmp(name,"Nodal")==0) return NodalEnum;
 	      else if (strcmp(name,"OldGradient")==0) return OldGradientEnum;
+	      else if (strcmp(name,"OutputBufferPointer")==0) return OutputBufferPointerEnum;
+	      else if (strcmp(name,"OutputBufferSizePointer")==0) return OutputBufferSizePointerEnum;
 	      else if (strcmp(name,"OutputFilePointer")==0) return OutputFilePointerEnum;
 	      else if (strcmp(name,"ToolkitsFileName")==0) return ToolkitsFileNameEnum;
 	      else if (strcmp(name,"RootPath")==0) return RootPathEnum;
 	      else if (strcmp(name,"OutputFileName")==0) return OutputFileNameEnum;
 	      else if (strcmp(name,"InputFileName")==0) return InputFileNameEnum;
 	      else if (strcmp(name,"LockFileName")==0) return LockFileNameEnum;
+	      else if (strcmp(name,"RestartFileName")==0) return RestartFileNameEnum;
 	      else if (strcmp(name,"ToolkitsOptionsAnalyses")==0) return ToolkitsOptionsAnalysesEnum;
 	      else if (strcmp(name,"ToolkitsOptionsStrings")==0) return ToolkitsOptionsStringsEnum;
 	      else if (strcmp(name,"QmuErrName")==0) return QmuErrNameEnum;
@@ -869,15 +997,15 @@
 	      else if (strcmp(name,"Verbose")==0) return VerboseEnum;
 	      else if (strcmp(name,"TriangleInterp")==0) return TriangleInterpEnum;
 	      else if (strcmp(name,"BilinearInterp")==0) return BilinearInterpEnum;
-	      else if (strcmp(name,"NearestInterp")==0) return NearestInterpEnum;
+         else stage=9;
+   }
+   if(stage==9){
+	      if (strcmp(name,"NearestInterp")==0) return NearestInterpEnum;
 	      else if (strcmp(name,"XY")==0) return XYEnum;
 	      else if (strcmp(name,"XYZ")==0) return XYZEnum;
 	      else if (strcmp(name,"Dense")==0) return DenseEnum;
 	      else if (strcmp(name,"MpiDense")==0) return MpiDenseEnum;
-         else stage=8;
-   }
-   if(stage==8){
-	      if (strcmp(name,"MpiSparse")==0) return MpiSparseEnum;
+	      else if (strcmp(name,"MpiSparse")==0) return MpiSparseEnum;
 	      else if (strcmp(name,"Seq")==0) return SeqEnum;
 	      else if (strcmp(name,"Mpi")==0) return MpiEnum;
 	      else if (strcmp(name,"Mumps")==0) return MumpsEnum;
@@ -890,14 +1018,35 @@
 	      else if (strcmp(name,"Paterson")==0) return PatersonEnum;
 	      else if (strcmp(name,"Arrhenius")==0) return ArrheniusEnum;
 	      else if (strcmp(name,"LliboutryDuval")==0) return LliboutryDuvalEnum;
-	      else if (strcmp(name,"TransientIslevelset")==0) return TransientIslevelsetEnum;
+	      else if (strcmp(name,"Spclevelset")==0) return SpclevelsetEnum;
 	      else if (strcmp(name,"ExtrapolationVariable")==0) return ExtrapolationVariableEnum;
 	      else if (strcmp(name,"IceMaskNodeActivation")==0) return IceMaskNodeActivationEnum;
 	      else if (strcmp(name,"LevelsetfunctionSlopeX")==0) return LevelsetfunctionSlopeXEnum;
 	      else if (strcmp(name,"LevelsetfunctionSlopeY")==0) return LevelsetfunctionSlopeYEnum;
 	      else if (strcmp(name,"LevelsetfunctionPicard")==0) return LevelsetfunctionPicardEnum;
+	      else if (strcmp(name,"LevelsetReinitFrequency")==0) return LevelsetReinitFrequencyEnum;
+	      else if (strcmp(name,"SealevelriseSolution")==0) return SealevelriseSolutionEnum;
+	      else if (strcmp(name,"SealevelriseAnalysis")==0) return SealevelriseAnalysisEnum;
+	      else if (strcmp(name,"Sealevel")==0) return SealevelEnum;
+	      else if (strcmp(name,"SealevelEustatic")==0) return SealevelEustaticEnum;
+	      else if (strcmp(name,"SealevelriseDeltathickness")==0) return SealevelriseDeltathicknessEnum;
+	      else if (strcmp(name,"SealevelriseMaxiter")==0) return SealevelriseMaxiterEnum;
+	      else if (strcmp(name,"SealevelriseReltol")==0) return SealevelriseReltolEnum;
+	      else if (strcmp(name,"SealevelriseAbstol")==0) return SealevelriseAbstolEnum;
+	      else if (strcmp(name,"SealevelriseLoveH")==0) return SealevelriseLoveHEnum;
+	      else if (strcmp(name,"SealevelriseLoveK")==0) return SealevelriseLoveKEnum;
+	      else if (strcmp(name,"SealevelriseTideLoveH")==0) return SealevelriseTideLoveHEnum;
+	      else if (strcmp(name,"SealevelriseTideLoveK")==0) return SealevelriseTideLoveKEnum;
+	      else if (strcmp(name,"SealevelriseRigid")==0) return SealevelriseRigidEnum;
+	      else if (strcmp(name,"SealevelriseElastic")==0) return SealevelriseElasticEnum;
+	      else if (strcmp(name,"SealevelriseRotation")==0) return SealevelriseRotationEnum;
+	      else if (strcmp(name,"SealevelriseGElastic")==0) return SealevelriseGElasticEnum;
+	      else if (strcmp(name,"SealevelriseDegacc")==0) return SealevelriseDegaccEnum;
+	      else if (strcmp(name,"SealevelriseTransitions")==0) return SealevelriseTransitionsEnum;
+	      else if (strcmp(name,"SealevelriseRequestedOutputs")==0) return SealevelriseRequestedOutputsEnum;
+	      else if (strcmp(name,"SealevelriseNumRequestedOutputs")==0) return SealevelriseNumRequestedOutputsEnum;
 	      else if (strcmp(name,"MaximumNumberOfDefinitions")==0) return MaximumNumberOfDefinitionsEnum;
-         else stage=9;
+         else stage=10;
    }
 	/*If we reach this point, the string provided has not been found*/
 	if(notfounderror)

Modified: issm/trunk/src/c/shared/Enum/Synchronize.sh
===================================================================
--- issm/trunk/src/c/shared/Enum/Synchronize.sh	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/shared/Enum/Synchronize.sh	2016-04-13 04:32:01 UTC (rev 20500)
@@ -7,6 +7,7 @@
 #Removed existing files
 rm $ISSM_DIR/src/m/enum/*.m
 rm $ISSM_DIR/src/m/enum/*.py
+rm $ISSM_DIR/src/m/enum/*.js
 rm $ISSM_DIR/src/c/shared/Enum/EnumToStringx.cpp
 rm $ISSM_DIR/src/c/shared/Enum/StringToEnumx.cpp
 
@@ -197,6 +198,24 @@
 cat temp |  awk '{print "def " $1"(): return StringToEnum(\"" substr($1,1,length($1)-4) "\")[0]"}' >> $ISSM_DIR/src/m/enum/EnumDefinitions.py
 #}}}
 
+#Deal with Javascript Enums
+#Build EnumDefinitions.js{{{
+cat <<END > $ISSM_DIR/src/m/enum/EnumDefinitions.js
+//WARNING: DO NOT MODIFY THIS FILE
+//this file has been automatically generated by src/c/shared/Enum/Synchronize.sh
+//Please read src/c/shared/Enum/README for more information
+END
+#core
+ENUM=0;
+for NAMEENUM in $(cat temp); do
+	#Get name and enum of the line i
+	NAME=$(echo $NAMEENUM | sed -e "s/Enum//g")
+	echo "function ${NAME}Enum(){ return $ENUM;}" >> $ISSM_DIR/src/m/enum/EnumDefinitions.js
+	#offset Enum by one (Enum begins with 0 and not 1!)
+	let ENUM=$ENUM+1
+done
+#}}}
+
 #Deal with Matlab Enums`
 ENUM=0;
 

Modified: issm/trunk/src/c/shared/Exceptions/Exceptions.cpp
===================================================================
--- issm/trunk/src/c/shared/Exceptions/Exceptions.cpp	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/shared/Exceptions/Exceptions.cpp	2016-04-13 04:32:01 UTC (rev 20500)
@@ -79,7 +79,7 @@
 
 	return;
 }/*}}}*/
-const char* ErrorException::MatlabReport() const{/*{{{*/
+const char* ErrorException::WrapperReport() const{/*{{{*/
 
 	/*Output*/
 	std::ostringstream buffer;
@@ -99,23 +99,3 @@
 	message = xNew<char>(strlen(buffer2.c_str())+1); sprintf(message,"%s",buffer2.c_str());
 	return message;
 }/*}}}*/
-const char* ErrorException::PythonReport() const{/*{{{*/
-
-	/*Output*/
-	std::ostringstream buffer;
-	char *message = NULL;
-
-	/*WINDOWS*/
-	if(!function_name || file_line==0){ 
-		buffer << " error message: " << this->what_str;
-	}
-	else{
-		buffer << "\nError in ==> " << this->file_name << ":" << file_line << "\n";
-		buffer << this->function_name << " error message: " << this->what_str;
-	}
-
-	/*Convert std::ostringstream to std::string and then create char* */
-	std::string buffer2 = buffer.str();
-	message = xNew<char>(strlen(buffer2.c_str())+1); sprintf(message,"%s",buffer2.c_str());
-	return message;
-}/*}}}*/

Modified: issm/trunk/src/c/shared/Exceptions/exceptions.h
===================================================================
--- issm/trunk/src/c/shared/Exceptions/exceptions.h	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/shared/Exceptions/exceptions.h	2016-04-13 04:32:01 UTC (rev 20500)
@@ -86,8 +86,7 @@
 	~ErrorException() throw();
 	virtual const char *what() const throw();
 	void Report() const;
-	const char* MatlabReport() const;
-	const char* PythonReport() const;
+	const char* WrapperReport() const;
 
 };
 /*}}}*/

Modified: issm/trunk/src/c/shared/FSanalyticals/fsanalyticals.cpp
===================================================================
--- issm/trunk/src/c/shared/FSanalyticals/fsanalyticals.cpp	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/shared/FSanalyticals/fsanalyticals.cpp	2016-04-13 04:32:01 UTC (rev 20500)
@@ -55,13 +55,16 @@
 			return 8.0*pow(PI, 2)*pow(x, 2)*(z - 2)*sin(4*PI*x*z) - 4.0*PI*x*cos(4*PI*x*z) + 16.0*pow(PI, 2)*pow(z, 2)*(z - 2)*sin(4*PI*x*z) - 0.25*PI*((16*pow(PI, 2)*x*z*(PI*x*z - PI*x)*cos(4*PI*x*z) + 4*pow(PI, 2)*x*z*(8*pow(PI, 2)*pow(x, 2)*pow(z, 2) - 16*pow(PI, 2)*pow(x, 2)*z - 1)*sin(4*PI*x*z) + 4*pow(PI, 2)*x*z*sin(4*PI*x*z) - 4*PI*x*(-PI*z + PI)*sin(4*PI*x*z) - 16*PI*x*(pow(PI, 2)*x*pow(z, 2) - 2*pow(PI, 2)*x*z)*cos(4*PI*x*z) - 16*PI*z*(pow(PI, 2)*pow(x, 2)*z - pow(PI, 2)*pow(x, 2))*cos(4*PI*x*z) + 4*PI*(PI*x*z - PI*x)*sin(4*PI*x*z) - 8*(pow(PI, 2)*x*z - pow(PI, 2)*x)*sin(4*PI*x*z) - PI*(8*pow(PI, 2)*pow(x, 2)*pow(z, 2) - 16*pow(PI, 2)*pow(x, 2)*z - 1)*cos(4*PI*x*z) - PI*cos(4*PI*x*z))/(pow(PI, 3)*pow(x, 3)) + 3*(-4*PI*x*(PI*x*z - PI*x)*sin(4*PI*x*z) + PI*x*(8*pow(PI, 2)*pow(x, 2)*pow(z, 2) - 16*pow(PI, 2)*pow(x, 2)*z - 1)*cos(4*PI*x*z) + PI*x*cos(4*PI*x*z) + 4*(pow(PI, 2)*pow(x, 2)*z - pow(PI, 2)*pow(x, 2))*sin(4*PI*x*z))/(pow(PI, 3)*pow(x, 4))) + 4*PI*sin(4*PI*z)*cos(4*PI*x);
 		case 14:
 			z=y;
-			return 8.0*pow(2, 1.0L/3.0L)*pow(M_PI, 2)*pow(z, 2)*(z - 2)*sin(4*M_PI*x*z)/pow(4.0*pow(M_PI, 2)*pow(z, 2)*pow(z - 2, 2)*pow(cos(4*M_PI*x*z), 2) + (1.0L/2.0L)*pow(2.0*M_PI*x*(z - 2)*cos(4*M_PI*x*z) - 0.0625*M_PI*(16*sin(4*M_PI*x)/(M_PI*pow(x, 2)) + 4*(8*pow(M_PI, 2)*pow(x, 2) + 1)*cos(4*M_PI*x)/(pow(M_PI, 2)*pow(x, 3)) + 4*(-4*M_PI*z*(M_PI*x*z - M_PI*x)*sin(4*M_PI*x*z) + M_PI*z*(8*pow(M_PI, 2)*pow(x, 2)*pow(z, 2) - 16*pow(M_PI, 2)*pow(x, 2)*z - 1)*cos(4*M_PI*x*z) - (-M_PI*z + M_PI)*cos(4*M_PI*x*z) + 4*(pow(M_PI, 2)*x*pow(z, 2) - 2*pow(M_PI, 2)*x*z)*sin(4*M_PI*x*z))/(pow(M_PI, 3)*pow(x, 3)) - 3*(8*pow(M_PI, 2)*pow(x, 2) + 1)*sin(4*M_PI*x)/(pow(M_PI, 3)*pow(x, 4)) - 3*(4*(M_PI*x*z - M_PI*x)*cos(4*M_PI*x*z) + (8*pow(M_PI, 2)*pow(x, 2)*pow(z, 2) - 16*pow(M_PI, 2)*pow(x, 2)*z - 1)*sin(4*M_PI*x*z))/(pow(M_PI, 3)*pow(x, 4))) + 0.5*sin(4*M_PI*x*z) + (2.0L/5.0L)*M_PI*cos(4*M_PI*x), 2) + pow(M_PI*x*(M_PI*x*z - M_PI*x)*sin(4*M_PI*x*z) - 0.25*M_PI*x*(8*pow(M_PI, 2)*pow(x, 2)*pow(z, 2) - 16*pow(M_PI, 2)*pow(x, 2)*z - 1)*cos(4*M_PI*x*z) - 0.25*M_PI*x*cos(4*M_PI*x*z) - (pow(M_PI, 2)*pow(x, 2)*z - pow(M_PI, 2)*pow(x, 2))*sin(4*M_PI*x*z), 2)/(pow(M_PI, 4)*pow(x, 6)), 1.0L/3.0L) - 0.0266666666666667*pow(2, 1.0L/3.0L)*M_PI*z*(z - 2)*(800.0*pow(M_PI, 3)*pow(z, 3)*pow(z - 2, 2)*sin(4*M_PI*x*z)*cos(4*M_PI*x*z) - (-10.0*M_PI*x*(z - 2)*cos(4*M_PI*x*z) + 0.3125*M_PI*(16*sin(4*M_PI*x)/(M_PI*pow(x, 2)) + 4*(8*pow(M_PI, 2)*pow(x, 2) + 1)*cos(4*M_PI*x)/(pow(M_PI, 2)*pow(x, 3)) + 4*(-4*M_PI*z*(M_PI*x*z - M_PI*x)*sin(4*M_PI*x*z) + M_PI*z*(8*pow(M_PI, 2)*pow(x, 2)*pow(z, 2) - 16*pow(M_PI, 2)*pow(x, 2)*z - 1)*cos(4*M_PI*x*z) - (-M_PI*z + M_PI)*cos(4*M_PI*x*z) + 4*(pow(M_PI, 2)*x*pow(z, 2) - 2*pow(M_PI, 2)*x*z)*sin(4*M_PI*x*z))/(pow(M_PI, 3)*pow(x, 3)) - 3*(8*pow(M_PI, 2)*pow(x, 2) + 1)*sin(4*M_PI*x)/(pow(M_PI, 3)*pow(x, 4)) - 3*(4*(M_PI*x*z - M_PI*x)*cos(4*M_PI*x*z) + (8*pow(M_PI, 2)*pow(x, 2)*pow(z, 2) - 16*pow(M_PI, 2)*pow(x, 2)*z - 1)*sin(4*M_PI*x*z))/(pow(M_PI, 3)*pow(x, 4))) - 2.5*sin(4*M_PI*x*z) - 2*M_PI*cos(4*M_PI*x))*(40.0*pow(M_PI, 2)*x*z*(z - 2)*sin(4*M_PI*x*z) - 10.0*M_PI*z*cos(4*M_PI*x*z) - 10.0*M_PI*(z - 2)*cos(4*M_PI*x*z) + 1.25*M_PI*(32*cos(4*M_PI*x)/pow(x, 2) - 4*(8*pow(M_PI, 2)*pow(x, 2) + 1)*sin(4*M_PI*x)/(M_PI*pow(x, 3)) - 4*(4*pow(M_PI, 2)*pow(z, 2)*(M_PI*x*z - M_PI*x)*cos(4*M_PI*x*z) + pow(M_PI, 2)*pow(z, 2)*(8*pow(M_PI, 2)*pow(x, 2)*pow(z, 2) - 16*pow(M_PI, 2)*pow(x, 2)*z - 1)*sin(4*M_PI*x*z) - 2*M_PI*z*(-M_PI*z + M_PI)*sin(4*M_PI*x*z) - 8*M_PI*z*(pow(M_PI, 2)*x*pow(z, 2) - 2*pow(M_PI, 2)*x*z)*cos(4*M_PI*x*z) - (pow(M_PI, 2)*pow(z, 2) - 2*pow(M_PI, 2)*z)*sin(4*M_PI*x*z))/(pow(M_PI, 3)*pow(x, 3)) - 20*sin(4*M_PI*x)/(M_PI*pow(x, 3)) - 6*(8*pow(M_PI, 2)*pow(x, 2) + 1)*cos(4*M_PI*x)/(pow(M_PI, 2)*pow(x, 4)) - 6*(-4*M_PI*z*(M_PI*x*z - M_PI*x)*sin(4*M_PI*x*z) + M_PI*z*(8*pow(M_PI, 2)*pow(x, 2)*pow(z, 2) - 16*pow(M_PI, 2)*pow(x, 2)*z - 1)*cos(4*M_PI*x*z) - (-M_PI*z + M_PI)*cos(4*M_PI*x*z) + 4*(pow(M_PI, 2)*x*pow(z, 2) - 2*pow(M_PI, 2)*x*z)*sin(4*M_PI*x*z))/(pow(M_PI, 3)*pow(x, 4)) + 3*(8*pow(M_PI, 2)*pow(x, 2) + 1)*sin(4*M_PI*x)/(pow(M_PI, 3)*pow(x, 5)) + 3*(4*(M_PI*x*z - M_PI*x)*cos(4*M_PI*x*z) + (8*pow(M_PI, 2)*pow(x, 2)*pow(z, 2) - 16*pow(M_PI, 2)*pow(x, 2)*z - 1)*sin(4*M_PI*x*z))/(pow(M_PI, 3)*pow(x, 5))) + 8*pow(M_PI, 2)*sin(4*M_PI*x)) - (50*M_PI*x*(M_PI*x*z - M_PI*x)*sin(4*M_PI*x*z) - 12.5*M_PI*x*(8*pow(M_PI, 2)*pow(x, 2)*pow(z, 2) - 16*pow(M_PI, 2)*pow(x, 2)*z - 1)*cos(4*M_PI*x*z) - 12.5*M_PI*x*cos(4*M_PI*x*z) - 50*(pow(M_PI, 2)*pow(x, 2)*z - pow(M_PI, 2)*pow(x, 2))*sin(4*M_PI*x*z))*(4*pow(M_PI, 2)*x*z*(M_PI*x*z - M_PI*x)*cos(4*M_PI*x*z) + pow(M_PI, 2)*x*z*(8*pow(M_PI, 2)*pow(x, 2)*pow(z, 2) - 16*pow(M_PI, 2)*pow(x, 2)*z - 1)*sin(4*M_PI*x*z) + pow(M_PI, 2)*x*z*sin(4*M_PI*x*z) - M_PI*x*(-M_PI*z + M_PI)*sin(4*M_PI*x*z) - 4.0*M_PI*x*(pow(M_PI, 2)*x*pow(z, 2) - 2*pow(M_PI, 2)*x*z)*cos(4*M_PI*x*z) - 4*M_PI*z*(pow(M_PI, 2)*pow(x, 2)*z - pow(M_PI, 2)*pow(x, 2))*cos(4*M_PI*x*z) + M_PI*(M_PI*x*z - M_PI*x)*sin(4*M_PI*x*z) - 2*(pow(M_PI, 2)*x*z - pow(M_PI, 2)*x)*sin(4*M_PI*x*z) - 0.25*M_PI*(8*pow(M_PI, 2)*pow(x, 2)*pow(z, 2) - 16*pow(M_PI, 2)*pow(x, 2)*z - 1)*cos(4*M_PI*x*z) - 0.25*M_PI*cos(4*M_PI*x*z))/(pow(M_PI, 4)*pow(x, 6)) + 150*pow(M_PI*x*(M_PI*x*z - M_PI*x)*sin(4*M_PI*x*z) - 0.25*M_PI*x*(8*pow(M_PI, 2)*pow(x, 2)*pow(z, 2) - 16*pow(M_PI, 2)*pow(x, 2)*z - 1)*cos(4*M_PI*x*z) - 0.25*M_PI*x*cos(4*M_PI*x*z) - (pow(M_PI, 2)*pow(x, 2)*z - pow(M_PI, 2)*pow(x, 2))*sin(4*M_PI*x*z), 2)/(pow(M_PI, 4)*pow(x, 7)))*cos(4*M_PI*x*z)/pow(4.0*pow(M_PI, 2)*pow(z, 2)*pow(z - 2, 2)*pow(cos(4*M_PI*x*z), 2) + (1.0L/2.0L)*pow(2.0*M_PI*x*(z - 2)*cos(4*M_PI*x*z) - 0.0625*M_PI*(16*sin(4*M_PI*x)/(M_PI*pow(x, 2)) + 4*(8*pow(M_PI, 2)*pow(x, 2) + 1)*cos(4*M_PI*x)/(pow(M_PI, 2)*pow(x, 3)) + 4*(-4*M_PI*z*(M_PI*x*z - M_PI*x)*sin(4*M_PI*x*z) + M_PI*z*(8*pow(M_PI, 2)*pow(x, 2)*pow(z, 2) - 16*pow(M_PI, 2)*pow(x, 2)*z - 1)*cos(4*M_PI*x*z) - (-M_PI*z + M_PI)*cos(4*M_PI*x*z) + 4*(pow(M_PI, 2)*x*pow(z, 2) - 2*pow(M_PI, 2)*x*z)*sin(4*M_PI*x*z))/(pow(M_PI, 3)*pow(x, 3)) - 3*(8*pow(M_PI, 2)*pow(x, 2) + 1)*sin(4*M_PI*x)/(pow(M_PI, 3)*pow(x, 4)) - 3*(4*(M_PI*x*z - M_PI*x)*cos(4*M_PI*x*z) + (8*pow(M_PI, 2)*pow(x, 2)*pow(z, 2) - 16*pow(M_PI, 2)*pow(x, 2)*z - 1)*sin(4*M_PI*x*z))/(pow(M_PI, 3)*pow(x, 4))) + 0.5*sin(4*M_PI*x*z) + (2.0L/5.0L)*M_PI*cos(4*M_PI*x), 2) + pow(M_PI*x*(M_PI*x*z - M_PI*x)*sin(4*M_PI*x*z) - 0.25*M_PI*x*(8*pow(M_PI, 2)*pow(x, 2)*pow(z, 2) - 16*pow(M_PI, 2)*pow(x, 2)*z - 1)*cos(4*M_PI*x*z) - 0.25*M_PI*x*cos(4*M_PI*x*z) - (pow(M_PI, 2)*pow(x, 2)*z - pow(M_PI, 2)*pow(x, 2))*sin(4*M_PI*x*z), 2)/(pow(M_PI, 4)*pow(x, 6)), 4.0L/3.0L) + (1.0L/10.0L)*pow(2, 1.0L/3.0L)*(40.0*pow(M_PI, 2)*pow(x, 2)*(z - 2)*sin(4*M_PI*x*z) - 20.0*M_PI*x*cos(4*M_PI*x*z) - 1.25*M_PI*((16*pow(M_PI, 2)*x*z*(M_PI*x*z - M_PI*x)*cos(4*M_PI*x*z) + 4*pow(M_PI, 2)*x*z*(8*pow(M_PI, 2)*pow(x, 2)*pow(z, 2) - 16*pow(M_PI, 2)*pow(x, 2)*z - 1)*sin(4*M_PI*x*z) + 4*pow(M_PI, 2)*x*z*sin(4*M_PI*x*z) - 4*M_PI*x*(-M_PI*z + M_PI)*sin(4*M_PI*x*z) - 16*M_PI*x*(pow(M_PI, 2)*x*pow(z, 2) - 2*pow(M_PI, 2)*x*z)*cos(4*M_PI*x*z) - 16*M_PI*z*(pow(M_PI, 2)*pow(x, 2)*z - pow(M_PI, 2)*pow(x, 2))*cos(4*M_PI*x*z) + 4*M_PI*(M_PI*x*z - M_PI*x)*sin(4*M_PI*x*z) - 8*(pow(M_PI, 2)*x*z - pow(M_PI, 2)*x)*sin(4*M_PI*x*z) - M_PI*(8*pow(M_PI, 2)*pow(x, 2)*pow(z, 2) - 16*pow(M_PI, 2)*pow(x, 2)*z - 1)*cos(4*M_PI*x*z) - M_PI*cos(4*M_PI*x*z))/(pow(M_PI, 3)*pow(x, 3)) + 3*(-4*M_PI*x*(M_PI*x*z - M_PI*x)*sin(4*M_PI*x*z) + M_PI*x*(8*pow(M_PI, 2)*pow(x, 2)*pow(z, 2) - 16*pow(M_PI, 2)*pow(x, 2)*z - 1)*cos(4*M_PI*x*z) + M_PI*x*cos(4*M_PI*x*z) + 4*(pow(M_PI, 2)*pow(x, 2)*z - pow(M_PI, 2)*pow(x, 2))*sin(4*M_PI*x*z))/(pow(M_PI, 3)*pow(x, 4))))/pow(4.0*pow(M_PI, 2)*pow(z, 2)*pow(z - 2, 2)*pow(cos(4*M_PI*x*z), 2) + (1.0L/2.0L)*pow(2.0*M_PI*x*(z - 2)*cos(4*M_PI*x*z) - 0.0625*M_PI*(16*sin(4*M_PI*x)/(M_PI*pow(x, 2)) + 4*(8*pow(M_PI, 2)*pow(x, 2) + 1)*cos(4*M_PI*x)/(pow(M_PI, 2)*pow(x, 3)) + 4*(-4*M_PI*z*(M_PI*x*z - M_PI*x)*sin(4*M_PI*x*z) + M_PI*z*(8*pow(M_PI, 2)*pow(x, 2)*pow(z, 2) - 16*pow(M_PI, 2)*pow(x, 2)*z - 1)*cos(4*M_PI*x*z) - (-M_PI*z + M_PI)*cos(4*M_PI*x*z) + 4*(pow(M_PI, 2)*x*pow(z, 2) - 2*pow(M_PI, 2)*x*z)*sin(4*M_PI*x*z))/(pow(M_PI, 3)*pow(x, 3)) - 3*(8*pow(M_PI, 2)*pow(x, 2) + 1)*sin(4*M_PI*x)/(pow(M_PI, 3)*pow(x, 4)) - 3*(4*(M_PI*x*z - M_PI*x)*cos(4*M_PI*x*z) + (8*pow(M_PI, 2)*pow(x, 2)*pow(z, 2) - 16*pow(M_PI, 2)*pow(x, 2)*z - 1)*sin(4*M_PI*x*z))/(pow(M_PI, 3)*pow(x, 4))) + 0.5*sin(4*M_PI*x*z) + (2.0L/5.0L)*M_PI*cos(4*M_PI*x), 2) + pow(M_PI*x*(M_PI*x*z - M_PI*x)*sin(4*M_PI*x*z) - 0.25*M_PI*x*(8*pow(M_PI, 2)*pow(x, 2)*pow(z, 2) - 16*pow(M_PI, 2)*pow(x, 2)*z - 1)*cos(4*M_PI*x*z) - 0.25*M_PI*x*cos(4*M_PI*x*z) - (pow(M_PI, 2)*pow(x, 2)*z - pow(M_PI, 2)*pow(x, 2))*sin(4*M_PI*x*z), 2)/(pow(M_PI, 4)*pow(x, 6)), 1.0L/3.0L) + 4*M_PI*sin(4*M_PI*z)*cos(4*M_PI*x) + (1.0L/150.0L)*pow(2, 1.0L/3.0L)*(-10.0*M_PI*x*(z - 2)*cos(4*M_PI*x*z) + 0.3125*M_PI*(16*sin(4*M_PI*x)/(M_PI*pow(x, 2)) + 4*(8*pow(M_PI, 2)*pow(x, 2) + 1)*cos(4*M_PI*x)/(pow(M_PI, 2)*pow(x, 3)) + 4*(-4*M_PI*z*(M_PI*x*z - M_PI*x)*sin(4*M_PI*x*z) + M_PI*z*(8*pow(M_PI, 2)*pow(x, 2)*pow(z, 2) - 16*pow(M_PI, 2)*pow(x, 2)*z - 1)*cos(4*M_PI*x*z) - (-M_PI*z + M_PI)*cos(4*M_PI*x*z) + 4*(pow(M_PI, 2)*x*pow(z, 2) - 2*pow(M_PI, 2)*x*z)*sin(4*M_PI*x*z))/(pow(M_PI, 3)*pow(x, 3)) - 3*(8*pow(M_PI, 2)*pow(x, 2) + 1)*sin(4*M_PI*x)/(pow(M_PI, 3)*pow(x, 4)) - 3*(4*(M_PI*x*z - M_PI*x)*cos(4*M_PI*x*z) + (8*pow(M_PI, 2)*pow(x, 2)*pow(z, 2) - 16*pow(M_PI, 2)*pow(x, 2)*z - 1)*sin(4*M_PI*x*z))/(pow(M_PI, 3)*pow(x, 4))) - 2.5*sin(4*M_PI*x*z) - 2*M_PI*cos(4*M_PI*x))*(160.0*pow(M_PI, 3)*x*pow(z, 2)*pow(z - 2, 2)*sin(4*M_PI*x*z)*cos(4*M_PI*x*z) - 40.0*pow(M_PI, 2)*pow(z, 2)*(z - 2)*pow(cos(4*M_PI*x*z), 2) - 40.0*pow(M_PI, 2)*z*pow(z - 2, 2)*pow(cos(4*M_PI*x*z), 2) + (-8.0*pow(M_PI, 2)*pow(x, 2)*(z - 2)*sin(4*M_PI*x*z) + 4.0*M_PI*x*cos(4*M_PI*x*z) + 0.25*M_PI*((16*pow(M_PI, 2)*x*z*(M_PI*x*z - M_PI*x)*cos(4*M_PI*x*z) + 4*pow(M_PI, 2)*x*z*(8*pow(M_PI, 2)*pow(x, 2)*pow(z, 2) - 16*pow(M_PI, 2)*pow(x, 2)*z - 1)*sin(4*M_PI*x*z) + 4*pow(M_PI, 2)*x*z*sin(4*M_PI*x*z) - 4*M_PI*x*(-M_PI*z + M_PI)*sin(4*M_PI*x*z) - 16*M_PI*x*(pow(M_PI, 2)*x*pow(z, 2) - 2*pow(M_PI, 2)*x*z)*cos(4*M_PI*x*z) - 16*M_PI*z*(pow(M_PI, 2)*pow(x, 2)*z - pow(M_PI, 2)*pow(x, 2))*cos(4*M_PI*x*z) + 4*M_PI*(M_PI*x*z - M_PI*x)*sin(4*M_PI*x*z) - 8*(pow(M_PI, 2)*x*z - pow(M_PI, 2)*x)*sin(4*M_PI*x*z) - M_PI*(8*pow(M_PI, 2)*pow(x, 2)*pow(z, 2) - 16*pow(M_PI, 2)*pow(x, 2)*z - 1)*cos(4*M_PI*x*z) - M_PI*cos(4*M_PI*x*z))/(pow(M_PI, 3)*pow(x, 3)) + 3*(-4*M_PI*x*(M_PI*x*z - M_PI*x)*sin(4*M_PI*x*z) + M_PI*x*(8*pow(M_PI, 2)*pow(x, 2)*pow(z, 2) - 16*pow(M_PI, 2)*pow(x, 2)*z - 1)*cos(4*M_PI*x*z) + M_PI*x*cos(4*M_PI*x*z) + 4*(pow(M_PI, 2)*pow(x, 2)*z - pow(M_PI, 2)*pow(x, 2))*sin(4*M_PI*x*z))/(pow(M_PI, 3)*pow(x, 4))))*(-10.0*M_PI*x*(z - 2)*cos(4*M_PI*x*z) + 0.3125*M_PI*(16*sin(4*M_PI*x)/(M_PI*pow(x, 2)) + 4*(8*pow(M_PI, 2)*pow(x, 2) + 1)*cos(4*M_PI*x)/(pow(M_PI, 2)*pow(x, 3)) + 4*(-4*M_PI*z*(M_PI*x*z - M_PI*x)*sin(4*M_PI*x*z) + M_PI*z*(8*pow(M_PI, 2)*pow(x, 2)*pow(z, 2) - 16*pow(M_PI, 2)*pow(x, 2)*z - 1)*cos(4*M_PI*x*z) - (-M_PI*z + M_PI)*cos(4*M_PI*x*z) + 4*(pow(M_PI, 2)*x*pow(z, 2) - 2*pow(M_PI, 2)*x*z)*sin(4*M_PI*x*z))/(pow(M_PI, 3)*pow(x, 3)) - 3*(8*pow(M_PI, 2)*pow(x, 2) + 1)*sin(4*M_PI*x)/(pow(M_PI, 3)*pow(x, 4)) - 3*(4*(M_PI*x*z - M_PI*x)*cos(4*M_PI*x*z) + (8*pow(M_PI, 2)*pow(x, 2)*pow(z, 2) - 16*pow(M_PI, 2)*pow(x, 2)*z - 1)*sin(4*M_PI*x*z))/(pow(M_PI, 3)*pow(x, 4))) - 2.5*sin(4*M_PI*x*z) - 2*M_PI*cos(4*M_PI*x)) - (10*M_PI*x*(M_PI*x*z - M_PI*x)*sin(4*M_PI*x*z) - 2.5*M_PI*x*(8*pow(M_PI, 2)*pow(x, 2)*pow(z, 2) - 16*pow(M_PI, 2)*pow(x, 2)*z - 1)*cos(4*M_PI*x*z) - 2.5*M_PI*x*cos(4*M_PI*x*z) - 10*(pow(M_PI, 2)*pow(x, 2)*z - pow(M_PI, 2)*pow(x, 2))*sin(4*M_PI*x*z))*(4*pow(M_PI, 2)*pow(x, 2)*(M_PI*x*z - M_PI*x)*cos(4*M_PI*x*z) + pow(M_PI, 2)*pow(x, 2)*(8*pow(M_PI, 2)*pow(x, 2)*pow(z, 2) - 16*pow(M_PI, 2)*pow(x, 2)*z - 1)*sin(4*M_PI*x*z) + pow(M_PI, 2)*pow(x, 2)*sin(4*M_PI*x*z) - 8.0*M_PI*x*(pow(M_PI, 2)*pow(x, 2)*z - pow(M_PI, 2)*pow(x, 2))*cos(4*M_PI*x*z))/(pow(M_PI, 4)*pow(x, 6)))/pow(4.0*pow(M_PI, 2)*pow(z, 2)*pow(z - 2, 2)*pow(cos(4*M_PI*x*z), 2) + (1.0L/2.0L)*pow(2.0*M_PI*x*(z - 2)*cos(4*M_PI*x*z) - 0.0625*M_PI*(16*sin(4*M_PI*x)/(M_PI*pow(x, 2)) + 4*(8*pow(M_PI, 2)*pow(x, 2) + 1)*cos(4*M_PI*x)/(pow(M_PI, 2)*pow(x, 3)) + 4*(-4*M_PI*z*(M_PI*x*z - M_PI*x)*sin(4*M_PI*x*z) + M_PI*z*(8*pow(M_PI, 2)*pow(x, 2)*pow(z, 2) - 16*pow(M_PI, 2)*pow(x, 2)*z - 1)*cos(4*M_PI*x*z) - (-M_PI*z + M_PI)*cos(4*M_PI*x*z) + 4*(pow(M_PI, 2)*x*pow(z, 2) - 2*pow(M_PI, 2)*x*z)*sin(4*M_PI*x*z))/(pow(M_PI, 3)*pow(x, 3)) - 3*(8*pow(M_PI, 2)*pow(x, 2) + 1)*sin(4*M_PI*x)/(pow(M_PI, 3)*pow(x, 4)) - 3*(4*(M_PI*x*z - M_PI*x)*cos(4*M_PI*x*z) + (8*pow(M_PI, 2)*pow(x, 2)*pow(z, 2) - 16*pow(M_PI, 2)*pow(x, 2)*z - 1)*sin(4*M_PI*x*z))/(pow(M_PI, 3)*pow(x, 4))) + 0.5*sin(4*M_PI*x*z) + (2.0L/5.0L)*M_PI*cos(4*M_PI*x), 2) + pow(M_PI*x*(M_PI*x*z - M_PI*x)*sin(4*M_PI*x*z) - 0.25*M_PI*x*(8*pow(M_PI, 2)*pow(x, 2)*pow(z, 2) - 16*pow(M_PI, 2)*pow(x, 2)*z - 1)*cos(4*M_PI*x*z) - 0.25*M_PI*x*cos(4*M_PI*x*z) - (pow(M_PI, 2)*pow(x, 2)*z - pow(M_PI, 2)*pow(x, 2))*sin(4*M_PI*x*z), 2)/(pow(M_PI, 4)*pow(x, 6)), 4.0L/3.0L);
+			return 8.0*pow(2, 1.0L/3.0L)*pow(PI, 2)*pow(z, 2)*(z - 2)*sin(4*PI*x*z)/pow(4.0*pow(PI, 2)*pow(z, 2)*pow(z - 2, 2)*pow(cos(4*PI*x*z), 2) + (1.0L/2.0L)*pow(2.0*PI*x*(z - 2)*cos(4*PI*x*z) - 0.0625*PI*(16*sin(4*PI*x)/(PI*pow(x, 2)) + 4*(8*pow(PI, 2)*pow(x, 2) + 1)*cos(4*PI*x)/(pow(PI, 2)*pow(x, 3)) + 4*(-4*PI*z*(PI*x*z - PI*x)*sin(4*PI*x*z) + PI*z*(8*pow(PI, 2)*pow(x, 2)*pow(z, 2) - 16*pow(PI, 2)*pow(x, 2)*z - 1)*cos(4*PI*x*z) - (-PI*z + PI)*cos(4*PI*x*z) + 4*(pow(PI, 2)*x*pow(z, 2) - 2*pow(PI, 2)*x*z)*sin(4*PI*x*z))/(pow(PI, 3)*pow(x, 3)) - 3*(8*pow(PI, 2)*pow(x, 2) + 1)*sin(4*PI*x)/(pow(PI, 3)*pow(x, 4)) - 3*(4*(PI*x*z - PI*x)*cos(4*PI*x*z) + (8*pow(PI, 2)*pow(x, 2)*pow(z, 2) - 16*pow(PI, 2)*pow(x, 2)*z - 1)*sin(4*PI*x*z))/(pow(PI, 3)*pow(x, 4))) + 0.5*sin(4*PI*x*z) + (2.0L/5.0L)*PI*cos(4*PI*x), 2) + pow(PI*x*(PI*x*z - PI*x)*sin(4*PI*x*z) - 0.25*PI*x*(8*pow(PI, 2)*pow(x, 2)*pow(z, 2) - 16*pow(PI, 2)*pow(x, 2)*z - 1)*cos(4*PI*x*z) - 0.25*PI*x*cos(4*PI*x*z) - (pow(PI, 2)*pow(x, 2)*z - pow(PI, 2)*pow(x, 2))*sin(4*PI*x*z), 2)/(pow(PI, 4)*pow(x, 6)), 1.0L/3.0L) - 0.0266666666666667*pow(2, 1.0L/3.0L)*PI*z*(z - 2)*(800.0*pow(PI, 3)*pow(z, 3)*pow(z - 2, 2)*sin(4*PI*x*z)*cos(4*PI*x*z) - (-10.0*PI*x*(z - 2)*cos(4*PI*x*z) + 0.3125*PI*(16*sin(4*PI*x)/(PI*pow(x, 2)) + 4*(8*pow(PI, 2)*pow(x, 2) + 1)*cos(4*PI*x)/(pow(PI, 2)*pow(x, 3)) + 4*(-4*PI*z*(PI*x*z - PI*x)*sin(4*PI*x*z) + PI*z*(8*pow(PI, 2)*pow(x, 2)*pow(z, 2) - 16*pow(PI, 2)*pow(x, 2)*z - 1)*cos(4*PI*x*z) - (-PI*z + PI)*cos(4*PI*x*z) + 4*(pow(PI, 2)*x*pow(z, 2) - 2*pow(PI, 2)*x*z)*sin(4*PI*x*z))/(pow(PI, 3)*pow(x, 3)) - 3*(8*pow(PI, 2)*pow(x, 2) + 1)*sin(4*PI*x)/(pow(PI, 3)*pow(x, 4)) - 3*(4*(PI*x*z - PI*x)*cos(4*PI*x*z) + (8*pow(PI, 2)*pow(x, 2)*pow(z, 2) - 16*pow(PI, 2)*pow(x, 2)*z - 1)*sin(4*PI*x*z))/(pow(PI, 3)*pow(x, 4))) - 2.5*sin(4*PI*x*z) - 2*PI*cos(4*PI*x))*(40.0*pow(PI, 2)*x*z*(z - 2)*sin(4*PI*x*z) - 10.0*PI*z*cos(4*PI*x*z) - 10.0*PI*(z - 2)*cos(4*PI*x*z) + 1.25*PI*(32*cos(4*PI*x)/pow(x, 2) - 4*(8*pow(PI, 2)*pow(x, 2) + 1)*sin(4*PI*x)/(PI*pow(x, 3)) - 4*(4*pow(PI, 2)*pow(z, 2)*(PI*x*z - PI*x)*cos(4*PI*x*z) + pow(PI, 2)*pow(z, 2)*(8*pow(PI, 2)*pow(x, 2)*pow(z, 2) - 16*pow(PI, 2)*pow(x, 2)*z - 1)*sin(4*PI*x*z) - 2*PI*z*(-PI*z + PI)*sin(4*PI*x*z) - 8*PI*z*(pow(PI, 2)*x*pow(z, 2) - 2*pow(PI, 2)*x*z)*cos(4*PI*x*z) - (pow(PI, 2)*pow(z, 2) - 2*pow(PI, 2)*z)*sin(4*PI*x*z))/(pow(PI, 3)*pow(x, 3)) - 20*sin(4*PI*x)/(PI*pow(x, 3)) - 6*(8*pow(PI, 2)*pow(x, 2) + 1)*cos(4*PI*x)/(pow(PI, 2)*pow(x, 4)) - 6*(-4*PI*z*(PI*x*z - PI*x)*sin(4*PI*x*z) + PI*z*(8*pow(PI, 2)*pow(x, 2)*pow(z, 2) - 16*pow(PI, 2)*pow(x, 2)*z - 1)*cos(4*PI*x*z) - (-PI*z + PI)*cos(4*PI*x*z) + 4*(pow(PI, 2)*x*pow(z, 2) - 2*pow(PI, 2)*x*z)*sin(4*PI*x*z))/(pow(PI, 3)*pow(x, 4)) + 3*(8*pow(PI, 2)*pow(x, 2) + 1)*sin(4*PI*x)/(pow(PI, 3)*pow(x, 5)) + 3*(4*(PI*x*z - PI*x)*cos(4*PI*x*z) + (8*pow(PI, 2)*pow(x, 2)*pow(z, 2) - 16*pow(PI, 2)*pow(x, 2)*z - 1)*sin(4*PI*x*z))/(pow(PI, 3)*pow(x, 5))) + 8*pow(PI, 2)*sin(4*PI*x)) - (50*PI*x*(PI*x*z - PI*x)*sin(4*PI*x*z) - 12.5*PI*x*(8*pow(PI, 2)*pow(x, 2)*pow(z, 2) - 16*pow(PI, 2)*pow(x, 2)*z - 1)*cos(4*PI*x*z) - 12.5*PI*x*cos(4*PI*x*z) - 50*(pow(PI, 2)*pow(x, 2)*z - pow(PI, 2)*pow(x, 2))*sin(4*PI*x*z))*(4*pow(PI, 2)*x*z*(PI*x*z - PI*x)*cos(4*PI*x*z) + pow(PI, 2)*x*z*(8*pow(PI, 2)*pow(x, 2)*pow(z, 2) - 16*pow(PI, 2)*pow(x, 2)*z - 1)*sin(4*PI*x*z) + pow(PI, 2)*x*z*sin(4*PI*x*z) - PI*x*(-PI*z + PI)*sin(4*PI*x*z) - 4.0*PI*x*(pow(PI, 2)*x*pow(z, 2) - 2*pow(PI, 2)*x*z)*cos(4*PI*x*z) - 4*PI*z*(pow(PI, 2)*pow(x, 2)*z - pow(PI, 2)*pow(x, 2))*cos(4*PI*x*z) + PI*(PI*x*z - PI*x)*sin(4*PI*x*z) - 2*(pow(PI, 2)*x*z - pow(PI, 2)*x)*sin(4*PI*x*z) - 0.25*PI*(8*pow(PI, 2)*pow(x, 2)*pow(z, 2) - 16*pow(PI, 2)*pow(x, 2)*z - 1)*cos(4*PI*x*z) - 0.25*PI*cos(4*PI*x*z))/(pow(PI, 4)*pow(x, 6)) + 150*pow(PI*x*(PI*x*z - PI*x)*sin(4*PI*x*z) - 0.25*PI*x*(8*pow(PI, 2)*pow(x, 2)*pow(z, 2) - 16*pow(PI, 2)*pow(x, 2)*z - 1)*cos(4*PI*x*z) - 0.25*PI*x*cos(4*PI*x*z) - (pow(PI, 2)*pow(x, 2)*z - pow(PI, 2)*pow(x, 2))*sin(4*PI*x*z), 2)/(pow(PI, 4)*pow(x, 7)))*cos(4*PI*x*z)/pow(4.0*pow(PI, 2)*pow(z, 2)*pow(z - 2, 2)*pow(cos(4*PI*x*z), 2) + (1.0L/2.0L)*pow(2.0*PI*x*(z - 2)*cos(4*PI*x*z) - 0.0625*PI*(16*sin(4*PI*x)/(PI*pow(x, 2)) + 4*(8*pow(PI, 2)*pow(x, 2) + 1)*cos(4*PI*x)/(pow(PI, 2)*pow(x, 3)) + 4*(-4*PI*z*(PI*x*z - PI*x)*sin(4*PI*x*z) + PI*z*(8*pow(PI, 2)*pow(x, 2)*pow(z, 2) - 16*pow(PI, 2)*pow(x, 2)*z - 1)*cos(4*PI*x*z) - (-PI*z + PI)*cos(4*PI*x*z) + 4*(pow(PI, 2)*x*pow(z, 2) - 2*pow(PI, 2)*x*z)*sin(4*PI*x*z))/(pow(PI, 3)*pow(x, 3)) - 3*(8*pow(PI, 2)*pow(x, 2) + 1)*sin(4*PI*x)/(pow(PI, 3)*pow(x, 4)) - 3*(4*(PI*x*z - PI*x)*cos(4*PI*x*z) + (8*pow(PI, 2)*pow(x, 2)*pow(z, 2) - 16*pow(PI, 2)*pow(x, 2)*z - 1)*sin(4*PI*x*z))/(pow(PI, 3)*pow(x, 4))) + 0.5*sin(4*PI*x*z) + (2.0L/5.0L)*PI*cos(4*PI*x), 2) + pow(PI*x*(PI*x*z - PI*x)*sin(4*PI*x*z) - 0.25*PI*x*(8*pow(PI, 2)*pow(x, 2)*pow(z, 2) - 16*pow(PI, 2)*pow(x, 2)*z - 1)*cos(4*PI*x*z) - 0.25*PI*x*cos(4*PI*x*z) - (pow(PI, 2)*pow(x, 2)*z - pow(PI, 2)*pow(x, 2))*sin(4*PI*x*z), 2)/(pow(PI, 4)*pow(x, 6)), 4.0L/3.0L) + (1.0L/10.0L)*pow(2, 1.0L/3.0L)*(40.0*pow(PI, 2)*pow(x, 2)*(z - 2)*sin(4*PI*x*z) - 20.0*PI*x*cos(4*PI*x*z) - 1.25*PI*((16*pow(PI, 2)*x*z*(PI*x*z - PI*x)*cos(4*PI*x*z) + 4*pow(PI, 2)*x*z*(8*pow(PI, 2)*pow(x, 2)*pow(z, 2) - 16*pow(PI, 2)*pow(x, 2)*z - 1)*sin(4*PI*x*z) + 4*pow(PI, 2)*x*z*sin(4*PI*x*z) - 4*PI*x*(-PI*z + PI)*sin(4*PI*x*z) - 16*PI*x*(pow(PI, 2)*x*pow(z, 2) - 2*pow(PI, 2)*x*z)*cos(4*PI*x*z) - 16*PI*z*(pow(PI, 2)*pow(x, 2)*z - pow(PI, 2)*pow(x, 2))*cos(4*PI*x*z) + 4*PI*(PI*x*z - PI*x)*sin(4*PI*x*z) - 8*(pow(PI, 2)*x*z - pow(PI, 2)*x)*sin(4*PI*x*z) - PI*(8*pow(PI, 2)*pow(x, 2)*pow(z, 2) - 16*pow(PI, 2)*pow(x, 2)*z - 1)*cos(4*PI*x*z) - PI*cos(4*PI*x*z))/(pow(PI, 3)*pow(x, 3)) + 3*(-4*PI*x*(PI*x*z - PI*x)*sin(4*PI*x*z) + PI*x*(8*pow(PI, 2)*pow(x, 2)*pow(z, 2) - 16*pow(PI, 2)*pow(x, 2)*z - 1)*cos(4*PI*x*z) + PI*x*cos(4*PI*x*z) + 4*(pow(PI, 2)*pow(x, 2)*z - pow(PI, 2)*pow(x, 2))*sin(4*PI*x*z))/(pow(PI, 3)*pow(x, 4))))/pow(4.0*pow(PI, 2)*pow(z, 2)*pow(z - 2, 2)*pow(cos(4*PI*x*z), 2) + (1.0L/2.0L)*pow(2.0*PI*x*(z - 2)*cos(4*PI*x*z) - 0.0625*PI*(16*sin(4*PI*x)/(PI*pow(x, 2)) + 4*(8*pow(PI, 2)*pow(x, 2) + 1)*cos(4*PI*x)/(pow(PI, 2)*pow(x, 3)) + 4*(-4*PI*z*(PI*x*z - PI*x)*sin(4*PI*x*z) + PI*z*(8*pow(PI, 2)*pow(x, 2)*pow(z, 2) - 16*pow(PI, 2)*pow(x, 2)*z - 1)*cos(4*PI*x*z) - (-PI*z + PI)*cos(4*PI*x*z) + 4*(pow(PI, 2)*x*pow(z, 2) - 2*pow(PI, 2)*x*z)*sin(4*PI*x*z))/(pow(PI, 3)*pow(x, 3)) - 3*(8*pow(PI, 2)*pow(x, 2) + 1)*sin(4*PI*x)/(pow(PI, 3)*pow(x, 4)) - 3*(4*(PI*x*z - PI*x)*cos(4*PI*x*z) + (8*pow(PI, 2)*pow(x, 2)*pow(z, 2) - 16*pow(PI, 2)*pow(x, 2)*z - 1)*sin(4*PI*x*z))/(pow(PI, 3)*pow(x, 4))) + 0.5*sin(4*PI*x*z) + (2.0L/5.0L)*PI*cos(4*PI*x), 2) + pow(PI*x*(PI*x*z - PI*x)*sin(4*PI*x*z) - 0.25*PI*x*(8*pow(PI, 2)*pow(x, 2)*pow(z, 2) - 16*pow(PI, 2)*pow(x, 2)*z - 1)*cos(4*PI*x*z) - 0.25*PI*x*cos(4*PI*x*z) - (pow(PI, 2)*pow(x, 2)*z - pow(PI, 2)*pow(x, 2))*sin(4*PI*x*z), 2)/(pow(PI, 4)*pow(x, 6)), 1.0L/3.0L) + 4*PI*sin(4*PI*z)*cos(4*PI*x) + (1.0L/150.0L)*pow(2, 1.0L/3.0L)*(-10.0*PI*x*(z - 2)*cos(4*PI*x*z) + 0.3125*PI*(16*sin(4*PI*x)/(PI*pow(x, 2)) + 4*(8*pow(PI, 2)*pow(x, 2) + 1)*cos(4*PI*x)/(pow(PI, 2)*pow(x, 3)) + 4*(-4*PI*z*(PI*x*z - PI*x)*sin(4*PI*x*z) + PI*z*(8*pow(PI, 2)*pow(x, 2)*pow(z, 2) - 16*pow(PI, 2)*pow(x, 2)*z - 1)*cos(4*PI*x*z) - (-PI*z + PI)*cos(4*PI*x*z) + 4*(pow(PI, 2)*x*pow(z, 2) - 2*pow(PI, 2)*x*z)*sin(4*PI*x*z))/(pow(PI, 3)*pow(x, 3)) - 3*(8*pow(PI, 2)*pow(x, 2) + 1)*sin(4*PI*x)/(pow(PI, 3)*pow(x, 4)) - 3*(4*(PI*x*z - PI*x)*cos(4*PI*x*z) + (8*pow(PI, 2)*pow(x, 2)*pow(z, 2) - 16*pow(PI, 2)*pow(x, 2)*z - 1)*sin(4*PI*x*z))/(pow(PI, 3)*pow(x, 4))) - 2.5*sin(4*PI*x*z) - 2*PI*cos(4*PI*x))*(160.0*pow(PI, 3)*x*pow(z, 2)*pow(z - 2, 2)*sin(4*PI*x*z)*cos(4*PI*x*z) - 40.0*pow(PI, 2)*pow(z, 2)*(z - 2)*pow(cos(4*PI*x*z), 2) - 40.0*pow(PI, 2)*z*pow(z - 2, 2)*pow(cos(4*PI*x*z), 2) + (-8.0*pow(PI, 2)*pow(x, 2)*(z - 2)*sin(4*PI*x*z) + 4.0*PI*x*cos(4*PI*x*z) + 0.25*PI*((16*pow(PI, 2)*x*z*(PI*x*z - PI*x)*cos(4*PI*x*z) + 4*pow(PI, 2)*x*z*(8*pow(PI, 2)*pow(x, 2)*pow(z, 2) - 16*pow(PI, 2)*pow(x, 2)*z - 1)*sin(4*PI*x*z) + 4*pow(PI, 2)*x*z*sin(4*PI*x*z) - 4*PI*x*(-PI*z + PI)*sin(4*PI*x*z) - 16*PI*x*(pow(PI, 2)*x*pow(z, 2) - 2*pow(PI, 2)*x*z)*cos(4*PI*x*z) - 16*PI*z*(pow(PI, 2)*pow(x, 2)*z - pow(PI, 2)*pow(x, 2))*cos(4*PI*x*z) + 4*PI*(PI*x*z - PI*x)*sin(4*PI*x*z) - 8*(pow(PI, 2)*x*z - pow(PI, 2)*x)*sin(4*PI*x*z) - PI*(8*pow(PI, 2)*pow(x, 2)*pow(z, 2) - 16*pow(PI, 2)*pow(x, 2)*z - 1)*cos(4*PI*x*z) - PI*cos(4*PI*x*z))/(pow(PI, 3)*pow(x, 3)) + 3*(-4*PI*x*(PI*x*z - PI*x)*sin(4*PI*x*z) + PI*x*(8*pow(PI, 2)*pow(x, 2)*pow(z, 2) - 16*pow(PI, 2)*pow(x, 2)*z - 1)*cos(4*PI*x*z) + PI*x*cos(4*PI*x*z) + 4*(pow(PI, 2)*pow(x, 2)*z - pow(PI, 2)*pow(x, 2))*sin(4*PI*x*z))/(pow(PI, 3)*pow(x, 4))))*(-10.0*PI*x*(z - 2)*cos(4*PI*x*z) + 0.3125*PI*(16*sin(4*PI*x)/(PI*pow(x, 2)) + 4*(8*pow(PI, 2)*pow(x, 2) + 1)*cos(4*PI*x)/(pow(PI, 2)*pow(x, 3)) + 4*(-4*PI*z*(PI*x*z - PI*x)*sin(4*PI*x*z) + PI*z*(8*pow(PI, 2)*pow(x, 2)*pow(z, 2) - 16*pow(PI, 2)*pow(x, 2)*z - 1)*cos(4*PI*x*z) - (-PI*z + PI)*cos(4*PI*x*z) + 4*(pow(PI, 2)*x*pow(z, 2) - 2*pow(PI, 2)*x*z)*sin(4*PI*x*z))/(pow(PI, 3)*pow(x, 3)) - 3*(8*pow(PI, 2)*pow(x, 2) + 1)*sin(4*PI*x)/(pow(PI, 3)*pow(x, 4)) - 3*(4*(PI*x*z - PI*x)*cos(4*PI*x*z) + (8*pow(PI, 2)*pow(x, 2)*pow(z, 2) - 16*pow(PI, 2)*pow(x, 2)*z - 1)*sin(4*PI*x*z))/(pow(PI, 3)*pow(x, 4))) - 2.5*sin(4*PI*x*z) - 2*PI*cos(4*PI*x)) - (10*PI*x*(PI*x*z - PI*x)*sin(4*PI*x*z) - 2.5*PI*x*(8*pow(PI, 2)*pow(x, 2)*pow(z, 2) - 16*pow(PI, 2)*pow(x, 2)*z - 1)*cos(4*PI*x*z) - 2.5*PI*x*cos(4*PI*x*z) - 10*(pow(PI, 2)*pow(x, 2)*z - pow(PI, 2)*pow(x, 2))*sin(4*PI*x*z))*(4*pow(PI, 2)*pow(x, 2)*(PI*x*z - PI*x)*cos(4*PI*x*z) + pow(PI, 2)*pow(x, 2)*(8*pow(PI, 2)*pow(x, 2)*pow(z, 2) - 16*pow(PI, 2)*pow(x, 2)*z - 1)*sin(4*PI*x*z) + pow(PI, 2)*pow(x, 2)*sin(4*PI*x*z) - 8.0*PI*x*(pow(PI, 2)*pow(x, 2)*z - pow(PI, 2)*pow(x, 2))*cos(4*PI*x*z))/(pow(PI, 4)*pow(x, 6)))/pow(4.0*pow(PI, 2)*pow(z, 2)*pow(z - 2, 2)*pow(cos(4*PI*x*z), 2) + (1.0L/2.0L)*pow(2.0*PI*x*(z - 2)*cos(4*PI*x*z) - 0.0625*PI*(16*sin(4*PI*x)/(PI*pow(x, 2)) + 4*(8*pow(PI, 2)*pow(x, 2) + 1)*cos(4*PI*x)/(pow(PI, 2)*pow(x, 3)) + 4*(-4*PI*z*(PI*x*z - PI*x)*sin(4*PI*x*z) + PI*z*(8*pow(PI, 2)*pow(x, 2)*pow(z, 2) - 16*pow(PI, 2)*pow(x, 2)*z - 1)*cos(4*PI*x*z) - (-PI*z + PI)*cos(4*PI*x*z) + 4*(pow(PI, 2)*x*pow(z, 2) - 2*pow(PI, 2)*x*z)*sin(4*PI*x*z))/(pow(PI, 3)*pow(x, 3)) - 3*(8*pow(PI, 2)*pow(x, 2) + 1)*sin(4*PI*x)/(pow(PI, 3)*pow(x, 4)) - 3*(4*(PI*x*z - PI*x)*cos(4*PI*x*z) + (8*pow(PI, 2)*pow(x, 2)*pow(z, 2) - 16*pow(PI, 2)*pow(x, 2)*z - 1)*sin(4*PI*x*z))/(pow(PI, 3)*pow(x, 4))) + 0.5*sin(4*PI*x*z) + (2.0L/5.0L)*PI*cos(4*PI*x), 2) + pow(PI*x*(PI*x*z - PI*x)*sin(4*PI*x*z) - 0.25*PI*x*(8*pow(PI, 2)*pow(x, 2)*pow(z, 2) - 16*pow(PI, 2)*pow(x, 2)*z - 1)*cos(4*PI*x*z) - 0.25*PI*x*cos(4*PI*x*z) - (pow(PI, 2)*pow(x, 2)*z - pow(PI, 2)*pow(x, 2))*sin(4*PI*x*z), 2)/(pow(PI, 4)*pow(x, 6)), 4.0L/3.0L);
+		case 15:
+			z=y;
+			return -24000000000*pow(z - 1, 2) - 1000000*PI*sin(10*PI*x);
 		case 21:
 			z=y;
 			return z - 4.0L/3.0L*pow(2, 1.0L/3.0L)*(pow(x, 2)*z*(x - 1)*(z - 1)*(2*z - 1) + x*z*pow(x - 1, 2)*(z - 1)*(2*z - 1))*(4*(pow(x, 2)*z*(x - 1)*(z - 1)*(2*z - 1) + x*z*pow(x - 1, 2)*(z - 1)*(2*z - 1))*(pow(x, 2)*z*(z - 1)*(2*z - 1) + 4*x*z*(x - 1)*(z - 1)*(2*z - 1) + z*pow(x - 1, 2)*(z - 1)*(2*z - 1)) + 4*(2*pow(z, 3)*(6*pow(x, 2) - 6*x + 1) - 3*pow(z, 2)*(6*pow(x, 2) - 6*x + 1) + z*(6*pow(x, 2) - 6*x + 1))*(2*pow(z, 3)*(2*pow(x, 3) - 3*pow(x, 2) + x) - 3*pow(z, 2)*(2*pow(x, 3) - 3*pow(x, 2) + x) + z*(2*pow(x, 3) - 3*pow(x, 2) + x)) + (2*pow(x, 2)*z*pow(x - 1, 2)*(z - 1) + pow(x, 2)*z*pow(x - 1, 2)*(2*z - 1) + pow(x, 2)*pow(x - 1, 2)*(z - 1)*(2*z - 1) - pow(z, 4)*(6*pow(x, 2) - 6*x + 1) + 2*pow(z, 3)*(6*pow(x, 2) - 6*x + 1) - pow(z, 2)*(6*pow(x, 2) - 6*x + 1))*(2*pow(x, 2)*z*(x - 1)*(z - 1) + pow(x, 2)*z*(x - 1)*(2*z - 1) + pow(x, 2)*(x - 1)*(z - 1)*(2*z - 1) + 2*x*z*pow(x - 1, 2)*(z - 1) + x*z*pow(x - 1, 2)*(2*z - 1) + x*pow(x - 1, 2)*(z - 1)*(2*z - 1) - 3*pow(z, 4)*(2*x - 1) + 6*pow(z, 3)*(2*x - 1) - 3*pow(z, 2)*(2*x - 1)))/pow(4*pow(pow(x, 2)*z*(x - 1)*(z - 1)*(2*z - 1) + x*z*pow(x - 1, 2)*(z - 1)*(2*z - 1), 2) + 4*pow(2*pow(z, 3)*(2*pow(x, 3) - 3*pow(x, 2) + x) - 3*pow(z, 2)*(2*pow(x, 3) - 3*pow(x, 2) + x) + z*(2*pow(x, 3) - 3*pow(x, 2) + x), 2) + (1.0L/2.0L)*pow(2*pow(x, 2)*z*pow(x - 1, 2)*(z - 1) + pow(x, 2)*z*pow(x - 1, 2)*(2*z - 1) + pow(x, 2)*pow(x - 1, 2)*(z - 1)*(2*z - 1) - pow(z, 4)*(6*pow(x, 2) - 6*x + 1) + 2*pow(z, 3)*(6*pow(x, 2) - 6*x + 1) - pow(z, 2)*(6*pow(x, 2) - 6*x + 1), 2), 4.0L/3.0L) - 1.0L/3.0L*pow(2, 1.0L/3.0L)*(4*(pow(x, 2)*z*(x - 1)*(z - 1)*(2*z - 1) + x*z*pow(x - 1, 2)*(z - 1)*(2*z - 1))*(2*pow(x, 2)*z*(x - 1)*(z - 1) + pow(x, 2)*z*(x - 1)*(2*z - 1) + pow(x, 2)*(x - 1)*(z - 1)*(2*z - 1) + 2*x*z*pow(x - 1, 2)*(z - 1) + x*z*pow(x - 1, 2)*(2*z - 1) + x*pow(x - 1, 2)*(z - 1)*(2*z - 1)) + 4*(2*pow(z, 3)*(2*pow(x, 3) - 3*pow(x, 2) + x) - 3*pow(z, 2)*(2*pow(x, 3) - 3*pow(x, 2) + x) + z*(2*pow(x, 3) - 3*pow(x, 2) + x))*(2*pow(x, 3) - 3*pow(x, 2) + x + 6*pow(z, 2)*(2*pow(x, 3) - 3*pow(x, 2) + x) - 6*z*(2*pow(x, 3) - 3*pow(x, 2) + x)) + (2*pow(x, 2)*z*pow(x - 1, 2) + 2*pow(x, 2)*pow(x - 1, 2)*(z - 1) + pow(x, 2)*pow(x - 1, 2)*(2*z - 1) - 2*pow(z, 3)*(6*pow(x, 2) - 6*x + 1) + 3*pow(z, 2)*(6*pow(x, 2) - 6*x + 1) - z*(6*pow(x, 2) - 6*x + 1))*(2*pow(x, 2)*z*pow(x - 1, 2)*(z - 1) + pow(x, 2)*z*pow(x - 1, 2)*(2*z - 1) + pow(x, 2)*pow(x - 1, 2)*(z - 1)*(2*z - 1) - pow(z, 4)*(6*pow(x, 2) - 6*x + 1) + 2*pow(z, 3)*(6*pow(x, 2) - 6*x + 1) - pow(z, 2)*(6*pow(x, 2) - 6*x + 1)))*(2*pow(x, 2)*z*pow(x - 1, 2)*(z - 1) + pow(x, 2)*z*pow(x - 1, 2)*(2*z - 1) + pow(x, 2)*pow(x - 1, 2)*(z - 1)*(2*z - 1) - pow(z, 4)*(6*pow(x, 2) - 6*x + 1) + 2*pow(z, 3)*(6*pow(x, 2) - 6*x + 1) - pow(z, 2)*(6*pow(x, 2) - 6*x + 1))/pow(4*pow(pow(x, 2)*z*(x - 1)*(z - 1)*(2*z - 1) + x*z*pow(x - 1, 2)*(z - 1)*(2*z - 1), 2) + 4*pow(2*pow(z, 3)*(2*pow(x, 3) - 3*pow(x, 2) + x) - 3*pow(z, 2)*(2*pow(x, 3) - 3*pow(x, 2) + x) + z*(2*pow(x, 3) - 3*pow(x, 2) + x), 2) + (1.0L/2.0L)*pow(2*pow(x, 2)*z*pow(x - 1, 2)*(z - 1) + pow(x, 2)*z*pow(x - 1, 2)*(2*z - 1) + pow(x, 2)*pow(x - 1, 2)*(z - 1)*(2*z - 1) - pow(z, 4)*(6*pow(x, 2) - 6*x + 1) + 2*pow(z, 3)*(6*pow(x, 2) - 6*x + 1) - pow(z, 2)*(6*pow(x, 2) - 6*x + 1), 2), 4.0L/3.0L) + 2*pow(2, 1.0L/3.0L)*(pow(x, 2)*z*(z - 1)*(2*z - 1) + 4*x*z*(x - 1)*(z - 1)*(2*z - 1) + z*pow(x - 1, 2)*(z - 1)*(2*z - 1))/pow(4*pow(pow(x, 2)*z*(x - 1)*(z - 1)*(2*z - 1) + x*z*pow(x - 1, 2)*(z - 1)*(2*z - 1), 2) + 4*pow(2*pow(z, 3)*(2*pow(x, 3) - 3*pow(x, 2) + x) - 3*pow(z, 2)*(2*pow(x, 3) - 3*pow(x, 2) + x) + z*(2*pow(x, 3) - 3*pow(x, 2) + x), 2) + (1.0L/2.0L)*pow(2*pow(x, 2)*z*pow(x - 1, 2)*(z - 1) + pow(x, 2)*z*pow(x - 1, 2)*(2*z - 1) + pow(x, 2)*pow(x - 1, 2)*(z - 1)*(2*z - 1) - pow(z, 4)*(6*pow(x, 2) - 6*x + 1) + 2*pow(z, 3)*(6*pow(x, 2) - 6*x + 1) - pow(z, 2)*(6*pow(x, 2) - 6*x + 1), 2), 1.0L/3.0L) - 0.5 + pow(2, 1.0L/3.0L)*(2*pow(x, 2)*z*pow(x - 1, 2) + 2*pow(x, 2)*pow(x - 1, 2)*(z - 1) + pow(x, 2)*pow(x - 1, 2)*(2*z - 1) - 2*pow(z, 3)*(6*pow(x, 2) - 6*x + 1) + 3*pow(z, 2)*(6*pow(x, 2) - 6*x + 1) - z*(6*pow(x, 2) - 6*x + 1))/pow(4*pow(pow(x, 2)*z*(x - 1)*(z - 1)*(2*z - 1) + x*z*pow(x - 1, 2)*(z - 1)*(2*z - 1), 2) + 4*pow(2*pow(z, 3)*(2*pow(x, 3) - 3*pow(x, 2) + x) - 3*pow(z, 2)*(2*pow(x, 3) - 3*pow(x, 2) + x) + z*(2*pow(x, 3) - 3*pow(x, 2) + x), 2) + (1.0L/2.0L)*pow(2*pow(x, 2)*z*pow(x - 1, 2)*(z - 1) + pow(x, 2)*z*pow(x - 1, 2)*(2*z - 1) + pow(x, 2)*pow(x - 1, 2)*(z - 1)*(2*z - 1) - pow(z, 4)*(6*pow(x, 2) - 6*x + 1) + 2*pow(z, 3)*(6*pow(x, 2) - 6*x + 1) - pow(z, 2)*(6*pow(x, 2) - 6*x + 1), 2), 1.0L/3.0L);
 		case 22:
 			z=y;
-			return -2*pow(2, 1.0L/3.0L)*(pow(x, 2)*z*pow(z - 2, 2) + 4*x*z*(x - 2)*pow(z - 2, 2) + z*pow(x - 2, 2)*pow(z - 2, 2))/pow(8*pow(x, 8) - 64*pow(x, 7) + 192*pow(x, 6) - 256*pow(x, 5) + 128*pow(x, 4) + (1.0L/2.0L)*pow(z, 8)*(9*pow(x, 4) - 36*pow(x, 3) + 48*pow(x, 2) - 24*x + 4) - 16.0L/3.0L*pow(z, 7)*(9*pow(x, 4) - 36*pow(x, 3) + 48*pow(x, 2) - 24*x + 4) + (1.0L/9.0L)*pow(z, 6)*(207*pow(x, 6) - 1242*pow(x, 5) + 4518*pow(x, 4) - 9792*pow(x, 3) + 10536*pow(x, 2) - 4800*x + 800) - 8.0L/3.0L*pow(z, 5)*(69*pow(x, 6) - 414*pow(x, 5) + 1050*pow(x, 4) - 1440*pow(x, 3) + 1080*pow(x, 2) - 384*x + 64) + (1.0L/6.0L)*pow(z, 4)*(27*pow(x, 8) - 216*pow(x, 7) + 3984*pow(x, 6) - 20880*pow(x, 5) + 45952*pow(x, 4) - 48640*pow(x, 3) + 24256*pow(x, 2) - 4608*x + 768) - 8.0L/3.0L*pow(z, 3)*(9*pow(x, 8) - 72*pow(x, 7) + 504*pow(x, 6) - 2016*pow(x, 5) + 3920*pow(x, 4) - 3590*pow(x, 3) + 1298*pow(x, 2) - 12*x) + 4*pow(z, 2)*(11*pow(x, 8) - 88*pow(x, 7) + 368*pow(x, 6) - 976*pow(x, 5) + 1536*pow(x, 4) - 1296*pow(x, 3) + 496*pow(x, 2) - 32*x) - 32*z*(pow(x, 8) - 8*pow(x, 7) + 24*pow(x, 6) - 32*pow(x, 5) + 16*pow(x, 4) - 2*pow(x, 3) + 6*pow(x, 2) - 4*x) + 2, 1.0L/3.0L) + (2.0L/9.0L)*pow(2, 1.0L/3.0L)*(2*pow(x, 2)*z*(x - 2)*pow(z - 2, 2) + 2*x*z*pow(x - 2, 2)*pow(z - 2, 2) + 1)*(96*pow(x, 7) - 672*pow(x, 6) + 1728*pow(x, 5) - 1920*pow(x, 4) + 768*pow(x, 3) + 9*pow(z, 8)*(3*pow(x, 3) - 9*pow(x, 2) + 8*x - 2) - 96*pow(z, 7)*(3*pow(x, 3) - 9*pow(x, 2) + 8*x - 2) + pow(z, 6)*(207*pow(x, 5) - 1035*pow(x, 4) + 3012*pow(x, 3) - 4896*pow(x, 2) + 3512*x - 800) - 24*pow(z, 5)*(69*pow(x, 5) - 345*pow(x, 4) + 700*pow(x, 3) - 720*pow(x, 2) + 360*x - 64) + 2*pow(z, 4)*(27*pow(x, 7) - 189*pow(x, 6) + 2988*pow(x, 5) - 13050*pow(x, 4) + 22976*pow(x, 3) - 18240*pow(x, 2) + 6064*x - 576) - 8*pow(z, 3)*(36*pow(x, 7) - 252*pow(x, 6) + 1512*pow(x, 5) - 5040*pow(x, 4) + 7840*pow(x, 3) - 5385*pow(x, 2) + 1298*x - 6) + 48*pow(z, 2)*(11*pow(x, 7) - 77*pow(x, 6) + 276*pow(x, 5) - 610*pow(x, 4) + 768*pow(x, 3) - 486*pow(x, 2) + 124*x - 4) - 96*z*(4*pow(x, 7) - 28*pow(x, 6) + 72*pow(x, 5) - 80*pow(x, 4) + 32*pow(x, 3) - 3*pow(x, 2) + 6*x - 2))/pow(8*pow(x, 8) - 64*pow(x, 7) + 192*pow(x, 6) - 256*pow(x, 5) + 128*pow(x, 4) + (1.0L/2.0L)*pow(z, 8)*(9*pow(x, 4) - 36*pow(x, 3) + 48*pow(x, 2) - 24*x + 4) - 16.0L/3.0L*pow(z, 7)*(9*pow(x, 4) - 36*pow(x, 3) + 48*pow(x, 2) - 24*x + 4) + (1.0L/9.0L)*pow(z, 6)*(207*pow(x, 6) - 1242*pow(x, 5) + 4518*pow(x, 4) - 9792*pow(x, 3) + 10536*pow(x, 2) - 4800*x + 800) - 8.0L/3.0L*pow(z, 5)*(69*pow(x, 6) - 414*pow(x, 5) + 1050*pow(x, 4) - 1440*pow(x, 3) + 1080*pow(x, 2) - 384*x + 64) + (1.0L/6.0L)*pow(z, 4)*(27*pow(x, 8) - 216*pow(x, 7) + 3984*pow(x, 6) - 20880*pow(x, 5) + 45952*pow(x, 4) - 48640*pow(x, 3) + 24256*pow(x, 2) - 4608*x + 768) - 8.0L/3.0L*pow(z, 3)*(9*pow(x, 8) - 72*pow(x, 7) + 504*pow(x, 6) - 2016*pow(x, 5) + 3920*pow(x, 4) - 3590*pow(x, 3) + 1298*pow(x, 2) - 12*x) + 4*pow(z, 2)*(11*pow(x, 8) - 88*pow(x, 7) + 368*pow(x, 6) - 976*pow(x, 5) + 1536*pow(x, 4) - 1296*pow(x, 3) + 496*pow(x, 2) - 32*x) - 32*z*(pow(x, 8) - 8*pow(x, 7) + 24*pow(x, 6) - 32*pow(x, 5) + 16*pow(x, 4) - 2*pow(x, 3) + 6*pow(x, 2) - 4*x) + 2, 4.0L/3.0L) - pow(2, 1.0L/3.0L)*(pow(x, 2)*z*pow(x - 2, 2) + 2*pow(x, 2)*pow(x - 2, 2)*(z - 2) - 2*pow(z, 3)*(3*pow(x, 2) - 6*x + 2) + 8*pow(z, 2)*(3*pow(x, 2) - 6*x + 2) - 8*z*(3*pow(x, 2) - 6*x + 2))/pow(8*pow(x, 8) - 64*pow(x, 7) + 192*pow(x, 6) - 256*pow(x, 5) + 128*pow(x, 4) + (1.0L/2.0L)*pow(z, 8)*(9*pow(x, 4) - 36*pow(x, 3) + 48*pow(x, 2) - 24*x + 4) - 16.0L/3.0L*pow(z, 7)*(9*pow(x, 4) - 36*pow(x, 3) + 48*pow(x, 2) - 24*x + 4) + (1.0L/9.0L)*pow(z, 6)*(207*pow(x, 6) - 1242*pow(x, 5) + 4518*pow(x, 4) - 9792*pow(x, 3) + 10536*pow(x, 2) - 4800*x + 800) - 8.0L/3.0L*pow(z, 5)*(69*pow(x, 6) - 414*pow(x, 5) + 1050*pow(x, 4) - 1440*pow(x, 3) + 1080*pow(x, 2) - 384*x + 64) + (1.0L/6.0L)*pow(z, 4)*(27*pow(x, 8) - 216*pow(x, 7) + 3984*pow(x, 6) - 20880*pow(x, 5) + 45952*pow(x, 4) - 48640*pow(x, 3) + 24256*pow(x, 2) - 4608*x + 768) - 8.0L/3.0L*pow(z, 3)*(9*pow(x, 8) - 72*pow(x, 7) + 504*pow(x, 6) - 2016*pow(x, 5) + 3920*pow(x, 4) - 3590*pow(x, 3) + 1298*pow(x, 2) - 12*x) + 4*pow(z, 2)*(11*pow(x, 8) - 88*pow(x, 7) + 368*pow(x, 6) - 976*pow(x, 5) + 1536*pow(x, 4) - 1296*pow(x, 3) + 496*pow(x, 2) - 32*x) - 32*z*(pow(x, 8) - 8*pow(x, 7) + 24*pow(x, 6) - 32*pow(x, 5) + 16*pow(x, 4) - 2*pow(x, 3) + 6*pow(x, 2) - 4*x) + 2, 1.0L/3.0L) - 1.0L/27.0L*pow(2, 1.0L/3.0L)*(6*pow(x, 2)*z*pow(x - 2, 2)*(z - 2) + 3*pow(x, 2)*pow(x - 2, 2)*pow(z - 2, 2) - 3*pow(z, 4)*(3*pow(x, 2) - 6*x + 2) + 16*pow(z, 3)*(3*pow(x, 2) - 6*x + 2) - 24*pow(z, 2)*(3*pow(x, 2) - 6*x + 2))*(48*pow(x, 8) - 384*pow(x, 7) + 1152*pow(x, 6) - 1536*pow(x, 5) + 768*pow(x, 4) - 96*pow(x, 3) + 288*pow(x, 2) - 192*x - 6*pow(z, 7)*(9*pow(x, 4) - 36*pow(x, 3) + 48*pow(x, 2) - 24*x + 4) + 56*pow(z, 6)*(9*pow(x, 4) - 36*pow(x, 3) + 48*pow(x, 2) - 24*x + 4) - pow(z, 5)*(207*pow(x, 6) - 1242*pow(x, 5) + 4518*pow(x, 4) - 9792*pow(x, 3) + 10536*pow(x, 2) - 4800*x + 800) + 20*pow(z, 4)*(69*pow(x, 6) - 414*pow(x, 5) + 1050*pow(x, 4) - 1440*pow(x, 3) + 1080*pow(x, 2) - 384*x + 64) - pow(z, 3)*(27*pow(x, 8) - 216*pow(x, 7) + 3984*pow(x, 6) - 20880*pow(x, 5) + 45952*pow(x, 4) - 48640*pow(x, 3) + 24256*pow(x, 2) - 4608*x + 768) + 12*pow(z, 2)*(9*pow(x, 8) - 72*pow(x, 7) + 504*pow(x, 6) - 2016*pow(x, 5) + 3920*pow(x, 4) - 3590*pow(x, 3) + 1298*pow(x, 2) - 12*x) - 12*z*(11*pow(x, 8) - 88*pow(x, 7) + 368*pow(x, 6) - 976*pow(x, 5) + 1536*pow(x, 4) - 1296*pow(x, 3) + 496*pow(x, 2) - 32*x))/pow(8*pow(x, 8) - 64*pow(x, 7) + 192*pow(x, 6) - 256*pow(x, 5) + 128*pow(x, 4) + (1.0L/2.0L)*pow(z, 8)*(9*pow(x, 4) - 36*pow(x, 3) + 48*pow(x, 2) - 24*x + 4) - 16.0L/3.0L*pow(z, 7)*(9*pow(x, 4) - 36*pow(x, 3) + 48*pow(x, 2) - 24*x + 4) + (1.0L/9.0L)*pow(z, 6)*(207*pow(x, 6) - 1242*pow(x, 5) + 4518*pow(x, 4) - 9792*pow(x, 3) + 10536*pow(x, 2) - 4800*x + 800) - 8.0L/3.0L*pow(z, 5)*(69*pow(x, 6) - 414*pow(x, 5) + 1050*pow(x, 4) - 1440*pow(x, 3) + 1080*pow(x, 2) - 384*x + 64) + (1.0L/6.0L)*pow(z, 4)*(27*pow(x, 8) - 216*pow(x, 7) + 3984*pow(x, 6) - 20880*pow(x, 5) + 45952*pow(x, 4) - 48640*pow(x, 3) + 24256*pow(x, 2) - 4608*x + 768) - 8.0L/3.0L*pow(z, 3)*(9*pow(x, 8) - 72*pow(x, 7) + 504*pow(x, 6) - 2016*pow(x, 5) + 3920*pow(x, 4) - 3590*pow(x, 3) + 1298*pow(x, 2) - 12*x) + 4*pow(z, 2)*(11*pow(x, 8) - 88*pow(x, 7) + 368*pow(x, 6) - 976*pow(x, 5) + 1536*pow(x, 4) - 1296*pow(x, 3) + 496*pow(x, 2) - 32*x) - 32*z*(pow(x, 8) - 8*pow(x, 7) + 24*pow(x, 6) - 32*pow(x, 5) + 16*pow(x, 4) - 2*pow(x, 3) + 6*pow(x, 2) - 4*x) + 2, 4.0L/3.0L) + 4*M_PI*cos(4*M_PI*x + (1.0L/3.0L)*M_PI);
+			return -2*pow(2, 1.0L/3.0L)*(pow(x, 2)*z*pow(z - 2, 2) + 4*x*z*(x - 2)*pow(z - 2, 2) + z*pow(x - 2, 2)*pow(z - 2, 2))/pow(8*pow(x, 8) - 64*pow(x, 7) + 192*pow(x, 6) - 256*pow(x, 5) + 128*pow(x, 4) + (1.0L/2.0L)*pow(z, 8)*(9*pow(x, 4) - 36*pow(x, 3) + 48*pow(x, 2) - 24*x + 4) - 16.0L/3.0L*pow(z, 7)*(9*pow(x, 4) - 36*pow(x, 3) + 48*pow(x, 2) - 24*x + 4) + (1.0L/9.0L)*pow(z, 6)*(207*pow(x, 6) - 1242*pow(x, 5) + 4518*pow(x, 4) - 9792*pow(x, 3) + 10536*pow(x, 2) - 4800*x + 800) - 8.0L/3.0L*pow(z, 5)*(69*pow(x, 6) - 414*pow(x, 5) + 1050*pow(x, 4) - 1440*pow(x, 3) + 1080*pow(x, 2) - 384*x + 64) + (1.0L/6.0L)*pow(z, 4)*(27*pow(x, 8) - 216*pow(x, 7) + 3984*pow(x, 6) - 20880*pow(x, 5) + 45952*pow(x, 4) - 48640*pow(x, 3) + 24256*pow(x, 2) - 4608*x + 768) - 8.0L/3.0L*pow(z, 3)*(9*pow(x, 8) - 72*pow(x, 7) + 504*pow(x, 6) - 2016*pow(x, 5) + 3920*pow(x, 4) - 3590*pow(x, 3) + 1298*pow(x, 2) - 12*x) + 4*pow(z, 2)*(11*pow(x, 8) - 88*pow(x, 7) + 368*pow(x, 6) - 976*pow(x, 5) + 1536*pow(x, 4) - 1296*pow(x, 3) + 496*pow(x, 2) - 32*x) - 32*z*(pow(x, 8) - 8*pow(x, 7) + 24*pow(x, 6) - 32*pow(x, 5) + 16*pow(x, 4) - 2*pow(x, 3) + 6*pow(x, 2) - 4*x) + 2, 1.0L/3.0L) + (2.0L/9.0L)*pow(2, 1.0L/3.0L)*(2*pow(x, 2)*z*(x - 2)*pow(z - 2, 2) + 2*x*z*pow(x - 2, 2)*pow(z - 2, 2) + 1)*(96*pow(x, 7) - 672*pow(x, 6) + 1728*pow(x, 5) - 1920*pow(x, 4) + 768*pow(x, 3) + 9*pow(z, 8)*(3*pow(x, 3) - 9*pow(x, 2) + 8*x - 2) - 96*pow(z, 7)*(3*pow(x, 3) - 9*pow(x, 2) + 8*x - 2) + pow(z, 6)*(207*pow(x, 5) - 1035*pow(x, 4) + 3012*pow(x, 3) - 4896*pow(x, 2) + 3512*x - 800) - 24*pow(z, 5)*(69*pow(x, 5) - 345*pow(x, 4) + 700*pow(x, 3) - 720*pow(x, 2) + 360*x - 64) + 2*pow(z, 4)*(27*pow(x, 7) - 189*pow(x, 6) + 2988*pow(x, 5) - 13050*pow(x, 4) + 22976*pow(x, 3) - 18240*pow(x, 2) + 6064*x - 576) - 8*pow(z, 3)*(36*pow(x, 7) - 252*pow(x, 6) + 1512*pow(x, 5) - 5040*pow(x, 4) + 7840*pow(x, 3) - 5385*pow(x, 2) + 1298*x - 6) + 48*pow(z, 2)*(11*pow(x, 7) - 77*pow(x, 6) + 276*pow(x, 5) - 610*pow(x, 4) + 768*pow(x, 3) - 486*pow(x, 2) + 124*x - 4) - 96*z*(4*pow(x, 7) - 28*pow(x, 6) + 72*pow(x, 5) - 80*pow(x, 4) + 32*pow(x, 3) - 3*pow(x, 2) + 6*x - 2))/pow(8*pow(x, 8) - 64*pow(x, 7) + 192*pow(x, 6) - 256*pow(x, 5) + 128*pow(x, 4) + (1.0L/2.0L)*pow(z, 8)*(9*pow(x, 4) - 36*pow(x, 3) + 48*pow(x, 2) - 24*x + 4) - 16.0L/3.0L*pow(z, 7)*(9*pow(x, 4) - 36*pow(x, 3) + 48*pow(x, 2) - 24*x + 4) + (1.0L/9.0L)*pow(z, 6)*(207*pow(x, 6) - 1242*pow(x, 5) + 4518*pow(x, 4) - 9792*pow(x, 3) + 10536*pow(x, 2) - 4800*x + 800) - 8.0L/3.0L*pow(z, 5)*(69*pow(x, 6) - 414*pow(x, 5) + 1050*pow(x, 4) - 1440*pow(x, 3) + 1080*pow(x, 2) - 384*x + 64) + (1.0L/6.0L)*pow(z, 4)*(27*pow(x, 8) - 216*pow(x, 7) + 3984*pow(x, 6) - 20880*pow(x, 5) + 45952*pow(x, 4) - 48640*pow(x, 3) + 24256*pow(x, 2) - 4608*x + 768) - 8.0L/3.0L*pow(z, 3)*(9*pow(x, 8) - 72*pow(x, 7) + 504*pow(x, 6) - 2016*pow(x, 5) + 3920*pow(x, 4) - 3590*pow(x, 3) + 1298*pow(x, 2) - 12*x) + 4*pow(z, 2)*(11*pow(x, 8) - 88*pow(x, 7) + 368*pow(x, 6) - 976*pow(x, 5) + 1536*pow(x, 4) - 1296*pow(x, 3) + 496*pow(x, 2) - 32*x) - 32*z*(pow(x, 8) - 8*pow(x, 7) + 24*pow(x, 6) - 32*pow(x, 5) + 16*pow(x, 4) - 2*pow(x, 3) + 6*pow(x, 2) - 4*x) + 2, 4.0L/3.0L) - pow(2, 1.0L/3.0L)*(pow(x, 2)*z*pow(x - 2, 2) + 2*pow(x, 2)*pow(x - 2, 2)*(z - 2) - 2*pow(z, 3)*(3*pow(x, 2) - 6*x + 2) + 8*pow(z, 2)*(3*pow(x, 2) - 6*x + 2) - 8*z*(3*pow(x, 2) - 6*x + 2))/pow(8*pow(x, 8) - 64*pow(x, 7) + 192*pow(x, 6) - 256*pow(x, 5) + 128*pow(x, 4) + (1.0L/2.0L)*pow(z, 8)*(9*pow(x, 4) - 36*pow(x, 3) + 48*pow(x, 2) - 24*x + 4) - 16.0L/3.0L*pow(z, 7)*(9*pow(x, 4) - 36*pow(x, 3) + 48*pow(x, 2) - 24*x + 4) + (1.0L/9.0L)*pow(z, 6)*(207*pow(x, 6) - 1242*pow(x, 5) + 4518*pow(x, 4) - 9792*pow(x, 3) + 10536*pow(x, 2) - 4800*x + 800) - 8.0L/3.0L*pow(z, 5)*(69*pow(x, 6) - 414*pow(x, 5) + 1050*pow(x, 4) - 1440*pow(x, 3) + 1080*pow(x, 2) - 384*x + 64) + (1.0L/6.0L)*pow(z, 4)*(27*pow(x, 8) - 216*pow(x, 7) + 3984*pow(x, 6) - 20880*pow(x, 5) + 45952*pow(x, 4) - 48640*pow(x, 3) + 24256*pow(x, 2) - 4608*x + 768) - 8.0L/3.0L*pow(z, 3)*(9*pow(x, 8) - 72*pow(x, 7) + 504*pow(x, 6) - 2016*pow(x, 5) + 3920*pow(x, 4) - 3590*pow(x, 3) + 1298*pow(x, 2) - 12*x) + 4*pow(z, 2)*(11*pow(x, 8) - 88*pow(x, 7) + 368*pow(x, 6) - 976*pow(x, 5) + 1536*pow(x, 4) - 1296*pow(x, 3) + 496*pow(x, 2) - 32*x) - 32*z*(pow(x, 8) - 8*pow(x, 7) + 24*pow(x, 6) - 32*pow(x, 5) + 16*pow(x, 4) - 2*pow(x, 3) + 6*pow(x, 2) - 4*x) + 2, 1.0L/3.0L) - 1.0L/27.0L*pow(2, 1.0L/3.0L)*(6*pow(x, 2)*z*pow(x - 2, 2)*(z - 2) + 3*pow(x, 2)*pow(x - 2, 2)*pow(z - 2, 2) - 3*pow(z, 4)*(3*pow(x, 2) - 6*x + 2) + 16*pow(z, 3)*(3*pow(x, 2) - 6*x + 2) - 24*pow(z, 2)*(3*pow(x, 2) - 6*x + 2))*(48*pow(x, 8) - 384*pow(x, 7) + 1152*pow(x, 6) - 1536*pow(x, 5) + 768*pow(x, 4) - 96*pow(x, 3) + 288*pow(x, 2) - 192*x - 6*pow(z, 7)*(9*pow(x, 4) - 36*pow(x, 3) + 48*pow(x, 2) - 24*x + 4) + 56*pow(z, 6)*(9*pow(x, 4) - 36*pow(x, 3) + 48*pow(x, 2) - 24*x + 4) - pow(z, 5)*(207*pow(x, 6) - 1242*pow(x, 5) + 4518*pow(x, 4) - 9792*pow(x, 3) + 10536*pow(x, 2) - 4800*x + 800) + 20*pow(z, 4)*(69*pow(x, 6) - 414*pow(x, 5) + 1050*pow(x, 4) - 1440*pow(x, 3) + 1080*pow(x, 2) - 384*x + 64) - pow(z, 3)*(27*pow(x, 8) - 216*pow(x, 7) + 3984*pow(x, 6) - 20880*pow(x, 5) + 45952*pow(x, 4) - 48640*pow(x, 3) + 24256*pow(x, 2) - 4608*x + 768) + 12*pow(z, 2)*(9*pow(x, 8) - 72*pow(x, 7) + 504*pow(x, 6) - 2016*pow(x, 5) + 3920*pow(x, 4) - 3590*pow(x, 3) + 1298*pow(x, 2) - 12*x) - 12*z*(11*pow(x, 8) - 88*pow(x, 7) + 368*pow(x, 6) - 976*pow(x, 5) + 1536*pow(x, 4) - 1296*pow(x, 3) + 496*pow(x, 2) - 32*x))/pow(8*pow(x, 8) - 64*pow(x, 7) + 192*pow(x, 6) - 256*pow(x, 5) + 128*pow(x, 4) + (1.0L/2.0L)*pow(z, 8)*(9*pow(x, 4) - 36*pow(x, 3) + 48*pow(x, 2) - 24*x + 4) - 16.0L/3.0L*pow(z, 7)*(9*pow(x, 4) - 36*pow(x, 3) + 48*pow(x, 2) - 24*x + 4) + (1.0L/9.0L)*pow(z, 6)*(207*pow(x, 6) - 1242*pow(x, 5) + 4518*pow(x, 4) - 9792*pow(x, 3) + 10536*pow(x, 2) - 4800*x + 800) - 8.0L/3.0L*pow(z, 5)*(69*pow(x, 6) - 414*pow(x, 5) + 1050*pow(x, 4) - 1440*pow(x, 3) + 1080*pow(x, 2) - 384*x + 64) + (1.0L/6.0L)*pow(z, 4)*(27*pow(x, 8) - 216*pow(x, 7) + 3984*pow(x, 6) - 20880*pow(x, 5) + 45952*pow(x, 4) - 48640*pow(x, 3) + 24256*pow(x, 2) - 4608*x + 768) - 8.0L/3.0L*pow(z, 3)*(9*pow(x, 8) - 72*pow(x, 7) + 504*pow(x, 6) - 2016*pow(x, 5) + 3920*pow(x, 4) - 3590*pow(x, 3) + 1298*pow(x, 2) - 12*x) + 4*pow(z, 2)*(11*pow(x, 8) - 88*pow(x, 7) + 368*pow(x, 6) - 976*pow(x, 5) + 1536*pow(x, 4) - 1296*pow(x, 3) + 496*pow(x, 2) - 32*x) - 32*z*(pow(x, 8) - 8*pow(x, 7) + 24*pow(x, 6) - 32*pow(x, 5) + 16*pow(x, 4) - 2*pow(x, 3) + 6*pow(x, 2) - 4*x) + 2, 4.0L/3.0L) + 4*PI*cos(4*PI*x + (1.0L/3.0L)*PI);
 		case 24:
 			return 2*pow(2, 1.0L/3.0L)*pow(PI, 2)*pow(p, 2)*sin(PI*p*y)*sin(PI*p*z)*cos(PI*p*x)/pow(6*pow(PI, 2)*pow(p, 2)*pow(sin(PI*p*x), 2)*pow(sin(PI*p*y), 2)*pow(sin(PI*p*z), 2) + (1.0L/2.0L)*pow(-2*PI*p*(cos(PI*p*x) - 1)*sin(PI*p*z)*cos(PI*p*y) + PI*p*(cos(PI*p*y) - 1)*sin(PI*p*z)*cos(PI*p*x), 2) + (1.0L/2.0L)*pow(pow(PI, 2)*pow(p, 2)*(cos(PI*p*z)/(PI*p) - 1/(PI*p))*sin(PI*p*x)*cos(PI*p*y) + PI*p*(cos(PI*p*y) - 1)*sin(PI*p*x)*cos(PI*p*z), 2) + (1.0L/2.0L)*pow(pow(PI, 2)*pow(p, 2)*(cos(PI*p*z)/(PI*p) - 1/(PI*p))*sin(PI*p*y)*cos(PI*p*x) - 2*PI*p*(cos(PI*p*x) - 1)*sin(PI*p*y)*cos(PI*p*z), 2), 1.0L/3.0L) - 2.0L/3.0L*pow(2, 1.0L/3.0L)*PI*p*(12*pow(PI, 3)*pow(p, 3)*sin(PI*p*x)*pow(sin(PI*p*y), 2)*pow(sin(PI*p*z), 2)*cos(PI*p*x) - (-2*PI*p*(cos(PI*p*x) - 1)*sin(PI*p*z)*cos(PI*p*y) + PI*p*(cos(PI*p*y) - 1)*sin(PI*p*z)*cos(PI*p*x))*(pow(PI, 2)*pow(p, 2)*(cos(PI*p*y) - 1)*sin(PI*p*x)*sin(PI*p*z) - 2*pow(PI, 2)*pow(p, 2)*sin(PI*p*x)*sin(PI*p*z)*cos(PI*p*y)) + (pow(PI, 2)*pow(p, 2)*(cos(PI*p*z)/(PI*p) - 1/(PI*p))*sin(PI*p*x)*cos(PI*p*y) + PI*p*(cos(PI*p*y) - 1)*sin(PI*p*x)*cos(PI*p*z))*(pow(PI, 3)*pow(p, 3)*(cos(PI*p*z)/(PI*p) - 1/(PI*p))*cos(PI*p*x)*cos(PI*p*y) + pow(PI, 2)*pow(p, 2)*(cos(PI*p*y) - 1)*cos(PI*p*x)*cos(PI*p*z)) - (pow(PI, 2)*pow(p, 2)*(cos(PI*p*z)/(PI*p) - 1/(PI*p))*sin(PI*p*y)*cos(PI*p*x) - 2*PI*p*(cos(PI*p*x) - 1)*sin(PI*p*y)*cos(PI*p*z))*(pow(PI, 3)*pow(p, 3)*(cos(PI*p*z)/(PI*p) - 1/(PI*p))*sin(PI*p*x)*sin(PI*p*y) - 2*pow(PI, 2)*pow(p, 2)*sin(PI*p*x)*sin(PI*p*y)*cos(PI*p*z)))*sin(PI*p*x)*sin(PI*p*y)*sin(PI*p*z)/pow(6*pow(PI, 2)*pow(p, 2)*pow(sin(PI*p*x), 2)*pow(sin(PI*p*y), 2)*pow(sin(PI*p*z), 2) + (1.0L/2.0L)*pow(-2*PI*p*(cos(PI*p*x) - 1)*sin(PI*p*z)*cos(PI*p*y) + PI*p*(cos(PI*p*y) - 1)*sin(PI*p*z)*cos(PI*p*x), 2) + (1.0L/2.0L)*pow(pow(PI, 2)*pow(p, 2)*(cos(PI*p*z)/(PI*p) - 1/(PI*p))*sin(PI*p*x)*cos(PI*p*y) + PI*p*(cos(PI*p*y) - 1)*sin(PI*p*x)*cos(PI*p*z), 2) + (1.0L/2.0L)*pow(pow(PI, 2)*pow(p, 2)*(cos(PI*p*z)/(PI*p) - 1/(PI*p))*sin(PI*p*y)*cos(PI*p*x) - 2*PI*p*(cos(PI*p*x) - 1)*sin(PI*p*y)*cos(PI*p*z), 2), 4.0L/3.0L) + PI*q*sin(PI*q*y)*sin(PI*q*z)*cos(PI*q*x) - 1.0L/6.0L*pow(2, 1.0L/3.0L)*(-2*PI*p*(cos(PI*p*x) - 1)*sin(PI*p*z)*cos(PI*p*y) + PI*p*(cos(PI*p*y) - 1)*sin(PI*p*z)*cos(PI*p*x))*(12*pow(PI, 3)*pow(p, 3)*pow(sin(PI*p*x), 2)*sin(PI*p*y)*pow(sin(PI*p*z), 2)*cos(PI*p*y) + (-2*PI*p*(cos(PI*p*x) - 1)*sin(PI*p*z)*cos(PI*p*y) + PI*p*(cos(PI*p*y) - 1)*sin(PI*p*z)*cos(PI*p*x))*(2*pow(PI, 2)*pow(p, 2)*(cos(PI*p*x) - 1)*sin(PI*p*y)*sin(PI*p*z) - pow(PI, 2)*pow(p, 2)*sin(PI*p*y)*sin(PI*p*z)*cos(PI*p*x)) - (pow(PI, 2)*pow(p, 2)*(cos(PI*p*z)/(PI*p) - 1/(PI*p))*sin(PI*p*x)*cos(PI*p*y) + PI*p*(cos(PI*p*y) - 1)*sin(PI*p*x)*cos(PI*p*z))*(pow(PI, 3)*pow(p, 3)*(cos(PI*p*z)/(PI*p) - 1/(PI*p))*sin(PI*p*x)*sin(PI*p*y) + pow(PI, 2)*pow(p, 2)*sin(PI*p*x)*sin(PI*p*y)*cos(PI*p*z)) + (pow(PI, 2)*pow(p, 2)*(cos(PI*p*z)/(PI*p) - 1/(PI*p))*sin(PI*p*y)*cos(PI*p*x) - 2*PI*p*(cos(PI*p*x) - 1)*sin(PI*p*y)*cos(PI*p*z))*(pow(PI, 3)*pow(p, 3)*(cos(PI*p*z)/(PI*p) - 1/(PI*p))*cos(PI*p*x)*cos(PI*p*y) - 2*pow(PI, 2)*pow(p, 2)*(cos(PI*p*x) - 1)*cos(PI*p*y)*cos(PI*p*z)))/pow(6*pow(PI, 2)*pow(p, 2)*pow(sin(PI*p*x), 2)*pow(sin(PI*p*y), 2)*pow(sin(PI*p*z), 2) + (1.0L/2.0L)*pow(-2*PI*p*(cos(PI*p*x) - 1)*sin(PI*p*z)*cos(PI*p*y) + PI*p*(cos(PI*p*y) - 1)*sin(PI*p*z)*cos(PI*p*x), 2) + (1.0L/2.0L)*pow(pow(PI, 2)*pow(p, 2)*(cos(PI*p*z)/(PI*p) - 1/(PI*p))*sin(PI*p*x)*cos(PI*p*y) + PI*p*(cos(PI*p*y) - 1)*sin(PI*p*x)*cos(PI*p*z), 2) + (1.0L/2.0L)*pow(pow(PI, 2)*pow(p, 2)*(cos(PI*p*z)/(PI*p) - 1/(PI*p))*sin(PI*p*y)*cos(PI*p*x) - 2*PI*p*(cos(PI*p*x) - 1)*sin(PI*p*y)*cos(PI*p*z), 2), 4.0L/3.0L) - 1.0L/6.0L*pow(2, 1.0L/3.0L)*(pow(PI, 2)*pow(p, 2)*(cos(PI*p*z)/(PI*p) - 1/(PI*p))*sin(PI*p*y)*cos(PI*p*x) - 2*PI*p*(cos(PI*p*x) - 1)*sin(PI*p*y)*cos(PI*p*z))*(12*pow(PI, 3)*pow(p, 3)*pow(sin(PI*p*x), 2)*pow(sin(PI*p*y), 2)*sin(PI*p*z)*cos(PI*p*z) + (-2*PI*p*(cos(PI*p*x) - 1)*sin(PI*p*z)*cos(PI*p*y) + PI*p*(cos(PI*p*y) - 1)*sin(PI*p*z)*cos(PI*p*x))*(-2*pow(PI, 2)*pow(p, 2)*(cos(PI*p*x) - 1)*cos(PI*p*y)*cos(PI*p*z) + pow(PI, 2)*pow(p, 2)*(cos(PI*p*y) - 1)*cos(PI*p*x)*cos(PI*p*z)) - (pow(PI, 2)*pow(p, 2)*(cos(PI*p*z)/(PI*p) - 1/(PI*p))*sin(PI*p*x)*cos(PI*p*y) + PI*p*(cos(PI*p*y) - 1)*sin(PI*p*x)*cos(PI*p*z))*(pow(PI, 2)*pow(p, 2)*(cos(PI*p*y) - 1)*sin(PI*p*x)*sin(PI*p*z) + pow(PI, 2)*pow(p, 2)*sin(PI*p*x)*sin(PI*p*z)*cos(PI*p*y)) + (pow(PI, 2)*pow(p, 2)*(cos(PI*p*z)/(PI*p) - 1/(PI*p))*sin(PI*p*y)*cos(PI*p*x) - 2*PI*p*(cos(PI*p*x) - 1)*sin(PI*p*y)*cos(PI*p*z))*(2*pow(PI, 2)*pow(p, 2)*(cos(PI*p*x) - 1)*sin(PI*p*y)*sin(PI*p*z) - pow(PI, 2)*pow(p, 2)*sin(PI*p*y)*sin(PI*p*z)*cos(PI*p*x)))/pow(6*pow(PI, 2)*pow(p, 2)*pow(sin(PI*p*x), 2)*pow(sin(PI*p*y), 2)*pow(sin(PI*p*z), 2) + (1.0L/2.0L)*pow(-2*PI*p*(cos(PI*p*x) - 1)*sin(PI*p*z)*cos(PI*p*y) + PI*p*(cos(PI*p*y) - 1)*sin(PI*p*z)*cos(PI*p*x), 2) + (1.0L/2.0L)*pow(pow(PI, 2)*pow(p, 2)*(cos(PI*p*z)/(PI*p) - 1/(PI*p))*sin(PI*p*x)*cos(PI*p*y) + PI*p*(cos(PI*p*y) - 1)*sin(PI*p*x)*cos(PI*p*z), 2) + (1.0L/2.0L)*pow(pow(PI, 2)*pow(p, 2)*(cos(PI*p*z)/(PI*p) - 1/(PI*p))*sin(PI*p*y)*cos(PI*p*x) - 2*PI*p*(cos(PI*p*x) - 1)*sin(PI*p*y)*cos(PI*p*z), 2), 4.0L/3.0L) + pow(2, 1.0L/3.0L)*(2*pow(PI, 2)*pow(p, 2)*(cos(PI*p*x) - 1)*sin(PI*p*y)*sin(PI*p*z) - pow(PI, 2)*pow(p, 2)*sin(PI*p*y)*sin(PI*p*z)*cos(PI*p*x))/pow(6*pow(PI, 2)*pow(p, 2)*pow(sin(PI*p*x), 2)*pow(sin(PI*p*y), 2)*pow(sin(PI*p*z), 2) + (1.0L/2.0L)*pow(-2*PI*p*(cos(PI*p*x) - 1)*sin(PI*p*z)*cos(PI*p*y) + PI*p*(cos(PI*p*y) - 1)*sin(PI*p*z)*cos(PI*p*x), 2) + (1.0L/2.0L)*pow(pow(PI, 2)*pow(p, 2)*(cos(PI*p*z)/(PI*p) - 1/(PI*p))*sin(PI*p*x)*cos(PI*p*y) + PI*p*(cos(PI*p*y) - 1)*sin(PI*p*x)*cos(PI*p*z), 2) + (1.0L/2.0L)*pow(pow(PI, 2)*pow(p, 2)*(cos(PI*p*z)/(PI*p) - 1/(PI*p))*sin(PI*p*y)*cos(PI*p*x) - 2*PI*p*(cos(PI*p*x) - 1)*sin(PI*p*y)*cos(PI*p*z), 2), 1.0L/3.0L);
 
@@ -112,7 +115,10 @@
 			return 8.0*pow(PI, 2)*x*z*(z - 2)*sin(4*PI*x*z) - 2.0*PI*z*cos(4*PI*x*z) - 2.0*PI*(z - 2)*cos(4*PI*x*z) + 0.25*PI*(32*cos(4*PI*x)/pow(x, 2) - 4*(8*pow(PI, 2)*pow(x, 2) + 1)*sin(4*PI*x)/(PI*pow(x, 3)) - 4*(4*pow(PI, 2)*pow(z, 2)*(PI*x*z - PI*x)*cos(4*PI*x*z) + pow(PI, 2)*pow(z, 2)*(8*pow(PI, 2)*pow(x, 2)*pow(z, 2) - 16*pow(PI, 2)*pow(x, 2)*z - 1)*sin(4*PI*x*z) - 2*PI*z*(-PI*z + PI)*sin(4*PI*x*z) - 8*PI*z*(pow(PI, 2)*x*pow(z, 2) - 2*pow(PI, 2)*x*z)*cos(4*PI*x*z) - (pow(PI, 2)*pow(z, 2) - 2*pow(PI, 2)*z)*sin(4*PI*x*z))/(pow(PI, 3)*pow(x, 3)) - 20*sin(4*PI*x)/(PI*pow(x, 3)) - 6*(8*pow(PI, 2)*pow(x, 2) + 1)*cos(4*PI*x)/(pow(PI, 2)*pow(x, 4)) - 6*(-4*PI*z*(PI*x*z - PI*x)*sin(4*PI*x*z) + PI*z*(8*pow(PI, 2)*pow(x, 2)*pow(z, 2) - 16*pow(PI, 2)*pow(x, 2)*z - 1)*cos(4*PI*x*z) - (-PI*z + PI)*cos(4*PI*x*z) + 4*(pow(PI, 2)*x*pow(z, 2) - 2*pow(PI, 2)*x*z)*sin(4*PI*x*z))/(pow(PI, 3)*pow(x, 4)) + 3*(8*pow(PI, 2)*pow(x, 2) + 1)*sin(4*PI*x)/(pow(PI, 3)*pow(x, 5)) + 3*(4*(PI*x*z - PI*x)*cos(4*PI*x*z) + (8*pow(PI, 2)*pow(x, 2)*pow(z, 2) - 16*pow(PI, 2)*pow(x, 2)*z - 1)*sin(4*PI*x*z))/(pow(PI, 3)*pow(x, 5))) + 4*PI*sin(4*PI*x)*cos(4*PI*z) + (8.0L/5.0L)*pow(PI, 2)*sin(4*PI*x) + 2*(-4.0*pow(PI, 2)*pow(x, 2)*(PI*x*z - PI*x)*cos(4*PI*x*z) - 1.0*pow(PI, 2)*pow(x, 2)*(8*pow(PI, 2)*pow(x, 2)*pow(z, 2) - 16*pow(PI, 2)*pow(x, 2)*z - 1)*sin(4*PI*x*z) - 1.0*pow(PI, 2)*pow(x, 2)*sin(4*PI*x*z) + 8.0*PI*x*(pow(PI, 2)*pow(x, 2)*z - pow(PI, 2)*pow(x, 2))*cos(4*PI*x*z))/(pow(PI, 2)*pow(x, 3));
 		case 14:
 			z=y;
-			return 4*M_PI*sin(4*M_PI*x)*cos(4*M_PI*z) + (1.0L/10.0L)*pow(2, 1.0L/3.0L)*(40.0*pow(M_PI, 2)*x*z*(z - 2)*sin(4*M_PI*x*z) - 10.0*M_PI*z*cos(4*M_PI*x*z) - 10.0*M_PI*(z - 2)*cos(4*M_PI*x*z) + 1.25*M_PI*(32*cos(4*M_PI*x)/pow(x, 2) - 4*(8*pow(M_PI, 2)*pow(x, 2) + 1)*sin(4*M_PI*x)/(M_PI*pow(x, 3)) - 4*(4*pow(M_PI, 2)*pow(z, 2)*(M_PI*x*z - M_PI*x)*cos(4*M_PI*x*z) + pow(M_PI, 2)*pow(z, 2)*(8*pow(M_PI, 2)*pow(x, 2)*pow(z, 2) - 16*pow(M_PI, 2)*pow(x, 2)*z - 1)*sin(4*M_PI*x*z) - 2*M_PI*z*(-M_PI*z + M_PI)*sin(4*M_PI*x*z) - 8*M_PI*z*(pow(M_PI, 2)*x*pow(z, 2) - 2*pow(M_PI, 2)*x*z)*cos(4*M_PI*x*z) - (pow(M_PI, 2)*pow(z, 2) - 2*pow(M_PI, 2)*z)*sin(4*M_PI*x*z))/(pow(M_PI, 3)*pow(x, 3)) - 20*sin(4*M_PI*x)/(M_PI*pow(x, 3)) - 6*(8*pow(M_PI, 2)*pow(x, 2) + 1)*cos(4*M_PI*x)/(pow(M_PI, 2)*pow(x, 4)) - 6*(-4*M_PI*z*(M_PI*x*z - M_PI*x)*sin(4*M_PI*x*z) + M_PI*z*(8*pow(M_PI, 2)*pow(x, 2)*pow(z, 2) - 16*pow(M_PI, 2)*pow(x, 2)*z - 1)*cos(4*M_PI*x*z) - (-M_PI*z + M_PI)*cos(4*M_PI*x*z) + 4*(pow(M_PI, 2)*x*pow(z, 2) - 2*pow(M_PI, 2)*x*z)*sin(4*M_PI*x*z))/(pow(M_PI, 3)*pow(x, 4)) + 3*(8*pow(M_PI, 2)*pow(x, 2) + 1)*sin(4*M_PI*x)/(pow(M_PI, 3)*pow(x, 5)) + 3*(4*(M_PI*x*z - M_PI*x)*cos(4*M_PI*x*z) + (8*pow(M_PI, 2)*pow(x, 2)*pow(z, 2) - 16*pow(M_PI, 2)*pow(x, 2)*z - 1)*sin(4*M_PI*x*z))/(pow(M_PI, 3)*pow(x, 5))) + 8*pow(M_PI, 2)*sin(4*M_PI*x))/pow(4.0*pow(M_PI, 2)*pow(z, 2)*pow(z - 2, 2)*pow(cos(4*M_PI*x*z), 2) + (1.0L/2.0L)*pow(2.0*M_PI*x*(z - 2)*cos(4*M_PI*x*z) - 0.0625*M_PI*(16*sin(4*M_PI*x)/(M_PI*pow(x, 2)) + 4*(8*pow(M_PI, 2)*pow(x, 2) + 1)*cos(4*M_PI*x)/(pow(M_PI, 2)*pow(x, 3)) + 4*(-4*M_PI*z*(M_PI*x*z - M_PI*x)*sin(4*M_PI*x*z) + M_PI*z*(8*pow(M_PI, 2)*pow(x, 2)*pow(z, 2) - 16*pow(M_PI, 2)*pow(x, 2)*z - 1)*cos(4*M_PI*x*z) - (-M_PI*z + M_PI)*cos(4*M_PI*x*z) + 4*(pow(M_PI, 2)*x*pow(z, 2) - 2*pow(M_PI, 2)*x*z)*sin(4*M_PI*x*z))/(pow(M_PI, 3)*pow(x, 3)) - 3*(8*pow(M_PI, 2)*pow(x, 2) + 1)*sin(4*M_PI*x)/(pow(M_PI, 3)*pow(x, 4)) - 3*(4*(M_PI*x*z - M_PI*x)*cos(4*M_PI*x*z) + (8*pow(M_PI, 2)*pow(x, 2)*pow(z, 2) - 16*pow(M_PI, 2)*pow(x, 2)*z - 1)*sin(4*M_PI*x*z))/(pow(M_PI, 3)*pow(x, 4))) + 0.5*sin(4*M_PI*x*z) + (2.0L/5.0L)*M_PI*cos(4*M_PI*x), 2) + pow(M_PI*x*(M_PI*x*z - M_PI*x)*sin(4*M_PI*x*z) - 0.25*M_PI*x*(8*pow(M_PI, 2)*pow(x, 2)*pow(z, 2) - 16*pow(M_PI, 2)*pow(x, 2)*z - 1)*cos(4*M_PI*x*z) - 0.25*M_PI*x*cos(4*M_PI*x*z) - (pow(M_PI, 2)*pow(x, 2)*z - pow(M_PI, 2)*pow(x, 2))*sin(4*M_PI*x*z), 2)/(pow(M_PI, 4)*pow(x, 6)), 1.0L/3.0L) + (1.0L/750.0L)*pow(2, 1.0L/3.0L)*(-10.0*M_PI*x*(z - 2)*cos(4*M_PI*x*z) + 0.3125*M_PI*(16*sin(4*M_PI*x)/(M_PI*pow(x, 2)) + 4*(8*pow(M_PI, 2)*pow(x, 2) + 1)*cos(4*M_PI*x)/(pow(M_PI, 2)*pow(x, 3)) + 4*(-4*M_PI*z*(M_PI*x*z - M_PI*x)*sin(4*M_PI*x*z) + M_PI*z*(8*pow(M_PI, 2)*pow(x, 2)*pow(z, 2) - 16*pow(M_PI, 2)*pow(x, 2)*z - 1)*cos(4*M_PI*x*z) - (-M_PI*z + M_PI)*cos(4*M_PI*x*z) + 4*(pow(M_PI, 2)*x*pow(z, 2) - 2*pow(M_PI, 2)*x*z)*sin(4*M_PI*x*z))/(pow(M_PI, 3)*pow(x, 3)) - 3*(8*pow(M_PI, 2)*pow(x, 2) + 1)*sin(4*M_PI*x)/(pow(M_PI, 3)*pow(x, 4)) - 3*(4*(M_PI*x*z - M_PI*x)*cos(4*M_PI*x*z) + (8*pow(M_PI, 2)*pow(x, 2)*pow(z, 2) - 16*pow(M_PI, 2)*pow(x, 2)*z - 1)*sin(4*M_PI*x*z))/(pow(M_PI, 3)*pow(x, 4))) - 2.5*sin(4*M_PI*x*z) - 2*M_PI*cos(4*M_PI*x))*(800.0*pow(M_PI, 3)*pow(z, 3)*pow(z - 2, 2)*sin(4*M_PI*x*z)*cos(4*M_PI*x*z) - (-10.0*M_PI*x*(z - 2)*cos(4*M_PI*x*z) + 0.3125*M_PI*(16*sin(4*M_PI*x)/(M_PI*pow(x, 2)) + 4*(8*pow(M_PI, 2)*pow(x, 2) + 1)*cos(4*M_PI*x)/(pow(M_PI, 2)*pow(x, 3)) + 4*(-4*M_PI*z*(M_PI*x*z - M_PI*x)*sin(4*M_PI*x*z) + M_PI*z*(8*pow(M_PI, 2)*pow(x, 2)*pow(z, 2) - 16*pow(M_PI, 2)*pow(x, 2)*z - 1)*cos(4*M_PI*x*z) - (-M_PI*z + M_PI)*cos(4*M_PI*x*z) + 4*(pow(M_PI, 2)*x*pow(z, 2) - 2*pow(M_PI, 2)*x*z)*sin(4*M_PI*x*z))/(pow(M_PI, 3)*pow(x, 3)) - 3*(8*pow(M_PI, 2)*pow(x, 2) + 1)*sin(4*M_PI*x)/(pow(M_PI, 3)*pow(x, 4)) - 3*(4*(M_PI*x*z - M_PI*x)*cos(4*M_PI*x*z) + (8*pow(M_PI, 2)*pow(x, 2)*pow(z, 2) - 16*pow(M_PI, 2)*pow(x, 2)*z - 1)*sin(4*M_PI*x*z))/(pow(M_PI, 3)*pow(x, 4))) - 2.5*sin(4*M_PI*x*z) - 2*M_PI*cos(4*M_PI*x))*(40.0*pow(M_PI, 2)*x*z*(z - 2)*sin(4*M_PI*x*z) - 10.0*M_PI*z*cos(4*M_PI*x*z) - 10.0*M_PI*(z - 2)*cos(4*M_PI*x*z) + 1.25*M_PI*(32*cos(4*M_PI*x)/pow(x, 2) - 4*(8*pow(M_PI, 2)*pow(x, 2) + 1)*sin(4*M_PI*x)/(M_PI*pow(x, 3)) - 4*(4*pow(M_PI, 2)*pow(z, 2)*(M_PI*x*z - M_PI*x)*cos(4*M_PI*x*z) + pow(M_PI, 2)*pow(z, 2)*(8*pow(M_PI, 2)*pow(x, 2)*pow(z, 2) - 16*pow(M_PI, 2)*pow(x, 2)*z - 1)*sin(4*M_PI*x*z) - 2*M_PI*z*(-M_PI*z + M_PI)*sin(4*M_PI*x*z) - 8*M_PI*z*(pow(M_PI, 2)*x*pow(z, 2) - 2*pow(M_PI, 2)*x*z)*cos(4*M_PI*x*z) - (pow(M_PI, 2)*pow(z, 2) - 2*pow(M_PI, 2)*z)*sin(4*M_PI*x*z))/(pow(M_PI, 3)*pow(x, 3)) - 20*sin(4*M_PI*x)/(M_PI*pow(x, 3)) - 6*(8*pow(M_PI, 2)*pow(x, 2) + 1)*cos(4*M_PI*x)/(pow(M_PI, 2)*pow(x, 4)) - 6*(-4*M_PI*z*(M_PI*x*z - M_PI*x)*sin(4*M_PI*x*z) + M_PI*z*(8*pow(M_PI, 2)*pow(x, 2)*pow(z, 2) - 16*pow(M_PI, 2)*pow(x, 2)*z - 1)*cos(4*M_PI*x*z) - (-M_PI*z + M_PI)*cos(4*M_PI*x*z) + 4*(pow(M_PI, 2)*x*pow(z, 2) - 2*pow(M_PI, 2)*x*z)*sin(4*M_PI*x*z))/(pow(M_PI, 3)*pow(x, 4)) + 3*(8*pow(M_PI, 2)*pow(x, 2) + 1)*sin(4*M_PI*x)/(pow(M_PI, 3)*pow(x, 5)) + 3*(4*(M_PI*x*z - M_PI*x)*cos(4*M_PI*x*z) + (8*pow(M_PI, 2)*pow(x, 2)*pow(z, 2) - 16*pow(M_PI, 2)*pow(x, 2)*z - 1)*sin(4*M_PI*x*z))/(pow(M_PI, 3)*pow(x, 5))) + 8*pow(M_PI, 2)*sin(4*M_PI*x)) - (50*M_PI*x*(M_PI*x*z - M_PI*x)*sin(4*M_PI*x*z) - 12.5*M_PI*x*(8*pow(M_PI, 2)*pow(x, 2)*pow(z, 2) - 16*pow(M_PI, 2)*pow(x, 2)*z - 1)*cos(4*M_PI*x*z) - 12.5*M_PI*x*cos(4*M_PI*x*z) - 50*(pow(M_PI, 2)*pow(x, 2)*z - pow(M_PI, 2)*pow(x, 2))*sin(4*M_PI*x*z))*(4*pow(M_PI, 2)*x*z*(M_PI*x*z - M_PI*x)*cos(4*M_PI*x*z) + pow(M_PI, 2)*x*z*(8*pow(M_PI, 2)*pow(x, 2)*pow(z, 2) - 16*pow(M_PI, 2)*pow(x, 2)*z - 1)*sin(4*M_PI*x*z) + pow(M_PI, 2)*x*z*sin(4*M_PI*x*z) - M_PI*x*(-M_PI*z + M_PI)*sin(4*M_PI*x*z) - 4.0*M_PI*x*(pow(M_PI, 2)*x*pow(z, 2) - 2*pow(M_PI, 2)*x*z)*cos(4*M_PI*x*z) - 4*M_PI*z*(pow(M_PI, 2)*pow(x, 2)*z - pow(M_PI, 2)*pow(x, 2))*cos(4*M_PI*x*z) + M_PI*(M_PI*x*z - M_PI*x)*sin(4*M_PI*x*z) - 2*(pow(M_PI, 2)*x*z - pow(M_PI, 2)*x)*sin(4*M_PI*x*z) - 0.25*M_PI*(8*pow(M_PI, 2)*pow(x, 2)*pow(z, 2) - 16*pow(M_PI, 2)*pow(x, 2)*z - 1)*cos(4*M_PI*x*z) - 0.25*M_PI*cos(4*M_PI*x*z))/(pow(M_PI, 4)*pow(x, 6)) + 150*pow(M_PI*x*(M_PI*x*z - M_PI*x)*sin(4*M_PI*x*z) - 0.25*M_PI*x*(8*pow(M_PI, 2)*pow(x, 2)*pow(z, 2) - 16*pow(M_PI, 2)*pow(x, 2)*z - 1)*cos(4*M_PI*x*z) - 0.25*M_PI*x*cos(4*M_PI*x*z) - (pow(M_PI, 2)*pow(x, 2)*z - pow(M_PI, 2)*pow(x, 2))*sin(4*M_PI*x*z), 2)/(pow(M_PI, 4)*pow(x, 7)))/pow(4.0*pow(M_PI, 2)*pow(z, 2)*pow(z - 2, 2)*pow(cos(4*M_PI*x*z), 2) + (1.0L/2.0L)*pow(2.0*M_PI*x*(z - 2)*cos(4*M_PI*x*z) - 0.0625*M_PI*(16*sin(4*M_PI*x)/(M_PI*pow(x, 2)) + 4*(8*pow(M_PI, 2)*pow(x, 2) + 1)*cos(4*M_PI*x)/(pow(M_PI, 2)*pow(x, 3)) + 4*(-4*M_PI*z*(M_PI*x*z - M_PI*x)*sin(4*M_PI*x*z) + M_PI*z*(8*pow(M_PI, 2)*pow(x, 2)*pow(z, 2) - 16*pow(M_PI, 2)*pow(x, 2)*z - 1)*cos(4*M_PI*x*z) - (-M_PI*z + M_PI)*cos(4*M_PI*x*z) + 4*(pow(M_PI, 2)*x*pow(z, 2) - 2*pow(M_PI, 2)*x*z)*sin(4*M_PI*x*z))/(pow(M_PI, 3)*pow(x, 3)) - 3*(8*pow(M_PI, 2)*pow(x, 2) + 1)*sin(4*M_PI*x)/(pow(M_PI, 3)*pow(x, 4)) - 3*(4*(M_PI*x*z - M_PI*x)*cos(4*M_PI*x*z) + (8*pow(M_PI, 2)*pow(x, 2)*pow(z, 2) - 16*pow(M_PI, 2)*pow(x, 2)*z - 1)*sin(4*M_PI*x*z))/(pow(M_PI, 3)*pow(x, 4))) + 0.5*sin(4*M_PI*x*z) + (2.0L/5.0L)*M_PI*cos(4*M_PI*x), 2) + pow(M_PI*x*(M_PI*x*z - M_PI*x)*sin(4*M_PI*x*z) - 0.25*M_PI*x*(8*pow(M_PI, 2)*pow(x, 2)*pow(z, 2) - 16*pow(M_PI, 2)*pow(x, 2)*z - 1)*cos(4*M_PI*x*z) - 0.25*M_PI*x*cos(4*M_PI*x*z) - (pow(M_PI, 2)*pow(x, 2)*z - pow(M_PI, 2)*pow(x, 2))*sin(4*M_PI*x*z), 2)/(pow(M_PI, 4)*pow(x, 6)), 4.0L/3.0L) - pow(2, 1.0L/3.0L)*(4.0*pow(M_PI, 2)*pow(x, 2)*(M_PI*x*z - M_PI*x)*cos(4*M_PI*x*z) + pow(M_PI, 2)*pow(x, 2)*(8*pow(M_PI, 2)*pow(x, 2)*pow(z, 2) - 16*pow(M_PI, 2)*pow(x, 2)*z - 1)*sin(4*M_PI*x*z) + pow(M_PI, 2)*pow(x, 2)*sin(4*M_PI*x*z) - 8.0*M_PI*x*(pow(M_PI, 2)*pow(x, 2)*z - pow(M_PI, 2)*pow(x, 2))*cos(4*M_PI*x*z))/(pow(M_PI, 2)*pow(x, 3)*pow(4.0*pow(M_PI, 2)*pow(z, 2)*pow(z - 2, 2)*pow(cos(4*M_PI*x*z), 2) + (1.0L/2.0L)*pow(2.0*M_PI*x*(z - 2)*cos(4*M_PI*x*z) - 0.0625*M_PI*(16*sin(4*M_PI*x)/(M_PI*pow(x, 2)) + 4*(8*pow(M_PI, 2)*pow(x, 2) + 1)*cos(4*M_PI*x)/(pow(M_PI, 2)*pow(x, 3)) + 4*(-4*M_PI*z*(M_PI*x*z - M_PI*x)*sin(4*M_PI*x*z) + M_PI*z*(8*pow(M_PI, 2)*pow(x, 2)*pow(z, 2) - 16*pow(M_PI, 2)*pow(x, 2)*z - 1)*cos(4*M_PI*x*z) - (-M_PI*z + M_PI)*cos(4*M_PI*x*z) + 4*(pow(M_PI, 2)*x*pow(z, 2) - 2*pow(M_PI, 2)*x*z)*sin(4*M_PI*x*z))/(pow(M_PI, 3)*pow(x, 3)) - 3*(8*pow(M_PI, 2)*pow(x, 2) + 1)*sin(4*M_PI*x)/(pow(M_PI, 3)*pow(x, 4)) - 3*(4*(M_PI*x*z - M_PI*x)*cos(4*M_PI*x*z) + (8*pow(M_PI, 2)*pow(x, 2)*pow(z, 2) - 16*pow(M_PI, 2)*pow(x, 2)*z - 1)*sin(4*M_PI*x*z))/(pow(M_PI, 3)*pow(x, 4))) + 0.5*sin(4*M_PI*x*z) + (2.0L/5.0L)*M_PI*cos(4*M_PI*x), 2) + pow(M_PI*x*(M_PI*x*z - M_PI*x)*sin(4*M_PI*x*z) - 0.25*M_PI*x*(8*pow(M_PI, 2)*pow(x, 2)*pow(z, 2) - 16*pow(M_PI, 2)*pow(x, 2)*z - 1)*cos(4*M_PI*x*z) - 0.25*M_PI*x*cos(4*M_PI*x*z) - (pow(M_PI, 2)*pow(x, 2)*z - pow(M_PI, 2)*pow(x, 2))*sin(4*M_PI*x*z), 2)/(pow(M_PI, 4)*pow(x, 6)), 1.0L/3.0L)) - 1.0L/15.0L*pow(2, 1.0L/3.0L)*(M_PI*x*(M_PI*x*z - M_PI*x)*sin(4*M_PI*x*z) - 0.25*M_PI*x*(8*pow(M_PI, 2)*pow(x, 2)*pow(z, 2) - 16*pow(M_PI, 2)*pow(x, 2)*z - 1)*cos(4*M_PI*x*z) - 0.25*M_PI*x*cos(4*M_PI*x*z) + (-1.0*pow(M_PI, 2)*pow(x, 2)*z + pow(M_PI, 2)*pow(x, 2))*sin(4*M_PI*x*z))*(160.0*pow(M_PI, 3)*x*pow(z, 2)*pow(z - 2, 2)*sin(4*M_PI*x*z)*cos(4*M_PI*x*z) - 40.0*pow(M_PI, 2)*pow(z, 2)*(z - 2)*pow(cos(4*M_PI*x*z), 2) - 40.0*pow(M_PI, 2)*z*pow(z - 2, 2)*pow(cos(4*M_PI*x*z), 2) + (-8.0*pow(M_PI, 2)*pow(x, 2)*(z - 2)*sin(4*M_PI*x*z) + 4.0*M_PI*x*cos(4*M_PI*x*z) + 0.25*M_PI*((16*pow(M_PI, 2)*x*z*(M_PI*x*z - M_PI*x)*cos(4*M_PI*x*z) + 4*pow(M_PI, 2)*x*z*(8*pow(M_PI, 2)*pow(x, 2)*pow(z, 2) - 16*pow(M_PI, 2)*pow(x, 2)*z - 1)*sin(4*M_PI*x*z) + 4*pow(M_PI, 2)*x*z*sin(4*M_PI*x*z) - 4*M_PI*x*(-M_PI*z + M_PI)*sin(4*M_PI*x*z) - 16*M_PI*x*(pow(M_PI, 2)*x*pow(z, 2) - 2*pow(M_PI, 2)*x*z)*cos(4*M_PI*x*z) - 16*M_PI*z*(pow(M_PI, 2)*pow(x, 2)*z - pow(M_PI, 2)*pow(x, 2))*cos(4*M_PI*x*z) + 4*M_PI*(M_PI*x*z - M_PI*x)*sin(4*M_PI*x*z) - 8*(pow(M_PI, 2)*x*z - pow(M_PI, 2)*x)*sin(4*M_PI*x*z) - M_PI*(8*pow(M_PI, 2)*pow(x, 2)*pow(z, 2) - 16*pow(M_PI, 2)*pow(x, 2)*z - 1)*cos(4*M_PI*x*z) - M_PI*cos(4*M_PI*x*z))/(pow(M_PI, 3)*pow(x, 3)) + 3*(-4*M_PI*x*(M_PI*x*z - M_PI*x)*sin(4*M_PI*x*z) + M_PI*x*(8*pow(M_PI, 2)*pow(x, 2)*pow(z, 2) - 16*pow(M_PI, 2)*pow(x, 2)*z - 1)*cos(4*M_PI*x*z) + M_PI*x*cos(4*M_PI*x*z) + 4*(pow(M_PI, 2)*pow(x, 2)*z - pow(M_PI, 2)*pow(x, 2))*sin(4*M_PI*x*z))/(pow(M_PI, 3)*pow(x, 4))))*(-10.0*M_PI*x*(z - 2)*cos(4*M_PI*x*z) + 0.3125*M_PI*(16*sin(4*M_PI*x)/(M_PI*pow(x, 2)) + 4*(8*pow(M_PI, 2)*pow(x, 2) + 1)*cos(4*M_PI*x)/(pow(M_PI, 2)*pow(x, 3)) + 4*(-4*M_PI*z*(M_PI*x*z - M_PI*x)*sin(4*M_PI*x*z) + M_PI*z*(8*pow(M_PI, 2)*pow(x, 2)*pow(z, 2) - 16*pow(M_PI, 2)*pow(x, 2)*z - 1)*cos(4*M_PI*x*z) - (-M_PI*z + M_PI)*cos(4*M_PI*x*z) + 4*(pow(M_PI, 2)*x*pow(z, 2) - 2*pow(M_PI, 2)*x*z)*sin(4*M_PI*x*z))/(pow(M_PI, 3)*pow(x, 3)) - 3*(8*pow(M_PI, 2)*pow(x, 2) + 1)*sin(4*M_PI*x)/(pow(M_PI, 3)*pow(x, 4)) - 3*(4*(M_PI*x*z - M_PI*x)*cos(4*M_PI*x*z) + (8*pow(M_PI, 2)*pow(x, 2)*pow(z, 2) - 16*pow(M_PI, 2)*pow(x, 2)*z - 1)*sin(4*M_PI*x*z))/(pow(M_PI, 3)*pow(x, 4))) - 2.5*sin(4*M_PI*x*z) - 2*M_PI*cos(4*M_PI*x)) - (10*M_PI*x*(M_PI*x*z - M_PI*x)*sin(4*M_PI*x*z) - 2.5*M_PI*x*(8*pow(M_PI, 2)*pow(x, 2)*pow(z, 2) - 16*pow(M_PI, 2)*pow(x, 2)*z - 1)*cos(4*M_PI*x*z) - 2.5*M_PI*x*cos(4*M_PI*x*z) - 10*(pow(M_PI, 2)*pow(x, 2)*z - pow(M_PI, 2)*pow(x, 2))*sin(4*M_PI*x*z))*(4*pow(M_PI, 2)*pow(x, 2)*(M_PI*x*z - M_PI*x)*cos(4*M_PI*x*z) + pow(M_PI, 2)*pow(x, 2)*(8*pow(M_PI, 2)*pow(x, 2)*pow(z, 2) - 16*pow(M_PI, 2)*pow(x, 2)*z - 1)*sin(4*M_PI*x*z) + pow(M_PI, 2)*pow(x, 2)*sin(4*M_PI*x*z) - 8.0*M_PI*x*(pow(M_PI, 2)*pow(x, 2)*z - pow(M_PI, 2)*pow(x, 2))*cos(4*M_PI*x*z))/(pow(M_PI, 4)*pow(x, 6)))/(pow(M_PI, 2)*pow(x, 3)*pow(4.0*pow(M_PI, 2)*pow(z, 2)*pow(z - 2, 2)*pow(cos(4*M_PI*x*z), 2) + (1.0L/2.0L)*pow(2.0*M_PI*x*(z - 2)*cos(4*M_PI*x*z) - 0.0625*M_PI*(16*sin(4*M_PI*x)/(M_PI*pow(x, 2)) + 4*(8*pow(M_PI, 2)*pow(x, 2) + 1)*cos(4*M_PI*x)/(pow(M_PI, 2)*pow(x, 3)) + 4*(-4*M_PI*z*(M_PI*x*z - M_PI*x)*sin(4*M_PI*x*z) + M_PI*z*(8*pow(M_PI, 2)*pow(x, 2)*pow(z, 2) - 16*pow(M_PI, 2)*pow(x, 2)*z - 1)*cos(4*M_PI*x*z) - (-M_PI*z + M_PI)*cos(4*M_PI*x*z) + 4*(pow(M_PI, 2)*x*pow(z, 2) - 2*pow(M_PI, 2)*x*z)*sin(4*M_PI*x*z))/(pow(M_PI, 3)*pow(x, 3)) - 3*(8*pow(M_PI, 2)*pow(x, 2) + 1)*sin(4*M_PI*x)/(pow(M_PI, 3)*pow(x, 4)) - 3*(4*(M_PI*x*z - M_PI*x)*cos(4*M_PI*x*z) + (8*pow(M_PI, 2)*pow(x, 2)*pow(z, 2) - 16*pow(M_PI, 2)*pow(x, 2)*z - 1)*sin(4*M_PI*x*z))/(pow(M_PI, 3)*pow(x, 4))) + 0.5*sin(4*M_PI*x*z) + (2.0L/5.0L)*M_PI*cos(4*M_PI*x), 2) + pow(M_PI*x*(M_PI*x*z - M_PI*x)*sin(4*M_PI*x*z) - 0.25*M_PI*x*(8*pow(M_PI, 2)*pow(x, 2)*pow(z, 2) - 16*pow(M_PI, 2)*pow(x, 2)*z - 1)*cos(4*M_PI*x*z) - 0.25*M_PI*x*cos(4*M_PI*x*z) - (pow(M_PI, 2)*pow(x, 2)*z - pow(M_PI, 2)*pow(x, 2))*sin(4*M_PI*x*z), 2)/(pow(M_PI, 4)*pow(x, 6)), 4.0L/3.0L));
+			return 4*PI*sin(4*PI*x)*cos(4*PI*z) + (1.0L/10.0L)*pow(2, 1.0L/3.0L)*(40.0*pow(PI, 2)*x*z*(z - 2)*sin(4*PI*x*z) - 10.0*PI*z*cos(4*PI*x*z) - 10.0*PI*(z - 2)*cos(4*PI*x*z) + 1.25*PI*(32*cos(4*PI*x)/pow(x, 2) - 4*(8*pow(PI, 2)*pow(x, 2) + 1)*sin(4*PI*x)/(PI*pow(x, 3)) - 4*(4*pow(PI, 2)*pow(z, 2)*(PI*x*z - PI*x)*cos(4*PI*x*z) + pow(PI, 2)*pow(z, 2)*(8*pow(PI, 2)*pow(x, 2)*pow(z, 2) - 16*pow(PI, 2)*pow(x, 2)*z - 1)*sin(4*PI*x*z) - 2*PI*z*(-PI*z + PI)*sin(4*PI*x*z) - 8*PI*z*(pow(PI, 2)*x*pow(z, 2) - 2*pow(PI, 2)*x*z)*cos(4*PI*x*z) - (pow(PI, 2)*pow(z, 2) - 2*pow(PI, 2)*z)*sin(4*PI*x*z))/(pow(PI, 3)*pow(x, 3)) - 20*sin(4*PI*x)/(PI*pow(x, 3)) - 6*(8*pow(PI, 2)*pow(x, 2) + 1)*cos(4*PI*x)/(pow(PI, 2)*pow(x, 4)) - 6*(-4*PI*z*(PI*x*z - PI*x)*sin(4*PI*x*z) + PI*z*(8*pow(PI, 2)*pow(x, 2)*pow(z, 2) - 16*pow(PI, 2)*pow(x, 2)*z - 1)*cos(4*PI*x*z) - (-PI*z + PI)*cos(4*PI*x*z) + 4*(pow(PI, 2)*x*pow(z, 2) - 2*pow(PI, 2)*x*z)*sin(4*PI*x*z))/(pow(PI, 3)*pow(x, 4)) + 3*(8*pow(PI, 2)*pow(x, 2) + 1)*sin(4*PI*x)/(pow(PI, 3)*pow(x, 5)) + 3*(4*(PI*x*z - PI*x)*cos(4*PI*x*z) + (8*pow(PI, 2)*pow(x, 2)*pow(z, 2) - 16*pow(PI, 2)*pow(x, 2)*z - 1)*sin(4*PI*x*z))/(pow(PI, 3)*pow(x, 5))) + 8*pow(PI, 2)*sin(4*PI*x))/pow(4.0*pow(PI, 2)*pow(z, 2)*pow(z - 2, 2)*pow(cos(4*PI*x*z), 2) + (1.0L/2.0L)*pow(2.0*PI*x*(z - 2)*cos(4*PI*x*z) - 0.0625*PI*(16*sin(4*PI*x)/(PI*pow(x, 2)) + 4*(8*pow(PI, 2)*pow(x, 2) + 1)*cos(4*PI*x)/(pow(PI, 2)*pow(x, 3)) + 4*(-4*PI*z*(PI*x*z - PI*x)*sin(4*PI*x*z) + PI*z*(8*pow(PI, 2)*pow(x, 2)*pow(z, 2) - 16*pow(PI, 2)*pow(x, 2)*z - 1)*cos(4*PI*x*z) - (-PI*z + PI)*cos(4*PI*x*z) + 4*(pow(PI, 2)*x*pow(z, 2) - 2*pow(PI, 2)*x*z)*sin(4*PI*x*z))/(pow(PI, 3)*pow(x, 3)) - 3*(8*pow(PI, 2)*pow(x, 2) + 1)*sin(4*PI*x)/(pow(PI, 3)*pow(x, 4)) - 3*(4*(PI*x*z - PI*x)*cos(4*PI*x*z) + (8*pow(PI, 2)*pow(x, 2)*pow(z, 2) - 16*pow(PI, 2)*pow(x, 2)*z - 1)*sin(4*PI*x*z))/(pow(PI, 3)*pow(x, 4))) + 0.5*sin(4*PI*x*z) + (2.0L/5.0L)*PI*cos(4*PI*x), 2) + pow(PI*x*(PI*x*z - PI*x)*sin(4*PI*x*z) - 0.25*PI*x*(8*pow(PI, 2)*pow(x, 2)*pow(z, 2) - 16*pow(PI, 2)*pow(x, 2)*z - 1)*cos(4*PI*x*z) - 0.25*PI*x*cos(4*PI*x*z) - (pow(PI, 2)*pow(x, 2)*z - pow(PI, 2)*pow(x, 2))*sin(4*PI*x*z), 2)/(pow(PI, 4)*pow(x, 6)), 1.0L/3.0L) + (1.0L/750.0L)*pow(2, 1.0L/3.0L)*(-10.0*PI*x*(z - 2)*cos(4*PI*x*z) + 0.3125*PI*(16*sin(4*PI*x)/(PI*pow(x, 2)) + 4*(8*pow(PI, 2)*pow(x, 2) + 1)*cos(4*PI*x)/(pow(PI, 2)*pow(x, 3)) + 4*(-4*PI*z*(PI*x*z - PI*x)*sin(4*PI*x*z) + PI*z*(8*pow(PI, 2)*pow(x, 2)*pow(z, 2) - 16*pow(PI, 2)*pow(x, 2)*z - 1)*cos(4*PI*x*z) - (-PI*z + PI)*cos(4*PI*x*z) + 4*(pow(PI, 2)*x*pow(z, 2) - 2*pow(PI, 2)*x*z)*sin(4*PI*x*z))/(pow(PI, 3)*pow(x, 3)) - 3*(8*pow(PI, 2)*pow(x, 2) + 1)*sin(4*PI*x)/(pow(PI, 3)*pow(x, 4)) - 3*(4*(PI*x*z - PI*x)*cos(4*PI*x*z) + (8*pow(PI, 2)*pow(x, 2)*pow(z, 2) - 16*pow(PI, 2)*pow(x, 2)*z - 1)*sin(4*PI*x*z))/(pow(PI, 3)*pow(x, 4))) - 2.5*sin(4*PI*x*z) - 2*PI*cos(4*PI*x))*(800.0*pow(PI, 3)*pow(z, 3)*pow(z - 2, 2)*sin(4*PI*x*z)*cos(4*PI*x*z) - (-10.0*PI*x*(z - 2)*cos(4*PI*x*z) + 0.3125*PI*(16*sin(4*PI*x)/(PI*pow(x, 2)) + 4*(8*pow(PI, 2)*pow(x, 2) + 1)*cos(4*PI*x)/(pow(PI, 2)*pow(x, 3)) + 4*(-4*PI*z*(PI*x*z - PI*x)*sin(4*PI*x*z) + PI*z*(8*pow(PI, 2)*pow(x, 2)*pow(z, 2) - 16*pow(PI, 2)*pow(x, 2)*z - 1)*cos(4*PI*x*z) - (-PI*z + PI)*cos(4*PI*x*z) + 4*(pow(PI, 2)*x*pow(z, 2) - 2*pow(PI, 2)*x*z)*sin(4*PI*x*z))/(pow(PI, 3)*pow(x, 3)) - 3*(8*pow(PI, 2)*pow(x, 2) + 1)*sin(4*PI*x)/(pow(PI, 3)*pow(x, 4)) - 3*(4*(PI*x*z - PI*x)*cos(4*PI*x*z) + (8*pow(PI, 2)*pow(x, 2)*pow(z, 2) - 16*pow(PI, 2)*pow(x, 2)*z - 1)*sin(4*PI*x*z))/(pow(PI, 3)*pow(x, 4))) - 2.5*sin(4*PI*x*z) - 2*PI*cos(4*PI*x))*(40.0*pow(PI, 2)*x*z*(z - 2)*sin(4*PI*x*z) - 10.0*PI*z*cos(4*PI*x*z) - 10.0*PI*(z - 2)*cos(4*PI*x*z) + 1.25*PI*(32*cos(4*PI*x)/pow(x, 2) - 4*(8*pow(PI, 2)*pow(x, 2) + 1)*sin(4*PI*x)/(PI*pow(x, 3)) - 4*(4*pow(PI, 2)*pow(z, 2)*(PI*x*z - PI*x)*cos(4*PI*x*z) + pow(PI, 2)*pow(z, 2)*(8*pow(PI, 2)*pow(x, 2)*pow(z, 2) - 16*pow(PI, 2)*pow(x, 2)*z - 1)*sin(4*PI*x*z) - 2*PI*z*(-PI*z + PI)*sin(4*PI*x*z) - 8*PI*z*(pow(PI, 2)*x*pow(z, 2) - 2*pow(PI, 2)*x*z)*cos(4*PI*x*z) - (pow(PI, 2)*pow(z, 2) - 2*pow(PI, 2)*z)*sin(4*PI*x*z))/(pow(PI, 3)*pow(x, 3)) - 20*sin(4*PI*x)/(PI*pow(x, 3)) - 6*(8*pow(PI, 2)*pow(x, 2) + 1)*cos(4*PI*x)/(pow(PI, 2)*pow(x, 4)) - 6*(-4*PI*z*(PI*x*z - PI*x)*sin(4*PI*x*z) + PI*z*(8*pow(PI, 2)*pow(x, 2)*pow(z, 2) - 16*pow(PI, 2)*pow(x, 2)*z - 1)*cos(4*PI*x*z) - (-PI*z + PI)*cos(4*PI*x*z) + 4*(pow(PI, 2)*x*pow(z, 2) - 2*pow(PI, 2)*x*z)*sin(4*PI*x*z))/(pow(PI, 3)*pow(x, 4)) + 3*(8*pow(PI, 2)*pow(x, 2) + 1)*sin(4*PI*x)/(pow(PI, 3)*pow(x, 5)) + 3*(4*(PI*x*z - PI*x)*cos(4*PI*x*z) + (8*pow(PI, 2)*pow(x, 2)*pow(z, 2) - 16*pow(PI, 2)*pow(x, 2)*z - 1)*sin(4*PI*x*z))/(pow(PI, 3)*pow(x, 5))) + 8*pow(PI, 2)*sin(4*PI*x)) - (50*PI*x*(PI*x*z - PI*x)*sin(4*PI*x*z) - 12.5*PI*x*(8*pow(PI, 2)*pow(x, 2)*pow(z, 2) - 16*pow(PI, 2)*pow(x, 2)*z - 1)*cos(4*PI*x*z) - 12.5*PI*x*cos(4*PI*x*z) - 50*(pow(PI, 2)*pow(x, 2)*z - pow(PI, 2)*pow(x, 2))*sin(4*PI*x*z))*(4*pow(PI, 2)*x*z*(PI*x*z - PI*x)*cos(4*PI*x*z) + pow(PI, 2)*x*z*(8*pow(PI, 2)*pow(x, 2)*pow(z, 2) - 16*pow(PI, 2)*pow(x, 2)*z - 1)*sin(4*PI*x*z) + pow(PI, 2)*x*z*sin(4*PI*x*z) - PI*x*(-PI*z + PI)*sin(4*PI*x*z) - 4.0*PI*x*(pow(PI, 2)*x*pow(z, 2) - 2*pow(PI, 2)*x*z)*cos(4*PI*x*z) - 4*PI*z*(pow(PI, 2)*pow(x, 2)*z - pow(PI, 2)*pow(x, 2))*cos(4*PI*x*z) + PI*(PI*x*z - PI*x)*sin(4*PI*x*z) - 2*(pow(PI, 2)*x*z - pow(PI, 2)*x)*sin(4*PI*x*z) - 0.25*PI*(8*pow(PI, 2)*pow(x, 2)*pow(z, 2) - 16*pow(PI, 2)*pow(x, 2)*z - 1)*cos(4*PI*x*z) - 0.25*PI*cos(4*PI*x*z))/(pow(PI, 4)*pow(x, 6)) + 150*pow(PI*x*(PI*x*z - PI*x)*sin(4*PI*x*z) - 0.25*PI*x*(8*pow(PI, 2)*pow(x, 2)*pow(z, 2) - 16*pow(PI, 2)*pow(x, 2)*z - 1)*cos(4*PI*x*z) - 0.25*PI*x*cos(4*PI*x*z) - (pow(PI, 2)*pow(x, 2)*z - pow(PI, 2)*pow(x, 2))*sin(4*PI*x*z), 2)/(pow(PI, 4)*pow(x, 7)))/pow(4.0*pow(PI, 2)*pow(z, 2)*pow(z - 2, 2)*pow(cos(4*PI*x*z), 2) + (1.0L/2.0L)*pow(2.0*PI*x*(z - 2)*cos(4*PI*x*z) - 0.0625*PI*(16*sin(4*PI*x)/(PI*pow(x, 2)) + 4*(8*pow(PI, 2)*pow(x, 2) + 1)*cos(4*PI*x)/(pow(PI, 2)*pow(x, 3)) + 4*(-4*PI*z*(PI*x*z - PI*x)*sin(4*PI*x*z) + PI*z*(8*pow(PI, 2)*pow(x, 2)*pow(z, 2) - 16*pow(PI, 2)*pow(x, 2)*z - 1)*cos(4*PI*x*z) - (-PI*z + PI)*cos(4*PI*x*z) + 4*(pow(PI, 2)*x*pow(z, 2) - 2*pow(PI, 2)*x*z)*sin(4*PI*x*z))/(pow(PI, 3)*pow(x, 3)) - 3*(8*pow(PI, 2)*pow(x, 2) + 1)*sin(4*PI*x)/(pow(PI, 3)*pow(x, 4)) - 3*(4*(PI*x*z - PI*x)*cos(4*PI*x*z) + (8*pow(PI, 2)*pow(x, 2)*pow(z, 2) - 16*pow(PI, 2)*pow(x, 2)*z - 1)*sin(4*PI*x*z))/(pow(PI, 3)*pow(x, 4))) + 0.5*sin(4*PI*x*z) + (2.0L/5.0L)*PI*cos(4*PI*x), 2) + pow(PI*x*(PI*x*z - PI*x)*sin(4*PI*x*z) - 0.25*PI*x*(8*pow(PI, 2)*pow(x, 2)*pow(z, 2) - 16*pow(PI, 2)*pow(x, 2)*z - 1)*cos(4*PI*x*z) - 0.25*PI*x*cos(4*PI*x*z) - (pow(PI, 2)*pow(x, 2)*z - pow(PI, 2)*pow(x, 2))*sin(4*PI*x*z), 2)/(pow(PI, 4)*pow(x, 6)), 4.0L/3.0L) - pow(2, 1.0L/3.0L)*(4.0*pow(PI, 2)*pow(x, 2)*(PI*x*z - PI*x)*cos(4*PI*x*z) + pow(PI, 2)*pow(x, 2)*(8*pow(PI, 2)*pow(x, 2)*pow(z, 2) - 16*pow(PI, 2)*pow(x, 2)*z - 1)*sin(4*PI*x*z) + pow(PI, 2)*pow(x, 2)*sin(4*PI*x*z) - 8.0*PI*x*(pow(PI, 2)*pow(x, 2)*z - pow(PI, 2)*pow(x, 2))*cos(4*PI*x*z))/(pow(PI, 2)*pow(x, 3)*pow(4.0*pow(PI, 2)*pow(z, 2)*pow(z - 2, 2)*pow(cos(4*PI*x*z), 2) + (1.0L/2.0L)*pow(2.0*PI*x*(z - 2)*cos(4*PI*x*z) - 0.0625*PI*(16*sin(4*PI*x)/(PI*pow(x, 2)) + 4*(8*pow(PI, 2)*pow(x, 2) + 1)*cos(4*PI*x)/(pow(PI, 2)*pow(x, 3)) + 4*(-4*PI*z*(PI*x*z - PI*x)*sin(4*PI*x*z) + PI*z*(8*pow(PI, 2)*pow(x, 2)*pow(z, 2) - 16*pow(PI, 2)*pow(x, 2)*z - 1)*cos(4*PI*x*z) - (-PI*z + PI)*cos(4*PI*x*z) + 4*(pow(PI, 2)*x*pow(z, 2) - 2*pow(PI, 2)*x*z)*sin(4*PI*x*z))/(pow(PI, 3)*pow(x, 3)) - 3*(8*pow(PI, 2)*pow(x, 2) + 1)*sin(4*PI*x)/(pow(PI, 3)*pow(x, 4)) - 3*(4*(PI*x*z - PI*x)*cos(4*PI*x*z) + (8*pow(PI, 2)*pow(x, 2)*pow(z, 2) - 16*pow(PI, 2)*pow(x, 2)*z - 1)*sin(4*PI*x*z))/(pow(PI, 3)*pow(x, 4))) + 0.5*sin(4*PI*x*z) + (2.0L/5.0L)*PI*cos(4*PI*x), 2) + pow(PI*x*(PI*x*z - PI*x)*sin(4*PI*x*z) - 0.25*PI*x*(8*pow(PI, 2)*pow(x, 2)*pow(z, 2) - 16*pow(PI, 2)*pow(x, 2)*z - 1)*cos(4*PI*x*z) - 0.25*PI*x*cos(4*PI*x*z) - (pow(PI, 2)*pow(x, 2)*z - pow(PI, 2)*pow(x, 2))*sin(4*PI*x*z), 2)/(pow(PI, 4)*pow(x, 6)), 1.0L/3.0L)) - 1.0L/15.0L*pow(2, 1.0L/3.0L)*(PI*x*(PI*x*z - PI*x)*sin(4*PI*x*z) - 0.25*PI*x*(8*pow(PI, 2)*pow(x, 2)*pow(z, 2) - 16*pow(PI, 2)*pow(x, 2)*z - 1)*cos(4*PI*x*z) - 0.25*PI*x*cos(4*PI*x*z) + (-1.0*pow(PI, 2)*pow(x, 2)*z + pow(PI, 2)*pow(x, 2))*sin(4*PI*x*z))*(160.0*pow(PI, 3)*x*pow(z, 2)*pow(z - 2, 2)*sin(4*PI*x*z)*cos(4*PI*x*z) - 40.0*pow(PI, 2)*pow(z, 2)*(z - 2)*pow(cos(4*PI*x*z), 2) - 40.0*pow(PI, 2)*z*pow(z - 2, 2)*pow(cos(4*PI*x*z), 2) + (-8.0*pow(PI, 2)*pow(x, 2)*(z - 2)*sin(4*PI*x*z) + 4.0*PI*x*cos(4*PI*x*z) + 0.25*PI*((16*pow(PI, 2)*x*z*(PI*x*z - PI*x)*cos(4*PI*x*z) + 4*pow(PI, 2)*x*z*(8*pow(PI, 2)*pow(x, 2)*pow(z, 2) - 16*pow(PI, 2)*pow(x, 2)*z - 1)*sin(4*PI*x*z) + 4*pow(PI, 2)*x*z*sin(4*PI*x*z) - 4*PI*x*(-PI*z + PI)*sin(4*PI*x*z) - 16*PI*x*(pow(PI, 2)*x*pow(z, 2) - 2*pow(PI, 2)*x*z)*cos(4*PI*x*z) - 16*PI*z*(pow(PI, 2)*pow(x, 2)*z - pow(PI, 2)*pow(x, 2))*cos(4*PI*x*z) + 4*PI*(PI*x*z - PI*x)*sin(4*PI*x*z) - 8*(pow(PI, 2)*x*z - pow(PI, 2)*x)*sin(4*PI*x*z) - PI*(8*pow(PI, 2)*pow(x, 2)*pow(z, 2) - 16*pow(PI, 2)*pow(x, 2)*z - 1)*cos(4*PI*x*z) - PI*cos(4*PI*x*z))/(pow(PI, 3)*pow(x, 3)) + 3*(-4*PI*x*(PI*x*z - PI*x)*sin(4*PI*x*z) + PI*x*(8*pow(PI, 2)*pow(x, 2)*pow(z, 2) - 16*pow(PI, 2)*pow(x, 2)*z - 1)*cos(4*PI*x*z) + PI*x*cos(4*PI*x*z) + 4*(pow(PI, 2)*pow(x, 2)*z - pow(PI, 2)*pow(x, 2))*sin(4*PI*x*z))/(pow(PI, 3)*pow(x, 4))))*(-10.0*PI*x*(z - 2)*cos(4*PI*x*z) + 0.3125*PI*(16*sin(4*PI*x)/(PI*pow(x, 2)) + 4*(8*pow(PI, 2)*pow(x, 2) + 1)*cos(4*PI*x)/(pow(PI, 2)*pow(x, 3)) + 4*(-4*PI*z*(PI*x*z - PI*x)*sin(4*PI*x*z) + PI*z*(8*pow(PI, 2)*pow(x, 2)*pow(z, 2) - 16*pow(PI, 2)*pow(x, 2)*z - 1)*cos(4*PI*x*z) - (-PI*z + PI)*cos(4*PI*x*z) + 4*(pow(PI, 2)*x*pow(z, 2) - 2*pow(PI, 2)*x*z)*sin(4*PI*x*z))/(pow(PI, 3)*pow(x, 3)) - 3*(8*pow(PI, 2)*pow(x, 2) + 1)*sin(4*PI*x)/(pow(PI, 3)*pow(x, 4)) - 3*(4*(PI*x*z - PI*x)*cos(4*PI*x*z) + (8*pow(PI, 2)*pow(x, 2)*pow(z, 2) - 16*pow(PI, 2)*pow(x, 2)*z - 1)*sin(4*PI*x*z))/(pow(PI, 3)*pow(x, 4))) - 2.5*sin(4*PI*x*z) - 2*PI*cos(4*PI*x)) - (10*PI*x*(PI*x*z - PI*x)*sin(4*PI*x*z) - 2.5*PI*x*(8*pow(PI, 2)*pow(x, 2)*pow(z, 2) - 16*pow(PI, 2)*pow(x, 2)*z - 1)*cos(4*PI*x*z) - 2.5*PI*x*cos(4*PI*x*z) - 10*(pow(PI, 2)*pow(x, 2)*z - pow(PI, 2)*pow(x, 2))*sin(4*PI*x*z))*(4*pow(PI, 2)*pow(x, 2)*(PI*x*z - PI*x)*cos(4*PI*x*z) + pow(PI, 2)*pow(x, 2)*(8*pow(PI, 2)*pow(x, 2)*pow(z, 2) - 16*pow(PI, 2)*pow(x, 2)*z - 1)*sin(4*PI*x*z) + pow(PI, 2)*pow(x, 2)*sin(4*PI*x*z) - 8.0*PI*x*(pow(PI, 2)*pow(x, 2)*z - pow(PI, 2)*pow(x, 2))*cos(4*PI*x*z))/(pow(PI, 4)*pow(x, 6)))/(pow(PI, 2)*pow(x, 3)*pow(4.0*pow(PI, 2)*pow(z, 2)*pow(z - 2, 2)*pow(cos(4*PI*x*z), 2) + (1.0L/2.0L)*pow(2.0*PI*x*(z - 2)*cos(4*PI*x*z) - 0.0625*PI*(16*sin(4*PI*x)/(PI*pow(x, 2)) + 4*(8*pow(PI, 2)*pow(x, 2) + 1)*cos(4*PI*x)/(pow(PI, 2)*pow(x, 3)) + 4*(-4*PI*z*(PI*x*z - PI*x)*sin(4*PI*x*z) + PI*z*(8*pow(PI, 2)*pow(x, 2)*pow(z, 2) - 16*pow(PI, 2)*pow(x, 2)*z - 1)*cos(4*PI*x*z) - (-PI*z + PI)*cos(4*PI*x*z) + 4*(pow(PI, 2)*x*pow(z, 2) - 2*pow(PI, 2)*x*z)*sin(4*PI*x*z))/(pow(PI, 3)*pow(x, 3)) - 3*(8*pow(PI, 2)*pow(x, 2) + 1)*sin(4*PI*x)/(pow(PI, 3)*pow(x, 4)) - 3*(4*(PI*x*z - PI*x)*cos(4*PI*x*z) + (8*pow(PI, 2)*pow(x, 2)*pow(z, 2) - 16*pow(PI, 2)*pow(x, 2)*z - 1)*sin(4*PI*x*z))/(pow(PI, 3)*pow(x, 4))) + 0.5*sin(4*PI*x*z) + (2.0L/5.0L)*PI*cos(4*PI*x), 2) + pow(PI*x*(PI*x*z - PI*x)*sin(4*PI*x*z) - 0.25*PI*x*(8*pow(PI, 2)*pow(x, 2)*pow(z, 2) - 16*pow(PI, 2)*pow(x, 2)*z - 1)*cos(4*PI*x*z) - 0.25*PI*x*cos(4*PI*x*z) - (pow(PI, 2)*pow(x, 2)*z - pow(PI, 2)*pow(x, 2))*sin(4*PI*x*z), 2)/(pow(PI, 4)*pow(x, 6)), 4.0L/3.0L));
+		case 15:
+			z=y;
+			return 54000000000000*pow(PI, 2)*sin(30*PI*x) + 6000000000000*pow(PI, 2)*sin(10*PI*x + (1.0L/5.0L)*PI) - 10000000;
 		case 21:
 			z=y;
 			return x + (4.0L/3.0L)*pow(2, 1.0L/3.0L)*(2*pow(z, 3)*(2*pow(x, 3) - 3*pow(x, 2) + x) - 3*pow(z, 2)*(2*pow(x, 3) - 3*pow(x, 2) + x) + z*(2*pow(x, 3) - 3*pow(x, 2) + x))*(4*(pow(x, 2)*z*(x - 1)*(z - 1)*(2*z - 1) + x*z*pow(x - 1, 2)*(z - 1)*(2*z - 1))*(2*pow(x, 2)*z*(x - 1)*(z - 1) + pow(x, 2)*z*(x - 1)*(2*z - 1) + pow(x, 2)*(x - 1)*(z - 1)*(2*z - 1) + 2*x*z*pow(x - 1, 2)*(z - 1) + x*z*pow(x - 1, 2)*(2*z - 1) + x*pow(x - 1, 2)*(z - 1)*(2*z - 1)) + 4*(2*pow(z, 3)*(2*pow(x, 3) - 3*pow(x, 2) + x) - 3*pow(z, 2)*(2*pow(x, 3) - 3*pow(x, 2) + x) + z*(2*pow(x, 3) - 3*pow(x, 2) + x))*(2*pow(x, 3) - 3*pow(x, 2) + x + 6*pow(z, 2)*(2*pow(x, 3) - 3*pow(x, 2) + x) - 6*z*(2*pow(x, 3) - 3*pow(x, 2) + x)) + (2*pow(x, 2)*z*pow(x - 1, 2) + 2*pow(x, 2)*pow(x - 1, 2)*(z - 1) + pow(x, 2)*pow(x - 1, 2)*(2*z - 1) - 2*pow(z, 3)*(6*pow(x, 2) - 6*x + 1) + 3*pow(z, 2)*(6*pow(x, 2) - 6*x + 1) - z*(6*pow(x, 2) - 6*x + 1))*(2*pow(x, 2)*z*pow(x - 1, 2)*(z - 1) + pow(x, 2)*z*pow(x - 1, 2)*(2*z - 1) + pow(x, 2)*pow(x - 1, 2)*(z - 1)*(2*z - 1) - pow(z, 4)*(6*pow(x, 2) - 6*x + 1) + 2*pow(z, 3)*(6*pow(x, 2) - 6*x + 1) - pow(z, 2)*(6*pow(x, 2) - 6*x + 1)))/pow(4*pow(pow(x, 2)*z*(x - 1)*(z - 1)*(2*z - 1) + x*z*pow(x - 1, 2)*(z - 1)*(2*z - 1), 2) + 4*pow(2*pow(z, 3)*(2*pow(x, 3) - 3*pow(x, 2) + x) - 3*pow(z, 2)*(2*pow(x, 3) - 3*pow(x, 2) + x) + z*(2*pow(x, 3) - 3*pow(x, 2) + x), 2) + (1.0L/2.0L)*pow(2*pow(x, 2)*z*pow(x - 1, 2)*(z - 1) + pow(x, 2)*z*pow(x - 1, 2)*(2*z - 1) + pow(x, 2)*pow(x - 1, 2)*(z - 1)*(2*z - 1) - pow(z, 4)*(6*pow(x, 2) - 6*x + 1) + 2*pow(z, 3)*(6*pow(x, 2) - 6*x + 1) - pow(z, 2)*(6*pow(x, 2) - 6*x + 1), 2), 4.0L/3.0L) - 1.0L/3.0L*pow(2, 1.0L/3.0L)*(4*(pow(x, 2)*z*(x - 1)*(z - 1)*(2*z - 1) + x*z*pow(x - 1, 2)*(z - 1)*(2*z - 1))*(pow(x, 2)*z*(z - 1)*(2*z - 1) + 4*x*z*(x - 1)*(z - 1)*(2*z - 1) + z*pow(x - 1, 2)*(z - 1)*(2*z - 1)) + 4*(2*pow(z, 3)*(6*pow(x, 2) - 6*x + 1) - 3*pow(z, 2)*(6*pow(x, 2) - 6*x + 1) + z*(6*pow(x, 2) - 6*x + 1))*(2*pow(z, 3)*(2*pow(x, 3) - 3*pow(x, 2) + x) - 3*pow(z, 2)*(2*pow(x, 3) - 3*pow(x, 2) + x) + z*(2*pow(x, 3) - 3*pow(x, 2) + x)) + (2*pow(x, 2)*z*pow(x - 1, 2)*(z - 1) + pow(x, 2)*z*pow(x - 1, 2)*(2*z - 1) + pow(x, 2)*pow(x - 1, 2)*(z - 1)*(2*z - 1) - pow(z, 4)*(6*pow(x, 2) - 6*x + 1) + 2*pow(z, 3)*(6*pow(x, 2) - 6*x + 1) - pow(z, 2)*(6*pow(x, 2) - 6*x + 1))*(2*pow(x, 2)*z*(x - 1)*(z - 1) + pow(x, 2)*z*(x - 1)*(2*z - 1) + pow(x, 2)*(x - 1)*(z - 1)*(2*z - 1) + 2*x*z*pow(x - 1, 2)*(z - 1) + x*z*pow(x - 1, 2)*(2*z - 1) + x*pow(x - 1, 2)*(z - 1)*(2*z - 1) - 3*pow(z, 4)*(2*x - 1) + 6*pow(z, 3)*(2*x - 1) - 3*pow(z, 2)*(2*x - 1)))*(2*pow(x, 2)*z*pow(x - 1, 2)*(z - 1) + pow(x, 2)*z*pow(x - 1, 2)*(2*z - 1) + pow(x, 2)*pow(x - 1, 2)*(z - 1)*(2*z - 1) - pow(z, 4)*(6*pow(x, 2) - 6*x + 1) + 2*pow(z, 3)*(6*pow(x, 2) - 6*x + 1) - pow(z, 2)*(6*pow(x, 2) - 6*x + 1))/pow(4*pow(pow(x, 2)*z*(x - 1)*(z - 1)*(2*z - 1) + x*z*pow(x - 1, 2)*(z - 1)*(2*z - 1), 2) + 4*pow(2*pow(z, 3)*(2*pow(x, 3) - 3*pow(x, 2) + x) - 3*pow(z, 2)*(2*pow(x, 3) - 3*pow(x, 2) + x) + z*(2*pow(x, 3) - 3*pow(x, 2) + x), 2) + (1.0L/2.0L)*pow(2*pow(x, 2)*z*pow(x - 1, 2)*(z - 1) + pow(x, 2)*z*pow(x - 1, 2)*(2*z - 1) + pow(x, 2)*pow(x - 1, 2)*(z - 1)*(2*z - 1) - pow(z, 4)*(6*pow(x, 2) - 6*x + 1) + 2*pow(z, 3)*(6*pow(x, 2) - 6*x + 1) - pow(z, 2)*(6*pow(x, 2) - 6*x + 1), 2), 4.0L/3.0L) - 0.5 - 2*pow(2, 1.0L/3.0L)*(2*pow(x, 3) - 3*pow(x, 2) + x + 6*pow(z, 2)*(2*pow(x, 3) - 3*pow(x, 2) + x) - 6*z*(2*pow(x, 3) - 3*pow(x, 2) + x))/pow(4*pow(pow(x, 2)*z*(x - 1)*(z - 1)*(2*z - 1) + x*z*pow(x - 1, 2)*(z - 1)*(2*z - 1), 2) + 4*pow(2*pow(z, 3)*(2*pow(x, 3) - 3*pow(x, 2) + x) - 3*pow(z, 2)*(2*pow(x, 3) - 3*pow(x, 2) + x) + z*(2*pow(x, 3) - 3*pow(x, 2) + x), 2) + (1.0L/2.0L)*pow(2*pow(x, 2)*z*pow(x - 1, 2)*(z - 1) + pow(x, 2)*z*pow(x - 1, 2)*(2*z - 1) + pow(x, 2)*pow(x - 1, 2)*(z - 1)*(2*z - 1) - pow(z, 4)*(6*pow(x, 2) - 6*x + 1) + 2*pow(z, 3)*(6*pow(x, 2) - 6*x + 1) - pow(z, 2)*(6*pow(x, 2) - 6*x + 1), 2), 1.0L/3.0L) + pow(2, 1.0L/3.0L)*(2*pow(x, 2)*z*(x - 1)*(z - 1) + pow(x, 2)*z*(x - 1)*(2*z - 1) + pow(x, 2)*(x - 1)*(z - 1)*(2*z - 1) + 2*x*z*pow(x - 1, 2)*(z - 1) + x*z*pow(x - 1, 2)*(2*z - 1) + x*pow(x - 1, 2)*(z - 1)*(2*z - 1) - 3*pow(z, 4)*(2*x - 1) + 6*pow(z, 3)*(2*x - 1) - 3*pow(z, 2)*(2*x - 1))/pow(4*pow(pow(x, 2)*z*(x - 1)*(z - 1)*(2*z - 1) + x*z*pow(x - 1, 2)*(z - 1)*(2*z - 1), 2) + 4*pow(2*pow(z, 3)*(2*pow(x, 3) - 3*pow(x, 2) + x) - 3*pow(z, 2)*(2*pow(x, 3) - 3*pow(x, 2) + x) + z*(2*pow(x, 3) - 3*pow(x, 2) + x), 2) + (1.0L/2.0L)*pow(2*pow(x, 2)*z*pow(x - 1, 2)*(z - 1) + pow(x, 2)*z*pow(x - 1, 2)*(2*z - 1) + pow(x, 2)*pow(x - 1, 2)*(z - 1)*(2*z - 1) - pow(z, 4)*(6*pow(x, 2) - 6*x + 1) + 2*pow(z, 3)*(6*pow(x, 2) - 6*x + 1) - pow(z, 2)*(6*pow(x, 2) - 6*x + 1), 2), 1.0L/3.0L);
@@ -135,7 +141,7 @@
 	IssmDouble a = 1.0;
 
 	switch(testid){
-		case 1: case 2: case 7: case 8: case 11:  case 12: case 13: case 14: case 18: case 21: case 22:
+		case 1: case 2: case 7: case 8: case 11:  case 12: case 13: case 14: case 15: case 18: case 21: case 22:
 			return 0.;
 		case 3: 
 			return 2*pow(x, 2)*y*z*(x - 1)*(y - 1)*(2*y - 1) + 2*pow(x, 2)*y*(x - 1)*(y - 1)*(2*y - 1)*(z - 1) - 2*x*pow(y, 2)*z*(x - 1)*(2*x - 1)*(y - 1) - 2*x*pow(y, 2)*(x - 1)*(2*x - 1)*(y - 1)*(z - 1) + 2*x*y*z*pow(x - 1, 2)*(y - 1)*(2*y - 1) - 2*x*y*z*(x - 1)*(2*x - 1)*pow(y - 1, 2) + 2*x*y*pow(x - 1, 2)*(y - 1)*(2*y - 1)*(z - 1) - 2*x*y*(x - 1)*(2*x - 1)*pow(y - 1, 2)*(z - 1);
@@ -163,6 +169,8 @@
 	switch(testid){
 		case 1: case 2: case 3: case 4: case 5: case 6: case 7: case 8: case 9: case 10: case 11: case 12: case 13: case 14: case 21: case 22:
 			return 0.;
+		case 15:
+			return 1.e+5;
 		case 18:
 			return (120.0L/109.0L)*sqrt(109.)/(10*x - 3*z);
 		default:

Modified: issm/trunk/src/c/shared/Matrix/MatrixUtils.cpp
===================================================================
--- issm/trunk/src/c/shared/Matrix/MatrixUtils.cpp	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/shared/Matrix/MatrixUtils.cpp	2016-04-13 04:32:01 UTC (rev 20500)
@@ -8,10 +8,13 @@
 #include <sys/types.h>
 #include <math.h>
 #include <float.h>    /*  DBL_EPSILON  */
+#include <cstdarg>
+#include <iostream>
 
 #include "./matrix.h"
 #include "../Exceptions/exceptions.h"
 #include "../MemOps/MemOps.h"
+#include "../io/io.h"
 /*}}}*/
 
 int TripleMultiply(IssmDouble* a, int nrowa, int ncola, int itrna, IssmDouble* b, int nrowb, int ncolb, int itrnb, IssmDouble* c, int nrowc, int ncolc, int itrnc, IssmDouble* d, int iaddd){/*{{{*/
@@ -556,3 +559,99 @@
 	Matrix4x4Invert(&Ainv[0][0],A);
 	for(int i=0;i<4;i++) X[i]=Ainv[i][0]*B[0] + Ainv[i][1]*B[1] + Ainv[i][2]*B[2] + Ainv[i][3]*B[3];
 }/*}}}*/
+
+void newcell(IssmDouble** pcell, IssmDouble newvalue, bool top, int m){  /*{{{*/
+
+	IssmDouble* cell=NULL;
+	IssmDouble* dummy=NULL;
+
+	/*recover pointer: */
+	cell=*pcell;
+
+	/*reallocate:*/
+	dummy=xNew<IssmDouble>(m+1); 
+
+	/*copy data:*/
+	for(int i=0;i<m;i++)dummy[i+1]=cell[i];
+
+	/*top or bottom layer:*/
+	if(top) dummy[0]=newvalue;
+	else dummy[m]=newvalue;
+	
+	/*delete and reassign: */
+	xDelete<IssmDouble>(cell); cell=dummy;
+
+	/*assign output pointer:*/
+	*pcell=cell;
+} /*}}}*/
+IssmDouble  cellsum(IssmDouble* cell, int m){ /*{{{*/
+
+	IssmDouble sum=0;
+
+	for(int i=0;i<m;i++)sum+=cell[i];
+
+	return sum;
+} /*}}}*/
+void celldelete(IssmDouble** pcell, int m, int* indices, int nind){ /*{{{*/
+
+	/*input: */
+	IssmDouble* cell=*pcell;
+	
+	/*output: */
+	IssmDouble* newcell=xNew<IssmDouble>(nind);
+
+	for(int i=0;i<nind;i++){
+		newcell[i]=cell[indices[i]];
+	}
+	
+	/*free allocation:*/
+	xDelete<IssmDouble>(cell);
+
+	/*assign output pointers: */
+	*pcell=newcell;
+} /*}}}*/
+void cellsplit(IssmDouble** pcell, int m, int i,IssmDouble scale) { /*{{{*/
+
+	/*input: */
+	IssmDouble* cell=*pcell;
+	
+	/*output: */
+	IssmDouble* newcell=xNew<IssmDouble>(m+1);
+
+	for(int j=0;j<i;j++)newcell[j]=cell[j]; 
+	newcell[i]=scale*cell[i];
+	newcell[i+1]=scale* cell[i];
+	for(int j=i+2;j<m+1;j++)newcell[j]=cell[j-1];
+	
+	/*free allocation:*/
+	xDelete<IssmDouble>(cell);
+
+	/*assign output pointers: */
+	*pcell=newcell;
+} /*}}}*/
+void cellecho(int numcells, int m, ...) { /*{{{*/
+
+	va_list arguments;                     
+	IssmDouble** celllist= NULL;
+
+	/*allocate variable length array: */
+	celllist=xNew<IssmDouble*>(numcells); 
+
+	va_start(arguments,m);
+
+	for ( int x = 0; x < numcells; x++ ){
+		celllist[x]= va_arg ( arguments, IssmDouble*); 
+	}
+	va_end ( arguments );                  
+	
+	_printf_("Echo of cell: \n");
+	for(int i=0;i<m;i++){
+		_printf_(i << ": ");
+		for (int j=0;j<numcells;j++)_printf_(setprecision(10) << celllist[j][i] << " ");
+		_printf_("\n");
+	}
+
+	/*deallocate:*/
+	xDelete<IssmDouble*>(celllist);
+
+} /*}}}*/

Modified: issm/trunk/src/c/shared/Matrix/matrix.h
===================================================================
--- issm/trunk/src/c/shared/Matrix/matrix.h	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/shared/Matrix/matrix.h	2016-04-13 04:32:01 UTC (rev 20500)
@@ -24,5 +24,10 @@
 void Matrix4x4Invert(IssmDouble* Ainv, IssmDouble* A);
 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);
+void celldelete(IssmDouble** pcell, int m, int* indices, int nind);
+void cellsplit(IssmDouble** pcell, int m, int i,IssmDouble scale);
+void cellecho(int numcells, int m, ...);
 #endif //ifndef _MATRIXUTILS_H_

Modified: issm/trunk/src/c/shared/Numerics/Verbosity.cpp
===================================================================
--- issm/trunk/src/c/shared/Numerics/Verbosity.cpp	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/shared/Numerics/Verbosity.cpp	2016-04-13 04:32:01 UTC (rev 20500)
@@ -27,6 +27,7 @@
 bool VerboseControl(void){return (GetVerbosityLevel() & 32);} /* 2^5*/
 bool VerboseQmu(void){return (GetVerbosityLevel() & 64);} /* 2^6*/
 bool VerboseAutodiff(void){return (GetVerbosityLevel() & 128);} /* 2^7*/
+bool VerboseSmb(void){return (GetVerbosityLevel() & 256);} /* 2^8*/
 
 /*Verbosity Setup*/
 static int verbositylevel=-1;

Modified: issm/trunk/src/c/shared/Numerics/Verbosity.h
===================================================================
--- issm/trunk/src/c/shared/Numerics/Verbosity.h	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/shared/Numerics/Verbosity.h	2016-04-13 04:32:01 UTC (rev 20500)
@@ -14,6 +14,7 @@
 bool VerboseControl(void);
 bool VerboseQmu(void);
 bool VerboseAutodiff(void);
+bool VerboseSmb(void);
 
 /*Setup Verbosity level*/
 void SetVerbosityLevel(int level);

Modified: issm/trunk/src/c/shared/Numerics/constants.h
===================================================================
--- issm/trunk/src/c/shared/Numerics/constants.h	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/shared/Numerics/constants.h	2016-04-13 04:32:01 UTC (rev 20500)
@@ -16,26 +16,21 @@
 #define NDOF3 3
 #define NDOF4 4
 
-#define DIM2 2
-#define DIM3 3
+// /*Windows specific typefefs: */
+// #ifdef _INTEL_WIN_
+// 
+// #ifndef NAN
+// //For reference, for Intel compile on win64
+// //#define NAN 0.0/0.0 
+// #define NAN (INFINITY-INFINITY)
+// #endif
+// 
+// #ifndef INFINITY
+// //For reference, for Intel compile on win64
+// //#define INFINITY 1.0/0.0
+// #define INFINITY (DBL_MAX+DBL_MAX)
+// #endif
+// 
+// #endif /*_INTEL_WIN_*/
 
-/*Windows specific typefefs: */
-#ifdef _INTEL_WIN_
-
-/*Complicated way, which does not handle INFINITY though: */
-/*#ifndef NAN
-	static const unsigned long __nan[2] = {0xffffffff, 0x7fffffff};
-	#define NAN (*(const float *) __nan)
-#endif*/
-
-//For reference, for Intel compile on win64
-//#define NAN 0.0/0.0 
-//#define INFINITY 1.0/0.0
-
-//Most generic way it would seem:
-#define INFINITY (DBL_MAX+DBL_MAX)
-#define NAN (INFINITY-INFINITY)
-
-#endif
-
-#endif //ifndef _ISSMTYPEDEFS_H_
+#endif /*_ISSM_CONSTANTS_H_*/

Modified: issm/trunk/src/c/shared/Numerics/isnan.h
===================================================================
--- issm/trunk/src/c/shared/Numerics/isnan.h	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/shared/Numerics/isnan.h	2016-04-13 04:32:01 UTC (rev 20500)
@@ -12,13 +12,13 @@
 #endif
 
 /*If include cmath instead of math, isnan on linux64 murdo does not work: */
-#include <math.h>
+#include <cmath>
 
 template <class T> int xIsNan(const T& X) {
 #ifdef _INTEL_WIN_
 		return (X!=X)?1:0;
 #else
-		return isnan(X);
+		return std::isnan(X);
 #endif
 }
 

Modified: issm/trunk/src/c/shared/Numerics/numerics.h
===================================================================
--- issm/trunk/src/c/shared/Numerics/numerics.h	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/shared/Numerics/numerics.h	2016-04-13 04:32:01 UTC (rev 20500)
@@ -33,6 +33,8 @@
 void        cross(IssmDouble *result,IssmDouble*vector1,IssmDouble*vector2);
 void        XZvectorsToCoordinateSystem(IssmDouble *T,IssmDouble*xzvectors);
 int         cubic(IssmDouble a, IssmDouble b, IssmDouble c, IssmDouble d,IssmDouble X[3], int *num);
+IssmDouble  legendre(IssmDouble Pn1, IssmDouble Pn2, IssmDouble x, int n);
+IssmDouble*  p_polynomial_value ( int m, int n, IssmDouble* x);
 
 int         NewtonSolveDnorm(IssmDouble* pdnorm,IssmDouble c1,IssmDouble c2,IssmDouble c3,IssmDouble n,IssmDouble dnorm);
 

Modified: issm/trunk/src/c/shared/io/Disk/diskio.h
===================================================================
--- issm/trunk/src/c/shared/io/Disk/diskio.h	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/shared/io/Disk/diskio.h	2016-04-13 04:32:01 UTC (rev 20500)
@@ -7,7 +7,7 @@
 
 #include <stdio.h>
 
-FILE* pfopen(char* filename,const char* format);
+FILE* pfopen(char* filename,const char* format,bool errorout=true);
 FILE* pfopen0(char* filename,const char* format);
 void  pfclose(FILE* fid,char* filename);
 void WriteLockFile(char* filename);

Modified: issm/trunk/src/c/shared/io/Disk/pfopen.cpp
===================================================================
--- issm/trunk/src/c/shared/io/Disk/pfopen.cpp	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/shared/io/Disk/pfopen.cpp	2016-04-13 04:32:01 UTC (rev 20500)
@@ -23,11 +23,11 @@
 
 	/*Open handle to data on disk*/
 	fid = fopen(filename,format);
-	if(fid==NULL) _error_("could not open file " << filename << " for binary reading or writing");
+	if(fid==NULL)_error_("could not open file " << filename << " for binary reading or writing");
 
 	return fid;
 }
-FILE* pfopen(char* filename,const char* format){
+FILE* pfopen(char* filename,const char* format,bool errorout){
 
 	FILE* fid=NULL;
 
@@ -40,7 +40,7 @@
 		if(my_rank==i) fid = fopen(filename,format);
 		ISSM_MPI_Barrier(IssmComm::GetComm());
 	}
-	if(fid==NULL) _error_("could not open file " << filename << " for binary reading or writing");
+	if(errorout && fid==NULL)_error_("could not open file " << filename << " for binary reading or writing");
 
 	return fid;
 }

Modified: issm/trunk/src/c/shared/io/io.h
===================================================================
--- issm/trunk/src/c/shared/io/io.h	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/shared/io/io.h	2016-04-13 04:32:01 UTC (rev 20500)
@@ -11,8 +11,9 @@
 #error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
 #endif 
 
+#include "./Comm/IssmComm.h"
 #include "./Disk/diskio.h"
 #include "./Print/Print.h"
-#include "./Comm/IssmComm.h"
+#include "./Marshalling/Marshalling.h"
 
 #endif	/* _IO_H_ */

Modified: issm/trunk/src/c/solutionsequences/solutionsequence_fct.cpp
===================================================================
--- issm/trunk/src/c/solutionsequences/solutionsequence_fct.cpp	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/solutionsequences/solutionsequence_fct.cpp	2016-04-13 04:32:01 UTC (rev 20500)
@@ -1,11 +1,12 @@
-/*!\file: solutionsequence_linear.cpp
- * \brief: numerical core of linear solutions
+/*!\file: solutionsequence_fct.cpp
+ * \brief: numerical core of flux corrected transport solution
  */ 
 
 #include "../toolkits/toolkits.h"
 #include "../classes/classes.h"
 #include "../shared/shared.h"
 #include "../modules/modules.h"
+#include "../analyses/analyses.h"
 
 #ifdef _HAVE_PETSC_
 void CreateDMatrix(Mat* pD,Mat K){/*{{{*/
@@ -118,7 +119,7 @@
 	*pLHS  = LHS;
 }/*}}}*/
 void CreateRHS(Vec* pRHS,Mat K,Mat D,Vec Ml,Vec u,IssmDouble theta,IssmDouble deltat,IssmDouble dmax,FemModel* femmodel,int configuration_type){/*{{{*/
-	/*Create Left Hand side of Lower order solution
+	/*Create Right Hand side of Lower order solution
 	 *
 	 * RHS = [ML + (1 − theta) deltaT L^n] u^n
 	 *
@@ -165,7 +166,7 @@
 
 }/*}}}*/
 void RichardsonUdot(Vec* pudot,Vec u,Vec Ml,Mat K,Mat Mc){/*{{{*/
-	/*Use Richardson's formulato get udot using 5 steps and an initial guess of 0
+	/*Use Richardson's formula to get udot using 5 steps and an initial guess of 0
 	 *
 	 * udot_new = udot_old + Ml^-1 (K^(n+1) u - Mc udot_old)
 	 *
@@ -335,31 +336,44 @@
 	VecFree(&temp1);
 }/*}}}*/
 #endif
-void solutionsequence_fct(FemModel* femmodel){
+void solutionsequence_fct(FemModel* femmodel){/*{{{*/
 
 	/*intermediary: */
 	IssmDouble           theta,deltat,dmax;
-	int                  configuration_type;
+	int                  configuration_type,analysis_type;
 	Vector<IssmDouble>*  Ml = NULL;
 	Matrix<IssmDouble>*  K  = NULL;
 	Matrix<IssmDouble>*  Mc = NULL;
 	Vector<IssmDouble>*  ug = NULL;
 	Vector<IssmDouble>*  uf = NULL;
+	MasstransportAnalysis* manalysis = NULL;
+	DamageEvolutionAnalysis* danalysis = NULL;
 
-	/*Create analysis*/
-	MasstransportAnalysis* analysis = new MasstransportAnalysis();
-
 	/*Recover parameters: */
 	femmodel->parameters->FindParam(&deltat,TimesteppingTimeStepEnum);
 	femmodel->parameters->FindParam(&configuration_type,ConfigurationTypeEnum);
 	femmodel->UpdateConstraintsx();
 	theta = 0.5;
 
-	/*Create lumped mass matrix*/
-	analysis->LumpedMassMatrix(&Ml,femmodel);
-	analysis->MassMatrix(&Mc,femmodel);
-	analysis->FctKMatrix(&K,NULL,femmodel);
-	delete analysis;
+	/*Create analysis*/
+	femmodel->parameters->FindParam(&analysis_type,AnalysisTypeEnum);
+	switch(analysis_type){
+		case MasstransportAnalysisEnum:
+			manalysis = new MasstransportAnalysis();
+			manalysis->LumpedMassMatrix(&Ml,femmodel);
+			manalysis->MassMatrix(&Mc,femmodel);
+			manalysis->FctKMatrix(&K,NULL,femmodel);
+			break;
+		case DamageEvolutionAnalysisEnum:
+			danalysis = new DamageEvolutionAnalysis();
+			danalysis->LumpedMassMatrix(&Ml,femmodel);
+			danalysis->MassMatrix(&Mc,femmodel);
+			danalysis->FctKMatrix(&K,NULL,femmodel);
+			break;
+		default: _error_("analysis type " << EnumToStringx(analysis_type) << " not supported for FCT\n");
+	}
+	delete manalysis;
+	delete danalysis;
 
 	#ifdef _HAVE_PETSC_
 
@@ -441,4 +455,4 @@
 	#else
 	_error_("PETSc needs to be installed");
 	#endif
-}
+}/*}}}*/

Modified: issm/trunk/src/c/solutionsequences/solutionsequence_hydro_nonlinear.cpp
===================================================================
--- issm/trunk/src/c/solutionsequences/solutionsequence_hydro_nonlinear.cpp	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/solutionsequences/solutionsequence_hydro_nonlinear.cpp	2016-04-13 04:32:01 UTC (rev 20500)
@@ -214,8 +214,8 @@
 					_error_("   maximum number of EPL iterations (" << hydro_maxiter << ") exceeded");
 				}
 				//If there is some colapse go through sediment again
-				if(ThickCount<L2Count)eplconverged=true;
-				eplcount++;
+				/* if(ThickCount<L2Count)eplconverged=true; */
+				/* eplcount++; */
 				
 				delete ug_epl_sub_iter;
 				if(eplconverged){

Modified: issm/trunk/src/c/solutionsequences/solutionsequence_newton.cpp
===================================================================
--- issm/trunk/src/c/solutionsequences/solutionsequence_newton.cpp	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/solutionsequences/solutionsequence_newton.cpp	2016-04-13 04:32:01 UTC (rev 20500)
@@ -89,20 +89,10 @@
 		convergence(&converged,Kff,pf,uf,old_uf,eps_res,eps_rel,eps_abs); 
 		delete Kff; delete pf;
 		if(converged==true){	
-			int step; IssmDouble time;
-			bool max_iteration_state=false;
-			femmodel->parameters->FindParam(&time,TimeEnum);
-			femmodel->parameters->FindParam(&step,StepEnum);
-			femmodel->results->AddObject(new GenericExternalResult<bool>(femmodel->results->Size()+1, MaxIterationConvergenceFlagEnum, max_iteration_state, step,time));
 			break;
 		}
 		if(count>=max_nonlinear_iterations){
 			_printf0_("   maximum number of Newton iterations (" << max_nonlinear_iterations << ") exceeded\n"); 
-			int step; IssmDouble time;
-			bool max_iteration_state=true;
-			femmodel->parameters->FindParam(&time,TimeEnum);
-			femmodel->parameters->FindParam(&step,StepEnum);
-			femmodel->results->AddObject(new GenericExternalResult<bool>(femmodel->results->Size()+1, MaxIterationConvergenceFlagEnum, max_iteration_state, step, time));
 			break;
 		}
 

Modified: issm/trunk/src/c/solutionsequences/solutionsequence_nonlinear.cpp
===================================================================
--- issm/trunk/src/c/solutionsequences/solutionsequence_nonlinear.cpp	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/solutionsequences/solutionsequence_nonlinear.cpp	2016-04-13 04:32:01 UTC (rev 20500)
@@ -32,7 +32,6 @@
 	int configuration_type;
 	IssmDouble eps_res,eps_rel,eps_abs;
 
-
 	/*Recover parameters: */
 	femmodel->parameters->FindParam(&min_mechanical_constraints,StressbalanceRiftPenaltyThresholdEnum);
 	femmodel->parameters->FindParam(&max_nonlinear_iterations,StressbalanceMaxiterEnum);
@@ -88,11 +87,6 @@
 		/*Increase count: */
 		count++;
 		if(converged==true){
-			bool max_iteration_state=false;
-			int step; IssmDouble time;
-			femmodel->parameters->FindParam(&time,TimeEnum);
-			femmodel->parameters->FindParam(&step,StepEnum);
-			femmodel->results->AddObject(new GenericExternalResult<bool>(femmodel->results->Size()+1, MaxIterationConvergenceFlagEnum, max_iteration_state, step, time));
 			break;
 		}
 		if(count>=max_nonlinear_iterations){
@@ -100,11 +94,6 @@
 			converged=true;
 			InputUpdateFromConstantx(femmodel,converged,ConvergedEnum);
 			InputUpdateFromSolutionx(femmodel,ug);		
-			bool max_iteration_state=true;
-			int step; IssmDouble time;
-			femmodel->parameters->FindParam(&time,TimeEnum);
-			femmodel->parameters->FindParam(&step,StepEnum);
-			femmodel->results->AddObject(new GenericExternalResult<bool>(femmodel->results->Size()+1, MaxIterationConvergenceFlagEnum, max_iteration_state, step, time));
 			break;
 		}
 	}

Modified: issm/trunk/src/c/solutionsequences/solutionsequence_thermal_nonlinear.cpp
===================================================================
--- issm/trunk/src/c/solutionsequences/solutionsequence_thermal_nonlinear.cpp	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/solutionsequences/solutionsequence_thermal_nonlinear.cpp	2016-04-13 04:32:01 UTC (rev 20500)
@@ -101,10 +101,6 @@
 				max_iteration_state=true;
 			}
 			if(converged==true){
-				int step; IssmDouble time;
-				femmodel->parameters->FindParam(&time,TimeEnum);
-				femmodel->parameters->FindParam(&step,StepEnum);
-				femmodel->results->AddObject(new GenericExternalResult<bool>(femmodel->results->Size()+1, MaxIterationConvergenceFlagEnum, max_iteration_state, step, time));
 				break;
 			}
 			else if(dt==0.){

Modified: issm/trunk/src/c/toolkits/gsl/DenseGslSolve.cpp
===================================================================
--- issm/trunk/src/c/toolkits/gsl/DenseGslSolve.cpp	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/toolkits/gsl/DenseGslSolve.cpp	2016-04-13 04:32:01 UTC (rev 20500)
@@ -231,16 +231,12 @@
         IssmDouble*  adoubleEDFin=xNew<IssmDouble>(n*(n+1));  // packed inputs, i.e. matrix and right hand side
         for(int i=0; i<n*n;i++)adoubleEDFin[i]    =A[i];      // pack matrix
         for(int i=0; i<n;  i++)adoubleEDFin[i+n*n]=B[i];      // pack the right hand side
-        IssmPDouble* pdoubleEDFin=xNew<IssmPDouble>(n*(n+1)); // provide space to transfer inputs during call_ext_fct
-	IssmPDouble* pdoubleEDFout=xNew<IssmPDouble>(n);           // provide space to transfer outputs during call_ext_fct
 	// call the wrapped solver through the registry entry we retrieve from parameters
 	call_ext_fct(xDynamicCast<GenericParam<Adolc_edf> * >(parameters->FindParamObject(AdolcParamEnum))->GetParameterValue().myEDF_for_solverx_p,
-	             n*(n+1), pdoubleEDFin, adoubleEDFin,
-	             n, pdoubleEDFout,X);
+	             n*(n+1), adoubleEDFin,
+	             n, X);
 	// for(int i=0; i<n;  i++) {ADOLC_DUMP_MACRO(X[i]);}
 	xDelete(adoubleEDFin);
-	xDelete(pdoubleEDFin);
-	xDelete(pdoubleEDFout);
 }
 /*}}}*/
 #endif

Modified: issm/trunk/src/c/toolkits/issm/Bucket.h
===================================================================
--- issm/trunk/src/c/toolkits/issm/Bucket.h	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/toolkits/issm/Bucket.h	2016-04-13 04:32:01 UTC (rev 20500)
@@ -8,7 +8,7 @@
 /*Headers:*/
 /*{{{*/
 #include "../../datastructures/datastructures.h"
-#include "../../shared/shared.h"
+#include "../../shared/io/Comm/IssmComm.h"
 #include "../toolkitsenums.h"
 /*}}}*/
 
@@ -128,6 +128,10 @@
 			else if (this->type==VECTOR_BUCKET) return new Bucket(this->m,this->idxm,this->values,this->mode);
 			else _error_("No Copy of Bucket because its type is invalid."); };
 		/*}}}*/
+		void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){/*{{{*/
+			_error_("not implemented yet!"); 
+		} 
+		/*}}}*/
 
 		/*specific routines of Bucket: */
 		void SpawnBucketsPerCpu(DataSet* bucketsofcpu_i,int rank_i,int* rowranks){ /*{{{*/

Modified: issm/trunk/src/c/toolkits/issm/IssmAbsVec.h
===================================================================
--- issm/trunk/src/c/toolkits/issm/IssmAbsVec.h	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/toolkits/issm/IssmAbsVec.h	2016-04-13 04:32:01 UTC (rev 20500)
@@ -41,6 +41,7 @@
 		virtual void AXPY(IssmAbsVec* X, doubletype a)=0;
 		virtual void AYPX(IssmAbsVec* X, doubletype a)=0;
 		virtual doubletype* ToMPISerial(void)=0;
+		virtual void Shift(doubletype shift)=0;
 		virtual void Copy(IssmAbsVec* to)=0;
 		virtual doubletype Norm(NormMode mode)=0;
 		virtual void Scale(doubletype scale_factor)=0;

Modified: issm/trunk/src/c/toolkits/issm/IssmMpiVec.h
===================================================================
--- issm/trunk/src/c/toolkits/issm/IssmMpiVec.h	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/toolkits/issm/IssmMpiVec.h	2016-04-13 04:32:01 UTC (rev 20500)
@@ -249,8 +249,8 @@
 			xDelete<int>(numvalues_forcpu);
 
 			for(i=0;i<num_procs;i++){
-				DataSet* buckets=bucketsforcpu[i];
-				delete buckets;
+				DataSet* bucketsn=bucketsforcpu[i];
+				delete bucketsn;
 			}
 			xDelete<DataSet*>(bucketsforcpu);
 
@@ -270,6 +270,10 @@
 
 			xDelete<int>(sendcnts);
 			xDelete<int>(displs);
+			
+			/*Get rid of all buckets, as we have already added them to the matrix!: */
+			delete this->buckets;
+			this->buckets=new DataSet();
 			/*}}}*/
 
 		}
@@ -395,6 +399,10 @@
 
 		}
 		/*}}}*/
+		void Shift(doubletype shift){/*{{{*/
+			for(int i=0;i<this->m;i++)this->vector[i]+=shift;
+		}
+		/*}}}*/
 		void Copy(IssmAbsVec<doubletype>* toin){/*{{{*/
 
 			int i;

Modified: issm/trunk/src/c/toolkits/issm/IssmSeqVec.h
===================================================================
--- issm/trunk/src/c/toolkits/issm/IssmSeqVec.h	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/toolkits/issm/IssmSeqVec.h	2016-04-13 04:32:01 UTC (rev 20500)
@@ -198,6 +198,12 @@
 
 		}
 		/*}}}*/
+		void Shift(doubletype shift){/*{{{*/
+
+			for(int i=0;i<this->M;i++)this->vector[i]+=shift;
+
+		}
+		/*}}}*/
 		void Copy(IssmAbsVec<doubletype>* toin){/*{{{*/
 
 			int i;

Modified: issm/trunk/src/c/toolkits/issm/IssmVec.h
===================================================================
--- issm/trunk/src/c/toolkits/issm/IssmVec.h	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/toolkits/issm/IssmVec.h	2016-04-13 04:32:01 UTC (rev 20500)
@@ -179,6 +179,10 @@
 			return vector->ToMPISerial();
 		}
 		/*}}}*/
+		void Shift(doubletype shift){/*{{{*/
+			vector->Shift(shift);
+		}
+		/*}}}*/
 		void Copy(IssmVec* to){/*{{{*/
 			vector->Copy(to->vector);
 		}

Modified: issm/trunk/src/c/toolkits/mpi/issmmpi.cpp
===================================================================
--- issm/trunk/src/c/toolkits/mpi/issmmpi.cpp	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/toolkits/mpi/issmmpi.cpp	2016-04-13 04:32:01 UTC (rev 20500)
@@ -493,3 +493,31 @@
   ensureContiguousLocations(aSize);
 #endif
 }/*}}}*/
+int ISSM_MPI_Comm_split(ISSM_MPI_Comm comm, int color, int key, ISSM_MPI_Comm *newcomm){ /*{{{*/
+
+int rc=0;
+#ifdef _HAVE_MPI_
+#ifdef _HAVE_AMPI_
+rc=MPI_Comm_split(comm, color, key, newcomm);
+#else
+rc=MPI_Comm_split(comm, color, key, newcomm);
+#endif
+#else 
+// nothing to be done here 
+#endif
+  return rc;
+}/*}}}*/
+int ISSM_MPI_Intercomm_create(ISSM_MPI_Comm comm,int local_leader,ISSM_MPI_Comm peer_comm, int remote_leader, int tag,ISSM_MPI_Comm *newintercomm){ /*{{{*/
+
+	int rc=0;
+#ifdef _HAVE_MPI_
+#ifdef _HAVE_AMPI_
+	rc=MPI_Intercomm_create(comm,local_leader,peer_comm,remote_leader,tag,newintercomm);
+#else
+	rc=MPI_Intercomm_create(comm,local_leader,peer_comm,remote_leader,tag,newintercomm);
+#endif
+#else 
+	// nothing to be done here 
+#endif
+	return rc;
+}/*}}}*/

Modified: issm/trunk/src/c/toolkits/mpi/issmmpi.h
===================================================================
--- issm/trunk/src/c/toolkits/mpi/issmmpi.h	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/toolkits/mpi/issmmpi.h	2016-04-13 04:32:01 UTC (rev 20500)
@@ -19,6 +19,8 @@
 	/*Include header files: {{{*/
 	#ifdef _HAVE_AMPI_
 		#include <ampi/ampi.h>
+	#elif  _HAVE_PETSC_MPI_ // Petsc now hides there MPI header. It can be reached through Petsc.
+		#include <petsc.h>
 	#else 
 		#include <mpi.h>
 	#endif
@@ -134,6 +136,8 @@
 int ISSM_MPI_Scatterv(void *sendbuf, int *sendcnts, int *displs, ISSM_MPI_Datatype sendtype, void *recvbuf, int recvcnt, ISSM_MPI_Datatype recvtype, int root, ISSM_MPI_Comm comm); 
 int ISSM_MPI_Send(void *buf, int count, ISSM_MPI_Datatype datatype, int dest, int tag, ISSM_MPI_Comm comm);
 double ISSM_MPI_Wtime(void);
+int ISSM_MPI_Comm_split(ISSM_MPI_Comm comm, int color, int key, ISSM_MPI_Comm *newcomm);
+int ISSM_MPI_Intercomm_create(ISSM_MPI_Comm comm,int local_leader,ISSM_MPI_Comm peer_comm, int remote_leader, int tag,ISSM_MPI_Comm *newintercomm);
 
 // special for Adol-C locations when buffers are allocated with new
 // this could end up in the xNew template specialized for adoubles 

Modified: issm/trunk/src/c/toolkits/mumps/MumpsSolve.cpp
===================================================================
--- issm/trunk/src/c/toolkits/mumps/MumpsSolve.cpp	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/toolkits/mumps/MumpsSolve.cpp	2016-04-13 04:32:01 UTC (rev 20500)
@@ -320,19 +320,15 @@
   for (int i=0;i<n;++i) { 
     pack_A_rhs[local_nnz+i]=rhs[i];
   }
-  IssmPDouble *passivePack_A_rhs=xNew<IssmPDouble>(local_nnz+n);
-  IssmPDouble *passiveSol=xNew<IssmPDouble>(n);
   IssmDouble *sol=xNew<IssmDouble>(n);
   call_ext_fct(xDynamicCast<GenericParam<Adolc_edf> * >(parameters->FindParamObject(AdolcParamEnum))->GetParameterValue().myEDF_for_solverx_p,
 	       packedDimsSparseArrLength, packedDimsSparseArr,
-	       local_nnz+n, passivePack_A_rhs, pack_A_rhs, 
-	       n, passiveSol,sol);
+	       local_nnz+n, pack_A_rhs, 
+	       n,sol);
   for (int i=0;i<n;++i) { 
     rhs[i]=sol[i];
   }
   xDelete(sol);
-  xDelete(passiveSol);
-  xDelete(passivePack_A_rhs);
   xDelete(pack_A_rhs);
   xDelete(packedDimsSparseArr);
 }

Modified: issm/trunk/src/c/toolkits/objects/Vector.h
===================================================================
--- issm/trunk/src/c/toolkits/objects/Vector.h	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/toolkits/objects/Vector.h	2016-04-13 04:32:01 UTC (rev 20500)
@@ -280,6 +280,16 @@
 
 		}
 		/*}}}*/
+		void Shift(doubletype shift){_assert_(this);/*{{{*/
+
+			if(type==PetscVecType){
+				#ifdef _HAVE_PETSC_
+				this->pvector->Shift(shift);
+				#endif
+			}
+			else this->ivector->Shift(shift);
+		}
+		/*}}}*/
 		void Copy(Vector* to){_assert_(this);/*{{{*/
 
 			if(type==PetscVecType){

Modified: issm/trunk/src/c/toolkits/petsc/objects/PetscMat.cpp
===================================================================
--- issm/trunk/src/c/toolkits/petsc/objects/PetscMat.cpp	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/toolkits/petsc/objects/PetscMat.cpp	2016-04-13 04:32:01 UTC (rev 20500)
@@ -41,7 +41,28 @@
 	MatCreate(IssmComm::GetComm(),&this->matrix);
 	MatSetSizes(this->matrix,m,n,M,N);
 	MatSetFromOptions(this->matrix);
-	PetscErrorCode ierr = MatMPIAIJSetPreallocation(this->matrix,0,d_nnz,0,o_nnz);
+
+	/* 
+	 * Versions of Petsc beyond 3.3 have changed the use of preallocation 
+	 * routines to distinguish between parallel builds and sequential. Since
+	 * our Windows builds are currently only sequential, we need to change
+	 * the way we use these functions.
+	 *
+	 * The following code computes the total number of non-zeroes per row of the
+	 * matrix in question. In parallel builds it is nescessary to kep track of 
+	 * diagonal non zeros and off-diagonal (d_nnz and o_nnz). Sequential does
+	 * not make that distinction.
+	*/
+	#ifdef _HAVE_PETSC_MPI_
+		int* nnz = new int[M];
+		for(int i = 0; i < M; i++)
+			nnz[i] = o_nnz[i] + d_nnz[i];
+
+		PetscErrorCode ierr = MatSeqAIJSetPreallocation(this->matrix,0,nnz);
+		delete[] nnz;
+	#else
+		PetscErrorCode ierr = MatMPIAIJSetPreallocation(this->matrix,0,d_nnz,0,o_nnz);
+	#endif
 	if(ierr) _error_("PETSc could not allocate matrix (probably not enough memory)");
 //	MatSetOption(this->matrix,MAT_NEW_NONZERO_ALLOCATION_ERR,PETSC_FALSE);
 

Modified: issm/trunk/src/c/toolkits/petsc/objects/PetscVec.cpp
===================================================================
--- issm/trunk/src/c/toolkits/petsc/objects/PetscVec.cpp	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/toolkits/petsc/objects/PetscVec.cpp	2016-04-13 04:32:01 UTC (rev 20500)
@@ -162,6 +162,12 @@
 
 }
 /*}}}*/
+void PetscVec::Shift(IssmDouble shift){/*{{{*/
+
+	if(this->vector) VecShift(this->vector,shift);
+
+}
+/*}}}*/
 void PetscVec::Copy(PetscVec* to){/*{{{*/
 
 	if(this->vector) VecCopy(this->vector,to->vector);

Modified: issm/trunk/src/c/toolkits/petsc/objects/PetscVec.h
===================================================================
--- issm/trunk/src/c/toolkits/petsc/objects/PetscVec.h	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/c/toolkits/petsc/objects/PetscVec.h	2016-04-13 04:32:01 UTC (rev 20500)
@@ -49,6 +49,7 @@
 		void        AXPY(PetscVec* X, IssmDouble a);
 		void        AYPX(PetscVec* X, IssmDouble a);
 		IssmDouble* ToMPISerial(void);
+		void        Shift(IssmDouble shift);
 		void        Copy(PetscVec* to);
 		IssmDouble  Norm(NormMode norm_type);
 		IssmDouble  Max(void);

Modified: issm/trunk/src/dox/issm.dox
===================================================================
--- issm/trunk/src/dox/issm.dox	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/dox/issm.dox	2016-04-13 04:32:01 UTC (rev 20500)
@@ -46,28 +46,28 @@
 <th  bgcolor=#7AA9DD style="text-align:left;">Language</th><th  bgcolor=#7AA9DD style="text-align:right;">files</th><th  bgcolor=#7AA9DD style="text-align:right;">blank</th><th  bgcolor=#7AA9DD style="text-align:right;">comment</th><th  bgcolor=#7AA9DD style="text-align:right;">code</th><th  bgcolor=#7AA9DD style="text-align:right;">Total</th>
 </th>
 <tr>
-<th  bgcolor=#FFFFFF style="text-align:left;"> C++ </th><td  bgcolor=#FFFFFF style="text-align:right;">445</td><td  bgcolor=#FFFFFF style="text-align:right;">15967</td><td  bgcolor=#FFFFFF style="text-align:right;">16145</td><td  bgcolor=#FFFFFF style="text-align:right;">70397</td><td  bgcolor=#FFFFFF style="text-align:right;">102509</td>
+<th  bgcolor=#FFFFFF style="text-align:left;"> C++ </th><td  bgcolor=#FFFFFF style="text-align:right;">467</td><td  bgcolor=#FFFFFF style="text-align:right;">18020</td><td  bgcolor=#FFFFFF style="text-align:right;">18480</td><td  bgcolor=#FFFFFF style="text-align:right;">84161</td><td  bgcolor=#FFFFFF style="text-align:right;">120661</td>
 </tr>
 <tr>
-<th  bgcolor=#C6E2FF style="text-align:left;"> MATLAB </th><td  bgcolor=#C6E2FF style="text-align:right;">1422</td><td  bgcolor=#C6E2FF style="text-align:right;">8497</td><td  bgcolor=#C6E2FF style="text-align:right;">16638</td><td  bgcolor=#C6E2FF style="text-align:right;">39538</td><td  bgcolor=#C6E2FF style="text-align:right;">64673</td>
+<th  bgcolor=#C6E2FF style="text-align:left;"> MATLAB </th><td  bgcolor=#C6E2FF style="text-align:right;">1606</td><td  bgcolor=#C6E2FF style="text-align:right;">8941</td><td  bgcolor=#C6E2FF style="text-align:right;">18403</td><td  bgcolor=#C6E2FF style="text-align:right;">42192</td><td  bgcolor=#C6E2FF style="text-align:right;">69536</td>
 </tr>
 <tr>
-<th  bgcolor=#FFFFFF style="text-align:left;"> C/C++  Header </th><td  bgcolor=#FFFFFF style="text-align:right;">411</td><td  bgcolor=#FFFFFF style="text-align:right;">3443</td><td  bgcolor=#FFFFFF style="text-align:right;">3528</td><td  bgcolor=#FFFFFF style="text-align:right;">15243</td><td  bgcolor=#FFFFFF style="text-align:right;">22214</td>
+<th  bgcolor=#FFFFFF style="text-align:left;"> C/C++  Header </th><td  bgcolor=#FFFFFF style="text-align:right;">420</td><td  bgcolor=#FFFFFF style="text-align:right;">3534</td><td  bgcolor=#FFFFFF style="text-align:right;">3662</td><td  bgcolor=#FFFFFF style="text-align:right;">15940</td><td  bgcolor=#FFFFFF style="text-align:right;">23136</td>
 </tr>
 <tr>
-<th  bgcolor=#C6E2FF style="text-align:left;"> m4 </th><td  bgcolor=#C6E2FF style="text-align:right;">8</td><td  bgcolor=#C6E2FF style="text-align:right;">1036</td><td  bgcolor=#C6E2FF style="text-align:right;">149</td><td  bgcolor=#C6E2FF style="text-align:right;">9756</td><td  bgcolor=#C6E2FF style="text-align:right;">10941</td>
+<th  bgcolor=#C6E2FF style="text-align:left;"> Python </th><td  bgcolor=#C6E2FF style="text-align:right;">162</td><td  bgcolor=#C6E2FF style="text-align:right;">2523</td><td  bgcolor=#C6E2FF style="text-align:right;">2751</td><td  bgcolor=#C6E2FF style="text-align:right;">10735</td><td  bgcolor=#C6E2FF style="text-align:right;">16009</td>
 </tr>
 <tr>
-<th  bgcolor=#FFFFFF style="text-align:left;"> Python </th><td  bgcolor=#FFFFFF style="text-align:right;">151</td><td  bgcolor=#FFFFFF style="text-align:right;">2421</td><td  bgcolor=#FFFFFF style="text-align:right;">2623</td><td  bgcolor=#FFFFFF style="text-align:right;">9733</td><td  bgcolor=#FFFFFF style="text-align:right;">14777</td>
+<th  bgcolor=#FFFFFF style="text-align:left;"> m4 </th><td  bgcolor=#FFFFFF style="text-align:right;">8</td><td  bgcolor=#FFFFFF style="text-align:right;">1052</td><td  bgcolor=#FFFFFF style="text-align:right;">149</td><td  bgcolor=#FFFFFF style="text-align:right;">9877</td><td  bgcolor=#FFFFFF style="text-align:right;">11078</td>
 </tr>
 <tr>
-<th  bgcolor=#C6E2FF style="text-align:left;"> Fortran  77 </th><td  bgcolor=#C6E2FF style="text-align:right;">7</td><td  bgcolor=#C6E2FF style="text-align:right;">4</td><td  bgcolor=#C6E2FF style="text-align:right;">302</td><td  bgcolor=#C6E2FF style="text-align:right;">365</td><td  bgcolor=#C6E2FF style="text-align:right;">671</td>
+<th  bgcolor=#C6E2FF style="text-align:left;"> Bourne  Shell </th><td  bgcolor=#C6E2FF style="text-align:right;">4</td><td  bgcolor=#C6E2FF style="text-align:right;">113</td><td  bgcolor=#C6E2FF style="text-align:right;">188</td><td  bgcolor=#C6E2FF style="text-align:right;">524</td><td  bgcolor=#C6E2FF style="text-align:right;">825</td>
 </tr>
 <tr>
-<th  bgcolor=#FFFFFF style="text-align:left;"> Bourne  Shell </th><td  bgcolor=#FFFFFF style="text-align:right;">2</td><td  bgcolor=#FFFFFF style="text-align:right;">59</td><td  bgcolor=#FFFFFF style="text-align:right;">84</td><td  bgcolor=#FFFFFF style="text-align:right;">262</td><td  bgcolor=#FFFFFF style="text-align:right;">405</td>
+<th  bgcolor=#FFFFFF style="text-align:left;"> Fortran  77 </th><td  bgcolor=#FFFFFF style="text-align:right;">7</td><td  bgcolor=#FFFFFF style="text-align:right;">4</td><td  bgcolor=#FFFFFF style="text-align:right;">302</td><td  bgcolor=#FFFFFF style="text-align:right;">365</td><td  bgcolor=#FFFFFF style="text-align:right;">671</td>
 </tr>
 <tr>
-<th  bgcolor=#C6E2FF style="text-align:left;"> SUM: </th><td  bgcolor=#C6E2FF style="text-align:right;">2446</td><td  bgcolor=#C6E2FF style="text-align:right;">31427</td><td  bgcolor=#C6E2FF style="text-align:right;">39469</td><td  bgcolor=#C6E2FF style="text-align:right;">145294</td><td  bgcolor=#C6E2FF style="text-align:right;">216190</td>
+<th  bgcolor=#C6E2FF style="text-align:left;"> SUM: </th><td  bgcolor=#C6E2FF style="text-align:right;">2674</td><td  bgcolor=#C6E2FF style="text-align:right;">34187</td><td  bgcolor=#C6E2FF style="text-align:right;">43935</td><td  bgcolor=#C6E2FF style="text-align:right;">163794</td><td  bgcolor=#C6E2FF style="text-align:right;">241916</td>
 </tr>
 </table>
 

Modified: issm/trunk/src/m/Makefile.am
===================================================================
--- issm/trunk/src/m/Makefile.am	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/Makefile.am	2016-04-13 04:32:01 UTC (rev 20500)
@@ -6,78 +6,168 @@
 if WRAPPERS
 if MATLAB
 if !DEVELOPMENT
-bin_SCRIPTS += ./qmu/*.m \
-					./qmu/setupdesign/*.m \
-					./qmu/plot/*.m \
-					./qmu/examples/*.m \
-					./kml/*.m \
-					./enum/*.m \
-					./dev/issmversion.m \
-					./classes/*.m \
-					./classes/qmu/*.m \
-					./classes/qmu/@dakota_method/*.m \
-					./classes/clusters/*.m \
-					./consistency/*.m \
-					./array/*.m \
-					./boundaryconditions/*.m \
-					./exp/*.m \
-					./exp/operation/*.m \
-					./geometry/*.m \
-					./interp/*.m \
-					./coordsystems/*.m \
-					./mech/*.m \
-					./mesh/*.m \
-					./mesh/planet/*.m \
-					./mesh/rifts/*.m \
-					./miscellaneous/*.m \
-					./os/*.m \
-					./plot/*.m \
-					./plot/colormaps/*.m \
-					./string/*.m \
-					./contrib/massbalance/*.m \
-					./contrib/ecco/*.m \
-					./contrib/hydrology/*.m \
-					./contrib/hack/*.m \
-					./contrib/gslib/*.m \
-					./contrib/uci/*.m \
-					./contrib/oasis/*.m \
-					./contrib/bamg/*.m \
-					./extrusion/*.m \
-					./inversions/*.m \
-					./io/*.m \
-					./parameterization/*.m \
-					./partition/*.m \
-					./print/*.m \
-					./regional/*.m \
-					./solve/*.m \
-					./solvers/*.m \
-					./materials/*.m
+bin_SCRIPTS += ${ISSM_DIR}/src/m/qmu/*.m \
+					${ISSM_DIR}/src/m/qmu/setupdesign/*.m \
+					${ISSM_DIR}/src/m/qmu/plot/*.m \
+					${ISSM_DIR}/src/m/qmu/examples/*.m \
+					${ISSM_DIR}/src/m/kml/*.m \
+					${ISSM_DIR}/src/m/enum/*.m \
+					${ISSM_DIR}/src/m/dev/issmversion.m \
+					${ISSM_DIR}/src/m/classes/*.m \
+					${ISSM_DIR}/src/m/classes/qmu/*.m \
+					${ISSM_DIR}/src/m/classes/qmu/@dakota_method/*.m \
+					${ISSM_DIR}/src/m/classes/clusters/*.m \
+					${ISSM_DIR}/src/m/consistency/*.m \
+					${ISSM_DIR}/src/m/array/*.m \
+					${ISSM_DIR}/src/m/boundaryconditions/*.m \
+					${ISSM_DIR}/src/m/exp/*.m \
+					${ISSM_DIR}/src/m/exp/operation/*.m \
+					${ISSM_DIR}/src/m/geometry/*.m \
+					${ISSM_DIR}/src/m/interp/*.m \
+					${ISSM_DIR}/src/m/coordsystems/*.m \
+					${ISSM_DIR}/src/m/mech/*.m \
+					${ISSM_DIR}/src/m/mesh/*.m \
+					${ISSM_DIR}/src/m/mesh/planet/spheretri/*.m \
+					${ISSM_DIR}/src/m/mesh/planet/gmsh/*.m \
+					${ISSM_DIR}/src/m/mesh/rifts/*.m \
+					${ISSM_DIR}/src/m/miscellaneous/*.m \
+					${ISSM_DIR}/src/m/os/*.m \
+					${ISSM_DIR}/src/m/plot/*.m \
+					${ISSM_DIR}/src/m/plot/colormaps/*.m \
+					${ISSM_DIR}/src/m/string/*.m \
+					${ISSM_DIR}/src/m/extrusion/*.m \
+					${ISSM_DIR}/src/m/inversions/*.m \
+					${ISSM_DIR}/src/m/io/*.m \
+					${ISSM_DIR}/src/m/parameterization/*.m \
+					${ISSM_DIR}/src/m/partition/*.m \
+					${ISSM_DIR}/src/m/print/*.m \
+					${ISSM_DIR}/src/m/regional/*.m \
+					${ISSM_DIR}/src/m/solve/*.m \
+					${ISSM_DIR}/src/m/solvers/*.m \
+					${ISSM_DIR}/src/m/materials/*.m
 endif
 endif
 if PYTHON
 if !DEVELOPMENT
-bin_SCRIPTS += ./enum/*.py \
-					./classes/*.py \
-					./classes/clusters/*.py \
-					./consistency/*.py \
-					./dev/issmversion.py \
-					./boundaryconditions/*.py \
-					./exp/*.py \
-					./geometry/*.py \
-					./coordsystems/*.py \
-					./interp/*.py \
-					./mech/*.py \
-					./mesh/*.py \
-					./mesh/rifts/*.py \
-					./miscellaneous/*.py \
-					./os/*.py \
-					./plot/*.py \
-					./extrusion/*.py \
-					./io/*.py \
-					./parameterization/*.py \
-					./solve/*.py \
-					./solvers/*.py \
-					./materials/*.py
+bin_SCRIPTS += ${ISSM_DIR}/src/m/enum/*.py \
+					${ISSM_DIR}/src/m/classes/*.py \
+					${ISSM_DIR}/src/m/classes/clusters/*.py \
+					${ISSM_DIR}/src/m/consistency/*.py \
+					${ISSM_DIR}/src/m/dev/issmversion.py \
+					${ISSM_DIR}/src/m/boundaryconditions/*.py \
+					${ISSM_DIR}/src/m/exp/*.py \
+					${ISSM_DIR}/src/m/geometry/*.py \
+					${ISSM_DIR}/src/m/coordsystems/*.py \
+					${ISSM_DIR}/src/m/interp/*.py \
+					${ISSM_DIR}/src/m/inversions/*.py \
+					${ISSM_DIR}/src/m/mech/*.py \
+					${ISSM_DIR}/src/m/mesh/*.py \
+					${ISSM_DIR}/src/m/mesh/rifts/*.py \
+					${ISSM_DIR}/src/m/miscellaneous/*.py \
+					${ISSM_DIR}/src/m/os/*.py \
+					${ISSM_DIR}/src/m/plot/*.py \
+					${ISSM_DIR}/src/m/extrusion/*.py \
+					${ISSM_DIR}/src/m/io/*.py \
+					${ISSM_DIR}/src/m/parameterization/*.py \
+					${ISSM_DIR}/src/m/solve/*.py \
+					${ISSM_DIR}/src/m/solvers/*.py \
+					${ISSM_DIR}/src/m/materials/*.py
 endif
 endif
+
+if JAVASCRIPT
+if !DEVELOPMENT
+
+js_scripts =  ${ISSM_DIR}/src/m/array/arrayoperations.js \
+				${ISSM_DIR}/src/m/boundaryconditions/SetIceShelfBC.js \
+				${ISSM_DIR}/src/m/classes/autodiff.js \
+				${ISSM_DIR}/src/m/classes/balancethickness.js \
+				${ISSM_DIR}/src/m/classes/basalforcings.js \
+				${ISSM_DIR}/src/m/classes/calving.js \
+				${ISSM_DIR}/src/m/classes/clusters/generic.js \
+				${ISSM_DIR}/src/m/classes/clusters/local.js \
+				${ISSM_DIR}/src/m/classes/constants.js \
+				${ISSM_DIR}/src/m/classes/damage.js \
+				${ISSM_DIR}/src/m/classes/debug.js \
+				${ISSM_DIR}/src/m/classes/flaim.js \
+				${ISSM_DIR}/src/m/classes/flowequation.js \
+				${ISSM_DIR}/src/m/classes/friction.js \
+				${ISSM_DIR}/src/m/classes/geometry.js \
+				${ISSM_DIR}/src/m/classes/gia.js \
+				${ISSM_DIR}/src/m/classes/groundingline.js \
+				${ISSM_DIR}/src/m/classes/hydrologyshreve.js \
+				${ISSM_DIR}/src/m/classes/initialization.js \
+				${ISSM_DIR}/src/m/classes/inversion.js \
+				${ISSM_DIR}/src/m/classes/mask.js \
+				${ISSM_DIR}/src/m/classes/maskpsl.js \
+				${ISSM_DIR}/src/m/classes/masstransport.js \
+				${ISSM_DIR}/src/m/classes/matice.js \
+				${ISSM_DIR}/src/m/classes/mesh2d.js \
+				${ISSM_DIR}/src/m/classes/mesh3dsurface.js \
+				${ISSM_DIR}/src/m/classes/miscellaneous.js \
+				${ISSM_DIR}/src/m/classes/model.js \
+				${ISSM_DIR}/src/m/classes/outputdefinition.js \
+				${ISSM_DIR}/src/m/classes/pairoptions.js \
+				${ISSM_DIR}/src/m/classes/plotoptions.js \
+				${ISSM_DIR}/src/m/classes/priv.js \
+				${ISSM_DIR}/src/m/classes/qmu.js \
+				${ISSM_DIR}/src/m/classes/radaroverlay.js \
+				${ISSM_DIR}/src/m/classes/rifts.js \
+				${ISSM_DIR}/src/m/classes/slr.js \
+				${ISSM_DIR}/src/m/classes/settings.js \
+				${ISSM_DIR}/src/m/classes/SMBforcing.js \
+				${ISSM_DIR}/src/m/classes/steadystate.js \
+				${ISSM_DIR}/src/m/classes/stressbalance.js \
+				${ISSM_DIR}/src/m/classes/template.js \
+				${ISSM_DIR}/src/m/classes/thermal.js \
+				${ISSM_DIR}/src/m/classes/timestepping.js \
+				${ISSM_DIR}/src/m/classes/toolkits.js \
+				${ISSM_DIR}/src/m/classes/levelset.js \
+				${ISSM_DIR}/src/m/classes/trans.js \
+				${ISSM_DIR}/src/m/classes/verbose.js \
+				${ISSM_DIR}/src/m/consistency/checkfield.js \
+				${ISSM_DIR}/src/m/consistency/ismodelselfconsistent.js \
+				${ISSM_DIR}/src/m/enum/EnumDefinitions.js \
+				${ISSM_DIR}/src/m/geometry/FlagElements.js \
+				${ISSM_DIR}/src/m/inversions/marshallcostfunctions.js \
+				${ISSM_DIR}/src/m/io/fileptr.js \
+				${ISSM_DIR}/src/m/io/savemodel.js \
+				${ISSM_DIR}/src/m/io/loadmodel.js \
+				${ISSM_DIR}/src/m/io/saveAsFile.js \
+				${ISSM_DIR}/src/m/materials/paterson.js \
+				${ISSM_DIR}/src/m/mesh/triangle.js \
+				${ISSM_DIR}/src/m/miscellaneous/colorbars.js \
+				${ISSM_DIR}/src/m/miscellaneous/fielddisplay.js \
+				${ISSM_DIR}/src/m/miscellaneous/rgbcolor.js \
+				${ISSM_DIR}/src/m/parameterization/setflowequation.js \
+				${ISSM_DIR}/src/m/parameterization/setmask.js \
+				${ISSM_DIR}/src/m/plot/slider.js \
+				${ISSM_DIR}/src/m/plot/tooltips.js \
+				${ISSM_DIR}/src/m/plot/applyoptions.js \
+				${ISSM_DIR}/src/m/plot/checkplotoptions.js \
+				${ISSM_DIR}/src/m/plot/plot_manager.js \
+				${ISSM_DIR}/src/m/plot/plot_mesh.js \
+				${ISSM_DIR}/src/m/plot/plot_overlay.js \
+				${ISSM_DIR}/src/m/plot/plot_unit.js \
+				${ISSM_DIR}/src/m/plot/plot_quiver.js \
+				${ISSM_DIR}/src/m/plot/plotmodel.js \
+				${ISSM_DIR}/src/m/plot/processdata.js \
+				${ISSM_DIR}/src/m/plot/processmesh.js \
+				${ISSM_DIR}/src/m/plot/gauge.js \
+				${ISSM_DIR}/src/m/plot/webgl.js \
+				${ISSM_DIR}/src/m/print/sprintf.js \
+				${ISSM_DIR}/src/m/solve/loadresultsfrombuffer.js \
+				${ISSM_DIR}/src/m/solve/marshall.js \
+				${ISSM_DIR}/src/m/solve/parseresultsfrombuffer.js \
+				${ISSM_DIR}/src/m/solve/solve.js \
+				${ISSM_DIR}/src/m/solve/WriteData.js \
+				${ISSM_DIR}/src/m/solvers/issmgslsolver.js 
+bin_SCRIPTS +=  issm-bin.js
+
+issm-bin.js: ${js_scripts}
+	cat ${js_scripts}  > issm-bin.js
+
 endif
+endif
+
+endif

Modified: issm/trunk/src/m/boundaryconditions/SetIceSheetBC.m
===================================================================
--- issm/trunk/src/m/boundaryconditions/SetIceSheetBC.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/boundaryconditions/SetIceSheetBC.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -29,7 +29,7 @@
 %No ice front: do nothing
 
 %Initialize surface and basal forcings
-md.surfaceforcings = initialize(md.surfaceforcings,md);
+md.smb = initialize(md.smb,md);
 md.basalforcings   = initialize(md.basalforcings,md);
 
 %Deal with other boundary conditions

Modified: issm/trunk/src/m/boundaryconditions/SetIceSheetBC.py
===================================================================
--- issm/trunk/src/m/boundaryconditions/SetIceSheetBC.py	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/boundaryconditions/SetIceSheetBC.py	2016-04-13 04:32:01 UTC (rev 20500)
@@ -33,8 +33,8 @@
 
 	#No ice front -> do nothing
 
-	#Create zeros basalforcings and surfaceforcings
-	md.surfaceforcings.initialize(md)
+	#Create zeros basalforcings and smb
+	md.smb.initialize(md)
 	md.basalforcings.initialize(md)
 
 	#Deal with other boundary conditions

Modified: issm/trunk/src/m/boundaryconditions/SetIceShelfBC.m
===================================================================
--- issm/trunk/src/m/boundaryconditions/SetIceShelfBC.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/boundaryconditions/SetIceShelfBC.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -62,7 +62,7 @@
 end
 
 %Initialize surface and basal forcings
-md.surfaceforcings = initialize(md.surfaceforcings,md);
+md.smb = initialize(md.smb,md);
 md.basalforcings   = initialize(md.basalforcings,md);
 
 %Deal with other boundary conditions

Modified: issm/trunk/src/m/boundaryconditions/SetIceShelfBC.py
===================================================================
--- issm/trunk/src/m/boundaryconditions/SetIceShelfBC.py	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/boundaryconditions/SetIceShelfBC.py	2016-04-13 04:32:01 UTC (rev 20500)
@@ -75,8 +75,8 @@
 	else:
 		print "      boundary conditions for stressbalance model: spc set as zero"
 
-	#Create zeros basalforcings and surfaceforcings
-	md.surfaceforcings.initialize(md)
+	#Create zeros basalforcings and smb
+	md.smb.initialize(md)
 	md.basalforcings.initialize(md)
 
 	#Deal with other boundary conditions

Modified: issm/trunk/src/m/boundaryconditions/SetMarineIceSheetBC.m
===================================================================
--- issm/trunk/src/m/boundaryconditions/SetMarineIceSheetBC.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/boundaryconditions/SetMarineIceSheetBC.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -80,7 +80,7 @@
 md.hydrology.spcwatercolumn(pos,1)=1;
 
 %Initialize surface and basal forcings
-md.surfaceforcings = initialize(md.surfaceforcings,md);
+md.smb = initialize(md.smb,md);
 md.basalforcings   = initialize(md.basalforcings,md);
 
 %Deal with other boundary conditions

Modified: issm/trunk/src/m/boundaryconditions/SetMarineIceSheetBC.py
===================================================================
--- issm/trunk/src/m/boundaryconditions/SetMarineIceSheetBC.py	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/boundaryconditions/SetMarineIceSheetBC.py	2016-04-13 04:32:01 UTC (rev 20500)
@@ -83,8 +83,8 @@
 	pos=numpy.nonzero(md.mesh.vertexonboundary)[0]
 	md.hydrology.spcwatercolumn[pos,0]=1
 
-	#Create zeros basalforcings and surfaceforcings
-	md.surfaceforcings.initialize(md)
+	#Create zeros basalforcings and smb
+	md.smb.initialize(md)
 	md.basalforcings.initialize(md)
 
 	#Deal with other boundary conditions

Modified: issm/trunk/src/m/classes/SMBcomponents.m
===================================================================
--- issm/trunk/src/m/classes/SMBcomponents.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/classes/SMBcomponents.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -8,6 +8,7 @@
 		accumulation = NaN;
 		runoff = NaN;
 		evaporation = NaN;
+		requested_outputs      = {};
 	end
 	methods
 		function self = SMBcomponents(varargin) % {{{
@@ -24,57 +25,74 @@
 			self.evaporation=project3d(md,'vector',self.evaporation,'type','node');
 
 		end % }}}
+		function list = defaultoutputs(self,md) % {{{
+
+			list = {''};
+
+		end % }}}
 		function self = initialize(self,md) % {{{
 
 			if isnan(self.accumulation)
 				self.accumulation=zeros(md.mesh.numberofvertices,1);
-				disp('      no surfaceforcings.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 surfaceforcings.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 surfaceforcings.runoff specified: values set as zero');
+				disp('      no smb.runoff specified: values set as zero');
 			end
 
 		end % }}}
 		function md = checkconsistency(self,md,solution,analyses) % {{{
 
 			if ismember(MasstransportAnalysisEnum(),analyses),
-				md = checkfield(md,'fieldname','surfaceforcings.accumulation','timeseries',1,'NaN',1);
+				md = checkfield(md,'fieldname','smb.accumulation','timeseries',1,'NaN',1,'Inf',1);
 			end
 			if ismember(BalancethicknessAnalysisEnum(),analyses),
-				md = checkfield(md,'fieldname','surfaceforcings.accumulation','size',[md.mesh.numberofvertices 1],'NaN',1);
+				md = checkfield(md,'fieldname','smb.accumulation','size',[md.mesh.numberofvertices 1],'NaN',1,'Inf',1);
 			end
 			if ismember(MasstransportAnalysisEnum(),analyses),
-				md = checkfield(md,'fieldname','surfaceforcings.runoff','timeseries',1,'NaN',1);
+				md = checkfield(md,'fieldname','smb.runoff','timeseries',1,'NaN',1,'Inf',1);
 			end
 			if ismember(BalancethicknessAnalysisEnum(),analyses),
-				md = checkfield(md,'fieldname','surfaceforcings.runoff','size',[md.mesh.numberofvertices 1],'NaN',1);
+				md = checkfield(md,'fieldname','smb.runoff','size',[md.mesh.numberofvertices 1],'NaN',1,'Inf',1);
 			end
 			if ismember(MasstransportAnalysisEnum(),analyses),
-				md = checkfield(md,'fieldname','surfaceforcings.evaporation','timeseries',1,'NaN',1);
+				md = checkfield(md,'fieldname','smb.evaporation','timeseries',1,'NaN',1,'Inf',1);
 			end
 			if ismember(BalancethicknessAnalysisEnum(),analyses),
-				md = checkfield(md,'fieldname','surfaceforcings.evaporation','size',[md.mesh.numberofvertices 1],'NaN',1);
+				md = checkfield(md,'fieldname','smb.evaporation','size',[md.mesh.numberofvertices 1],'NaN',1,'Inf',1);
 			end
+			md = checkfield(md,'fieldname','smb.requested_outputs','stringrow',1);
 		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,'requested_outputs','additional outputs requested');
 		end % }}}
 		function marshall(self,md,fid) % {{{
 
 			yts=365.0*24.0*3600.0;
 
-			WriteData(fid,'enum',SurfaceforcingsEnum(),'data',SMBcomponentsEnum(),'format','Integer');
-			WriteData(fid,'object',self,'class','surfaceforcings','fieldname','accumulation','format','DoubleMat','mattype',1,'scale',1./yts,'timeserieslength',md.mesh.numberofvertices+1);
-			WriteData(fid,'object',self,'class','surfaceforcings','fieldname','runoff','format','DoubleMat','mattype',1,'scale',1./yts,'timeserieslength',md.mesh.numberofvertices+1);
-			WriteData(fid,'object',self,'class','surfaceforcings','fieldname','evaporation','format','DoubleMat','mattype',1,'scale',1./yts,'timeserieslength',md.mesh.numberofvertices+1);
+			WriteData(fid,'enum',SmbEnum(),'data',SMBcomponentsEnum(),'format','Integer');
+			WriteData(fid,'object',self,'class','smb','fieldname','accumulation','format','DoubleMat','mattype',1,'scale',1./yts,'timeserieslength',md.mesh.numberofvertices+1);
+			WriteData(fid,'object',self,'class','smb','fieldname','runoff','format','DoubleMat','mattype',1,'scale',1./yts,'timeserieslength',md.mesh.numberofvertices+1);
+			WriteData(fid,'object',self,'class','smb','fieldname','evaporation','format','DoubleMat','mattype',1,'scale',1./yts,'timeserieslength',md.mesh.numberofvertices+1);
+			
+			%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,'data',outputs,'enum',SmbRequestedOutputsEnum,'format','StringArray');
+
 		end % }}}
 	end
 end

Modified: issm/trunk/src/m/classes/SMBcomponents.py
===================================================================
--- issm/trunk/src/m/classes/SMBcomponents.py	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/classes/SMBcomponents.py	2016-04-13 04:32:01 UTC (rev 20500)
@@ -16,12 +16,14 @@
 		self.accumulation = float('NaN')
 		self.runoff = float('NaN')
 		self.evaporation = float('NaN')
+		self.requested_outputs      = []
 		#}}}
 	def __repr__(self): # {{{
 		string="   surface forcings parameters (SMB=accumulation-runoff-evaporation) :"
 		string="%s\n%s"%(string,fielddisplay(self,'accumulation','accumulated snow [m/yr ice eq]'))
 		string="%s\n%s"%(string,fielddisplay(self,'runoff','amount of ice melt lost from the ice column [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,'requested_outputs','additional outputs requested'))
 		return string
 		#}}}
 	def extrude(self,md): # {{{
@@ -31,6 +33,9 @@
 		self.mass_balance=project3d(md,'vector',self.evaporation,'type','node');
 		return self
 	#}}}
+	def defaultoutputs(self,md): # {{{
+		return []
+	#}}}
 	def initialize(self,md): # {{{
 
 		if numpy.all(numpy.isnan(self.accumulation)):
@@ -50,22 +55,24 @@
 	def checkconsistency(self,md,solution,analyses):    # {{{
 
 		if MasstransportAnalysisEnum() in analyses:
-			md = checkfield(md,'fieldname','surfaceforcings.accumulation','timeseries',1,'NaN',1)
+			md = checkfield(md,'fieldname','smb.accumulation','timeseries',1,'NaN',1,'Inf',1)
 
 		if BalancethicknessAnalysisEnum() in analyses:
-			md = checkfield(md,'fieldname','surfaceforcings.accumulation','size',[md.mesh.numberofvertices],'NaN',1)
+			md = checkfield(md,'fieldname','smb.accumulation','size',[md.mesh.numberofvertices],'NaN',1,'Inf',1)
 
 		if MasstransportAnalysisEnum() in analyses:
-			md = checkfield(md,'fieldname','surfaceforcings.runoff','timeseries',1,'NaN',1)
+			md = checkfield(md,'fieldname','smb.runoff','timeseries',1,'NaN',1,'Inf',1)
 
 		if BalancethicknessAnalysisEnum() in analyses:
-			md = checkfield(md,'fieldname','surfaceforcings.runoff','size',[md.mesh.numberofvertices],'NaN',1)
+			md = checkfield(md,'fieldname','smb.runoff','size',[md.mesh.numberofvertices],'NaN',1,'Inf',1)
 
 		if MasstransportAnalysisEnum() in analyses:
-			md = checkfield(md,'fieldname','surfaceforcings.evaporation','timeseries',1,'NaN',1)
+			md = checkfield(md,'fieldname','smb.evaporation','timeseries',1,'NaN',1,'Inf',1)
 
 		if BalancethicknessAnalysisEnum() in analyses:
-			md = checkfield(md,'fieldname','surfaceforcings.evaporation','size',[md.mesh.numberofvertices],'NaN',1)
+			md = checkfield(md,'fieldname','smb.evaporation','size',[md.mesh.numberofvertices],'NaN',1,'Inf',1)
+		
+		md = checkfield(md,'fieldname','masstransport.requested_outputs','stringrow',1)
 
 		return md
 	# }}}
@@ -73,8 +80,17 @@
 
 		yts=365.0*24.0*3600.0
 
-		WriteData(fid,'enum',SurfaceforcingsEnum(),'data',SMBcomponentsEnum(),'format','Integer');
-		WriteData(fid,'object',self,'class','surfaceforcings','fieldname','accumulation','format','DoubleMat','mattype',1,'scale',1./yts,'timeserieslength',md.mesh.numberofvertices+1)
-		WriteData(fid,'object',self,'class','surfaceforcings','fieldname','runoff','format','DoubleMat','mattype',1,'scale',1./yts,'timeserieslength',md.mesh.numberofvertices+1)
-		WriteData(fid,'object',self,'class','surfaceforcings','fieldname','evaporation','format','DoubleMat','mattype',1,'scale',1./yts,'timeserieslength',md.mesh.numberofvertices+1)
+		WriteData(fid,'enum',SmbEnum(),'data',SMBcomponentsEnum(),'format','Integer');
+		WriteData(fid,'object',self,'class','smb','fieldname','accumulation','format','DoubleMat','mattype',1,'scale',1./yts,'timeserieslength',md.mesh.numberofvertices+1)
+		WriteData(fid,'object',self,'class','smb','fieldname','runoff','format','DoubleMat','mattype',1,'scale',1./yts,'timeserieslength',md.mesh.numberofvertices+1)
+		WriteData(fid,'object',self,'class','smb','fieldname','evaporation','format','DoubleMat','mattype',1,'scale',1./yts,'timeserieslength',md.mesh.numberofvertices+1)
+		
+		#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,'data',outputs,'enum',SmbRequestedOutputsEnum(),'format','StringArray')
+
 	# }}}

Modified: issm/trunk/src/m/classes/SMBgradients.m
===================================================================
--- issm/trunk/src/m/classes/SMBgradients.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/classes/SMBgradients.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -9,6 +9,7 @@
 		smbref = NaN;
 		b_pos  = NaN;
 		b_neg  = NaN;
+		requested_outputs      = {};
 	end
 	methods
 		function self = SMBgradients(varargin) % {{{
@@ -24,6 +25,9 @@
 			%Nothing for now
 
 		end % }}}
+		function list = defaultoutputs(self,md) % {{{
+			list = {''};
+		end % }}}
 		function self = initialize(self,md) % {{{
 
 			%Nothing done for now
@@ -37,11 +41,12 @@
 		function md = checkconsistency(self,md,solution,analyses) % {{{
 
 			if ismember(MasstransportAnalysisEnum(),analyses),
-				md = checkfield(md,'fieldname','surfaceforcings.href','timeseries',1,'NaN',1);
-				md = checkfield(md,'fieldname','surfaceforcings.smbref','timeseries',1,'NaN',1);
-				md = checkfield(md,'fieldname','surfaceforcings.b_pos','timeseries',1,'NaN',1);
-				md = checkfield(md,'fieldname','surfaceforcings.b_neg','timeseries',1,'NaN',1);
+				md = checkfield(md,'fieldname','smb.href','timeseries',1,'NaN',1,'Inf',1);
+				md = checkfield(md,'fieldname','smb.smbref','timeseries',1,'NaN',1,'Inf',1);
+				md = checkfield(md,'fieldname','smb.b_pos','timeseries',1,'NaN',1,'Inf',1);
+				md = checkfield(md,'fieldname','smb.b_neg','timeseries',1,'NaN',1,'Inf',1);
 			end
+			md = checkfield(md,'fieldname','smb.requested_outputs','stringrow',1);
 		end % }}}
 		function disp(self) % {{{
 			disp(sprintf('   surface forcings parameters:'));
@@ -51,17 +56,27 @@
 			fielddisplay(self,'smbref',' reference smb from which deviation is calculated in smb gradients method [mm/yr water equiv]');
 			fielddisplay(self,'b_pos',' slope of hs - smb regression line for accumulation regime required if smb gradients is activated');
 			fielddisplay(self,'b_neg',' slope of hs - smb regression line for ablation regime required if smb gradients is activated');
+			fielddisplay(self,'requested_outputs','additional outputs requested');
 
 		end % }}}
 		function marshall(self,md,fid) % {{{
 
 			yts=365.0*24.0*3600.0;
 
-			WriteData(fid,'enum',SurfaceforcingsEnum(),'data',SMBgradientsEnum(),'format','Integer');
-			WriteData(fid,'object',self,'class','surfaceforcings','fieldname','href','format','DoubleMat','mattype',1,'timeserieslength',md.mesh.numberofvertices+1);
-			WriteData(fid,'object',self,'class','surfaceforcings','fieldname','smbref','format','DoubleMat','mattype',1,'scale',1./yts,'timeserieslength',md.mesh.numberofvertices+1);
-			WriteData(fid,'object',self,'class','surfaceforcings','fieldname','b_pos','format','DoubleMat','mattype',1,'scale',1./yts,'timeserieslength',md.mesh.numberofvertices+1);
-			WriteData(fid,'object',self,'class','surfaceforcings','fieldname','b_neg','format','DoubleMat','mattype',1,'scale',1./yts,'timeserieslength',md.mesh.numberofvertices+1);
+			WriteData(fid,'enum',SmbEnum(),'data',SMBgradientsEnum(),'format','Integer');
+			WriteData(fid,'object',self,'class','smb','fieldname','href','format','DoubleMat','mattype',1,'timeserieslength',md.mesh.numberofvertices+1);
+			WriteData(fid,'object',self,'class','smb','fieldname','smbref','format','DoubleMat','mattype',1,'scale',1./yts,'timeserieslength',md.mesh.numberofvertices+1);
+			WriteData(fid,'object',self,'class','smb','fieldname','b_pos','format','DoubleMat','mattype',1,'scale',1./yts,'timeserieslength',md.mesh.numberofvertices+1);
+			WriteData(fid,'object',self,'class','smb','fieldname','b_neg','format','DoubleMat','mattype',1,'scale',1./yts,'timeserieslength',md.mesh.numberofvertices+1);
+			
+			%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,'data',outputs,'enum',SmbRequestedOutputsEnum,'format','StringArray');
 
 		end % }}}
 	end

Modified: issm/trunk/src/m/classes/SMBgradients.py
===================================================================
--- issm/trunk/src/m/classes/SMBgradients.py	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/classes/SMBgradients.py	2016-04-13 04:32:01 UTC (rev 20500)
@@ -17,6 +17,7 @@
 		self.smbref  = float('NaN')
 		self.b_pos   = float('NaN')
 		self.b_neg   = float('NaN')
+		self.requested_outputs      = []
 		#}}}
 	def __repr__(self): # {{{
 		string="   surface forcings parameters:"
@@ -26,6 +27,7 @@
 		string="%s\n%s"%(string,fielddisplay(self,'smbref',' reference smb from which deviation is calculated in smb gradients method'))
 		string="%s\n%s"%(string,fielddisplay(self,'b_pos',' slope of hs - smb regression line for accumulation regime required if smb gradients is activated'))
 		string="%s\n%s"%(string,fielddisplay(self,'b_neg',' slope of hs - smb regression line for ablation regime required if smb gradients is activated'))
+		string="%s\n%s"%(string,fielddisplay(self,'requested_outputs','additional outputs requested'))
 
 		return string
 		#}}}
@@ -34,6 +36,9 @@
 		#Nothing for now
 		return self
 	#}}}
+	def defaultoutputs(self,md): # {{{
+		return []
+	#}}}
 	def initialize(self,md): # {{{
 
 		#Nothing for now
@@ -43,20 +48,30 @@
 	def checkconsistency(self,md,solution,analyses):    # {{{
 
 		if MasstransportAnalysisEnum() in analyses:
-			md = checkfield(md,'fieldname','surfaceforcings.href','timeseries',1,'NaN',1)
-			md = checkfield(md,'fieldname','surfaceforcings.smbref','timeseries',1,'NaN',1)
-			md = checkfield(md,'fieldname','surfaceforcings.b_pos','timeseries',1,'NaN',1)
-			md = checkfield(md,'fieldname','surfaceforcings.b_neg','timeseries',1,'NaN',1)
+			md = checkfield(md,'fieldname','smb.href','timeseries',1,'NaN',1,'Inf',1)
+			md = checkfield(md,'fieldname','smb.smbref','timeseries',1,'NaN',1,'Inf',1)
+			md = checkfield(md,'fieldname','smb.b_pos','timeseries',1,'NaN',1,'Inf',1)
+			md = checkfield(md,'fieldname','smb.b_neg','timeseries',1,'NaN',1,'Inf',1)
 
+		md = checkfield(md,'fieldname','masstransport.requested_outputs','stringrow',1)
 		return md
 	# }}}
 	def marshall(self,md,fid):    # {{{
 
 		yts=365.0*24.0*3600.0
 
-		WriteData(fid,'enum',SurfaceforcingsEnum(),'data',SMBgradientsEnum(),'format','Integer');
-		WriteData(fid,'object',self,'class','surfaceforcings','fieldname','href','format','DoubleMat','mattype',1,'timeserieslength',md.mesh.numberofvertices+1)
-		WriteData(fid,'object',self,'class','surfaceforcings','fieldname','smbref','format','DoubleMat','mattype',1,'scale',1./yts,'timeserieslength',md.mesh.numberofvertices+1)
-		WriteData(fid,'object',self,'class','surfaceforcings','fieldname','b_pos','format','DoubleMat','mattype',1,'scale',1./yts,'timeserieslength',md.mesh.numberofvertices+1)
-		WriteData(fid,'object',self,'class','surfaceforcings','fieldname','b_neg','format','DoubleMat','mattype',1,'scale',1./yts,'timeserieslength',md.mesh.numberofvertices+1)
+		WriteData(fid,'enum',SmbEnum(),'data',SMBgradientsEnum(),'format','Integer');
+		WriteData(fid,'object',self,'class','smb','fieldname','href','format','DoubleMat','mattype',1,'timeserieslength',md.mesh.numberofvertices+1)
+		WriteData(fid,'object',self,'class','smb','fieldname','smbref','format','DoubleMat','mattype',1,'scale',1./yts,'timeserieslength',md.mesh.numberofvertices+1)
+		WriteData(fid,'object',self,'class','smb','fieldname','b_pos','format','DoubleMat','mattype',1,'scale',1./yts,'timeserieslength',md.mesh.numberofvertices+1)
+		WriteData(fid,'object',self,'class','smb','fieldname','b_neg','format','DoubleMat','mattype',1,'scale',1./yts,'timeserieslength',md.mesh.numberofvertices+1)
+		
+		#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,'data',outputs,'enum',SmbRequestedOutputsEnum(),'format','StringArray')
+
 	# }}}

Modified: issm/trunk/src/m/classes/SMBhenning.m
===================================================================
--- issm/trunk/src/m/classes/SMBhenning.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/classes/SMBhenning.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -6,6 +6,7 @@
 classdef SMBhenning
 	properties (SetAccess=public) 
 		smbref = NaN;
+		requested_outputs      = {};
 	end
 	methods
 		function self = SMBhenning(varargin) % {{{
@@ -20,33 +21,48 @@
 			self.smbref=project3d(md,'vector',self.smbref,'type','node');
 
 		end % }}}
+		function list = defaultoutputs(self,md) % {{{
+			list = {''};
+		end % }}}
 		function self = initialize(self,md) % {{{
 
 			if isnan(self.smbref)
 				self.smbref=zeros(md.mesh.numberofvertices,1);
-				disp('      no surfaceforcings.smbref specified: values set as zero');
+				disp('      no smb.smbref specified: values set as zero');
 			end
 
 		end % }}}
 		function md = checkconsistency(self,md,solution,analyses) % {{{
 
 			if ismember(MasstransportAnalysisEnum(),analyses),
-				md = checkfield(md,'fieldname','surfaceforcings.smbref','timeseries',1,'NaN',1);
+				md = checkfield(md,'fieldname','smb.smbref','timeseries',1,'NaN',1,'Inf',1);
 			end
 			if ismember(BalancethicknessAnalysisEnum(),analyses),
-				md = checkfield(md,'fieldname','surfaceforcings.smbref','size',[md.mesh.numberofvertices 1],'NaN',1);
+				md = checkfield(md,'fieldname','smb.smbref','size',[md.mesh.numberofvertices 1],'NaN',1,'Inf',1);
 			end
+			md = checkfield(md,'fieldname','smb.requested_outputs','stringrow',1);
 		end % }}}
 		function disp(self) % {{{
 			disp(sprintf('   surface forcings parameters:'));
 			fielddisplay(self,'smbref','reference smb from which deviation is calculated [m/yr ice eq]');
+			fielddisplay(self,'requested_outputs','additional outputs requested');
 		end % }}}
 		function marshall(self,md,fid) % {{{
 
 			yts=365.0*24.0*3600.0;
 
-			WriteData(fid,'enum',SurfaceforcingsEnum(),'data',SMBhenningEnum(),'format','Integer');
-			WriteData(fid,'object',self,'class','surfaceforcings','fieldname','smbref','format','DoubleMat','mattype',1,'scale',1./yts,'timeserieslength',md.mesh.numberofvertices+1);
+			WriteData(fid,'enum',SmbEnum(),'data',SMBhenningEnum(),'format','Integer');
+			WriteData(fid,'object',self,'class','smb','fieldname','smbref','format','DoubleMat','mattype',1,'scale',1./yts,'timeserieslength',md.mesh.numberofvertices+1);
+			
+			%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,'data',outputs,'enum',SmbRequestedOutputsEnum,'format','StringArray');
+
 		end % }}}
 	end
 end

Modified: issm/trunk/src/m/classes/SMBmeltcomponents.m
===================================================================
--- issm/trunk/src/m/classes/SMBmeltcomponents.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/classes/SMBmeltcomponents.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -9,6 +9,7 @@
 		evaporation = NaN;
 		melt = NaN;
 		refreeze = NaN;
+		requested_outputs      = {};
 	end
 	methods
 		function self = SMBmeltcomponents(varargin) % {{{
@@ -26,52 +27,56 @@
 			self.refreeze=project3d(md,'vector',self.refreeze,'type','node');
 
 		end % }}}
+		function list = defaultoutputs(self,md) % {{{
+			list = {''};
+		end % }}}
 		function self = initialize(self,md) % {{{
 
 			if isnan(self.accumulation)
 				self.accumulation=zeros(md.mesh.numberofvertices,1);
-				disp('      no surfaceforcings.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 surfaceforcings.evaporation specified: values set as zero');
+				disp('      no smb.evaporation specified: values set as zero');
 			end
 			if isnan(self.refreeze)
 				self.refreeze=zeros(md.mesh.numberofvertices,1);
-				disp('      no surfaceforcings.refreeze specified: values set as zero');
+				disp('      no smb.refreeze specified: values set as zero');
 			end
 			if isnan(self.melt)
 				self.melt=zeros(md.mesh.numberofvertices,1);
-				disp('      no surfaceforcings.melt specified: values set as zero');
+				disp('      no smb.melt specified: values set as zero');
 			end
 
 		end % }}}
 		function md = checkconsistency(self,md,solution,analyses) % {{{
 
 			if ismember(MasstransportAnalysisEnum(),analyses),
-				md = checkfield(md,'fieldname','surfaceforcings.accumulation','timeseries',1,'NaN',1);
+				md = checkfield(md,'fieldname','smb.accumulation','timeseries',1,'NaN',1,'Inf',1);
 			end
 			if ismember(BalancethicknessAnalysisEnum(),analyses),
-				md = checkfield(md,'fieldname','surfaceforcings.accumulation','size',[md.mesh.numberofvertices 1],'NaN',1);
+				md = checkfield(md,'fieldname','smb.accumulation','size',[md.mesh.numberofvertices 1],'NaN',1,'Inf',1);
 			end
 			if ismember(MasstransportAnalysisEnum(),analyses),
-				md = checkfield(md,'fieldname','surfaceforcings.evaporation','timeseries',1,'NaN',1);
+				md = checkfield(md,'fieldname','smb.evaporation','timeseries',1,'NaN',1,'Inf',1);
 			end
 			if ismember(BalancethicknessAnalysisEnum(),analyses),
-				md = checkfield(md,'fieldname','surfaceforcings.evaporation','size',[md.mesh.numberofvertices 1],'NaN',1);
+				md = checkfield(md,'fieldname','smb.evaporation','size',[md.mesh.numberofvertices 1],'NaN',1,'Inf',1);
 			end
 			if ismember(MasstransportAnalysisEnum(),analyses),
-				md = checkfield(md,'fieldname','surfaceforcings.refreeze','timeseries',1,'NaN',1);
+				md = checkfield(md,'fieldname','smb.refreeze','timeseries',1,'NaN',1,'Inf',1);
 			end
 			if ismember(BalancethicknessAnalysisEnum(),analyses),
-				md = checkfield(md,'fieldname','surfaceforcings.refreeze','size',[md.mesh.numberofvertices 1],'NaN',1);
+				md = checkfield(md,'fieldname','smb.refreeze','size',[md.mesh.numberofvertices 1],'NaN',1,'Inf',1);
 			end
 			if ismember(MasstransportAnalysisEnum(),analyses),
-				md = checkfield(md,'fieldname','surfaceforcings.melt','timeseries',1,'NaN',1);
+				md = checkfield(md,'fieldname','smb.melt','timeseries',1,'NaN',1,'Inf',1);
 			end
 			if ismember(BalancethicknessAnalysisEnum(),analyses),
-				md = checkfield(md,'fieldname','surfaceforcings.melt','size',[md.mesh.numberofvertices 1],'NaN',1);
+				md = checkfield(md,'fieldname','smb.melt','size',[md.mesh.numberofvertices 1],'NaN',1,'Inf',1);
 			end
+			md = checkfield(md,'fieldname','smb.requested_outputs','stringrow',1);
 		end % }}}
 		function disp(self) % {{{
 			disp(sprintf('   surface forcings parameters with melt (SMB=accumulation-evaporation-melt+refreeze) :'));
@@ -79,16 +84,27 @@
 			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,'requested_outputs','additional outputs requested');
 		end % }}}
 		function marshall(self,md,fid) % {{{
 
 			yts=365.0*24.0*3600.0;
 
-			WriteData(fid,'enum',SurfaceforcingsEnum(),'data',SMBmeltcomponentsEnum(),'format','Integer');
-			WriteData(fid,'object',self,'class','surfaceforcings','fieldname','accumulation','format','DoubleMat','mattype',1,'scale',1./yts,'timeserieslength',md.mesh.numberofvertices+1);
-			WriteData(fid,'object',self,'class','surfaceforcings','fieldname','evaporation','format','DoubleMat','mattype',1,'scale',1./yts,'timeserieslength',md.mesh.numberofvertices+1);
-			WriteData(fid,'object',self,'class','surfaceforcings','fieldname','melt','format','DoubleMat','mattype',1,'scale',1./yts,'timeserieslength',md.mesh.numberofvertices+1);
-			WriteData(fid,'object',self,'class','surfaceforcings','fieldname','refreeze','format','DoubleMat','mattype',1,'scale',1./yts,'timeserieslength',md.mesh.numberofvertices+1);
+			WriteData(fid,'enum',SmbEnum(),'data',SMBmeltcomponentsEnum(),'format','Integer');
+			WriteData(fid,'object',self,'class','smb','fieldname','accumulation','format','DoubleMat','mattype',1,'scale',1./yts,'timeserieslength',md.mesh.numberofvertices+1);
+			WriteData(fid,'object',self,'class','smb','fieldname','evaporation','format','DoubleMat','mattype',1,'scale',1./yts,'timeserieslength',md.mesh.numberofvertices+1);
+			WriteData(fid,'object',self,'class','smb','fieldname','melt','format','DoubleMat','mattype',1,'scale',1./yts,'timeserieslength',md.mesh.numberofvertices+1);
+			WriteData(fid,'object',self,'class','smb','fieldname','refreeze','format','DoubleMat','mattype',1,'scale',1./yts,'timeserieslength',md.mesh.numberofvertices+1);
+			
+			%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,'data',outputs,'enum',SmbRequestedOutputsEnum,'format','StringArray');
+
 		end % }}}
 	end
 end

Modified: issm/trunk/src/m/classes/SMBmeltcomponents.py
===================================================================
--- issm/trunk/src/m/classes/SMBmeltcomponents.py	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/classes/SMBmeltcomponents.py	2016-04-13 04:32:01 UTC (rev 20500)
@@ -16,6 +16,7 @@
 		self.accumulation = float('NaN')
 		self.runoff = float('NaN')
 		self.evaporation = float('NaN')
+		self.requested_outputs      = []
 		#}}}
 	def __repr__(self): # {{{
 		string="   surface forcings parameters with melt (SMB=accumulation-evaporation-melt+refreeze) :"
@@ -23,6 +24,7 @@
 		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,'requested_outputs','additional outputs requested'))
 		return string
 		#}}}
 	def extrude(self,md): # {{{
@@ -33,6 +35,9 @@
 		self.mass_balance=project3d(md,'vector',self.refreeze,'type','node');
 		return self
 	#}}}
+	def defaultoutputs(self,md): # {{{
+		return []
+	#}}}
 	def initialize(self,md): # {{{
 
 		if numpy.all(numpy.isnan(self.accumulation)):
@@ -56,38 +61,48 @@
 	def checkconsistency(self,md,solution,analyses):    # {{{
 
 		if MasstransportAnalysisEnum() in analyses:
-			md = checkfield(md,'fieldname','surfaceforcings.accumulation','timeseries',1,'NaN',1)
+			md = checkfield(md,'fieldname','smb.accumulation','timeseries',1,'NaN',1,'Inf',1)
 
 		if BalancethicknessAnalysisEnum() in analyses:
-			md = checkfield(md,'fieldname','surfaceforcings.accumulation','size',[md.mesh.numberofvertices],'NaN',1)
+			md = checkfield(md,'fieldname','smb.accumulation','size',[md.mesh.numberofvertices],'NaN',1,'Inf',1)
 
 		if MasstransportAnalysisEnum() in analyses:
-			md = checkfield(md,'fieldname','surfaceforcings.melt','timeseries',1,'NaN',1)
+			md = checkfield(md,'fieldname','smb.melt','timeseries',1,'NaN',1,'Inf',1)
 
 		if BalancethicknessAnalysisEnum() in analyses:
-			md = checkfield(md,'fieldname','surfaceforcings.melt','size',[md.mesh.numberofvertices],'NaN',1)
+			md = checkfield(md,'fieldname','smb.melt','size',[md.mesh.numberofvertices],'NaN',1,'Inf',1)
 
 		if MasstransportAnalysisEnum() in analyses:
-			md = checkfield(md,'fieldname','surfaceforcings.refreeze','timeseries',1,'NaN',1)
+			md = checkfield(md,'fieldname','smb.refreeze','timeseries',1,'NaN',1,'Inf',1)
 
 		if BalancethicknessAnalysisEnum() in analyses:
-			md = checkfield(md,'fieldname','surfaceforcings.refreeze','size',[md.mesh.numberofvertices],'NaN',1)
+			md = checkfield(md,'fieldname','smb.refreeze','size',[md.mesh.numberofvertices],'NaN',1,'Inf',1)
 
 		if MasstransportAnalysisEnum() in analyses:
-			md = checkfield(md,'fieldname','surfaceforcings.evaporation','timeseries',1,'NaN',1)
+			md = checkfield(md,'fieldname','smb.evaporation','timeseries',1,'NaN',1,'Inf',1)
 
 		if BalancethicknessAnalysisEnum() in analyses:
-			md = checkfield(md,'fieldname','surfaceforcings.evaporation','size',[md.mesh.numberofvertices],'NaN',1)
+			md = checkfield(md,'fieldname','smb.evaporation','size',[md.mesh.numberofvertices],'NaN',1,'Inf',1)
 
+		md = checkfield(md,'fieldname','masstransport.requested_outputs','stringrow',1)
 		return md
 	# }}}
 	def marshall(self,md,fid):    # {{{
 
 		yts=365.0*24.0*3600.0
 
-		WriteData(fid,'enum',SurfaceforcingsEnum(),'data',SMBmeltcomponentsEnum(),'format','Integer');
-		WriteData(fid,'object',self,'class','surfaceforcings','fieldname','accumulation','format','DoubleMat','mattype',1,'scale',1./yts,'timeserieslength',md.mesh.numberofvertices+1)
-		WriteData(fid,'object',self,'class','surfaceforcings','fieldname','evaporation','format','DoubleMat','mattype',1,'scale',1./yts,'timeserieslength',md.mesh.numberofvertices+1)
-		WriteData(fid,'object',self,'class','surfaceforcings','fieldname','melt','format','DoubleMat','mattype',1,'scale',1./yts,'timeserieslength',md.mesh.numberofvertices+1)
-		WriteData(fid,'object',self,'class','surfaceforcings','fieldname','refreeze','format','DoubleMat','mattype',1,'scale',1./yts,'timeserieslength',md.mesh.numberofvertices+1)
+		WriteData(fid,'enum',SmbEnum(),'data',SMBmeltcomponentsEnum(),'format','Integer');
+		WriteData(fid,'object',self,'class','smb','fieldname','accumulation','format','DoubleMat','mattype',1,'scale',1./yts,'timeserieslength',md.mesh.numberofvertices+1)
+		WriteData(fid,'object',self,'class','smb','fieldname','evaporation','format','DoubleMat','mattype',1,'scale',1./yts,'timeserieslength',md.mesh.numberofvertices+1)
+		WriteData(fid,'object',self,'class','smb','fieldname','melt','format','DoubleMat','mattype',1,'scale',1./yts,'timeserieslength',md.mesh.numberofvertices+1)
+		WriteData(fid,'object',self,'class','smb','fieldname','refreeze','format','DoubleMat','mattype',1,'scale',1./yts,'timeserieslength',md.mesh.numberofvertices+1)
+		
+		#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,'data',outputs,'enum',SmbRequestedOutputsEnum(),'format','StringArray')
+
 	# }}}

Modified: issm/trunk/src/m/classes/SMBpdd.m
===================================================================
--- issm/trunk/src/m/classes/SMBpdd.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/classes/SMBpdd.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -8,10 +8,10 @@
 		precipitation             = NaN;
 		monthlytemperatures       = NaN;
 		desfac                    = 0;
-		s0p                       = 0;
-		s0t                       = 0;
+		s0p                       = NaN;
+		s0t                       = NaN;
 		rlaps                     = 0;
-		rlapslgm                  = 0;                
+		rlapslgm                  = 0; 
 		Pfac                      = NaN;
 		Tdiff                     = NaN;
 		sealev                    = NaN;
@@ -23,6 +23,7 @@
 		temperatures_lgm          = NaN;
 		precipitations_presentday = NaN;
 		precipitations_lgm        = NaN;
+		requested_outputs      = {};
 	end
 	methods
 		function self = SMBpdd(varargin) % {{{
@@ -44,14 +45,23 @@
 			if(self.ismungsm),self.temperatures_presentday=project3d(md,'vector',self.temperatures_presentday,'type','node');end
 			if(self.ismungsm),self.precipitations_presentday=project3d(md,'vector',self.precipitations_presentday,'type','node');end
 			if(self.ismungsm),self.precipitations_lgm=project3d(md,'vector',self.precipitations_lgm,'type','node');end
+			self.s0p=project3d(md,'vector',self.s0p,'type','node');
+			self.s0t=project3d(md,'vector',self.s0t,'type','node');
 
 		end % }}}
+		function list = defaultoutputs(self,md) % {{{
+			list = {''};
+		end % }}}
 		function self = initialize(self,md) % {{{
                     
-			% if isnan(self.precipitation),
-			% 	self.precipitation=zeros(md.mesh.numberofvertices,1);
-			% 	disp('      no SMBpdd.precipitation specified: values set as zero');
-			% end
+			if isnan(self.s0p),
+				self.s0p=zeros(md.mesh.numberofvertices,1);
+				disp('      no SMBpdd.s0p specified: values set as zero');
+			end
+			if isnan(self.s0t),
+				self.s0t=zeros(md.mesh.numberofvertices,1);
+				disp('      no SMBpdd.s0t specified: values set as zero');
+			end
 
 		end % }}}
 		function self = setdefaultparameters(self) % {{{
@@ -59,8 +69,6 @@
 		  self.isdelta18o = 0;
 		  self.ismungsm   = 0;
 		  self.desfac     = 0.5;
-		  self.s0p        = 0;
-		  self.s0t        = 0;
 		  self.rlaps      = 6.5;
 		  self.rlapslgm   = 6.5;
                   
@@ -68,33 +76,35 @@
 		function md = checkconsistency(self,md,solution,analyses) % {{{
 
 			if ismember(MasstransportAnalysisEnum(),analyses),
-				md = checkfield(md,'fieldname','surfaceforcings.desfac','<=',1,'numel',1);
-				md = checkfield(md,'fieldname','surfaceforcings.s0p','>=',0,'numel',1);
-				md = checkfield(md,'fieldname','surfaceforcings.s0t','>=',0,'numel',1);
-				md = checkfield(md,'fieldname','surfaceforcings.rlaps','>=',0,'numel',1);
-				md = checkfield(md,'fieldname','surfaceforcings.rlapslgm','>=',0,'numel',1);
+				md = checkfield(md,'fieldname','smb.desfac','<=',1,'numel',1);
+				md = checkfield(md,'fieldname','smb.s0p','>=',0,'NaN',1,'Inf',1,'size',[md.mesh.numberofvertices 1]);
+				md = checkfield(md,'fieldname','smb.s0t','>=',0,'NaN',1,'Inf',1,'size',[md.mesh.numberofvertices 1]);
+				md = checkfield(md,'fieldname','smb.rlaps','>=',0,'numel',1);
+				md = checkfield(md,'fieldname','smb.rlapslgm','>=',0,'numel',1);
 				if(self.isdelta18o==0 & self.ismungsm==0)
-					md = checkfield(md,'fieldname','surfaceforcings.monthlytemperatures','timeseries',1,'NaN',1);
-					md = checkfield(md,'fieldname','surfaceforcings.precipitation','timeseries',1,'NaN',1);
+					md = checkfield(md,'fieldname','smb.monthlytemperatures','timeseries',1,'NaN',1,'Inf',1);
+					md = checkfield(md,'fieldname','smb.precipitation','timeseries',1,'NaN',1,'Inf',1);
 				elseif(self.isdelta18o==1) 
-					md = checkfield(md,'fieldname','surfaceforcings.delta18o','NaN',1);
-					md = checkfield(md,'fieldname','surfaceforcings.delta18o_surface','NaN',1);
-					md = checkfield(md,'fieldname','surfaceforcings.temperatures_presentday','size',[md.mesh.numberofvertices+1 12],'NaN',1);
-					md = checkfield(md,'fieldname','surfaceforcings.temperatures_lgm','size',[md.mesh.numberofvertices+1 12],'NaN',1);
-					md = checkfield(md,'fieldname','surfaceforcings.precipitations_presentday','size',[md.mesh.numberofvertices+1 12],'NaN',1);
-					md = checkfield(md,'fieldname','surfaceforcings.precipitations_lgm','size',[md.mesh.numberofvertices+1 12],'NaN',1);                                       
-					md = checkfield(md,'fieldname','surfaceforcings.Tdiff','NaN',1);
-					md = checkfield(md,'fieldname','surfaceforcings.sealev','NaN',1);
+					md = checkfield(md,'fieldname','smb.delta18o','NaN',1,'Inf',1,'size',[2,NaN],'singletimeseries',1);
+					md = checkfield(md,'fieldname','smb.delta18o_surface','NaN',1,'Inf',1,'size',[2,NaN],'singletimeseries',1);
+					md = checkfield(md,'fieldname','smb.temperatures_presentday','size',[md.mesh.numberofvertices+1 12],'NaN',1,'Inf',1,'timeseries',1);
+					md = checkfield(md,'fieldname','smb.temperatures_lgm','size',[md.mesh.numberofvertices+1 12],'NaN',1,'Inf',1,'timeseries',1);
+					md = checkfield(md,'fieldname','smb.precipitations_presentday','size',[md.mesh.numberofvertices+1 12],'NaN',1,'Inf',1,'timeseries',1);
+					md = checkfield(md,'fieldname','smb.precipitations_lgm','size',[md.mesh.numberofvertices+1 12],'NaN',1,'Inf',1,'timeseries',1);                                       
+					md = checkfield(md,'fieldname','smb.Tdiff','NaN',1,'Inf',1,'size',[2,NaN],'singletimeseries',1);
+					md = checkfield(md,'fieldname','smb.sealev','NaN',1,'Inf',1,'size',[2,NaN],'singletimeseries',1);
 				elseif(self.ismungsm==1) 
-					md = checkfield(md,'fieldname','surfaceforcings.temperatures_presentday','size',[md.mesh.numberofvertices+1 12],'NaN',1);
-					md = checkfield(md,'fieldname','surfaceforcings.temperatures_lgm','size',[md.mesh.numberofvertices+1 12],'NaN',1);
-					md = checkfield(md,'fieldname','surfaceforcings.precipitations_presentday','size',[md.mesh.numberofvertices+1 12],'NaN',1);
-					md = checkfield(md,'fieldname','surfaceforcings.precipitations_lgm','size',[md.mesh.numberofvertices+1 12],'NaN',1);                                       
-					md = checkfield(md,'fieldname','surfaceforcings.Pfac','NaN',1,'size',[2,NaN]);
-					md = checkfield(md,'fieldname','surfaceforcings.Tdiff','NaN',1);
-					md = checkfield(md,'fieldname','surfaceforcings.sealev','NaN',1);
+					md = checkfield(md,'fieldname','smb.temperatures_presentday','size',[md.mesh.numberofvertices+1 12],'NaN',1,'Inf',1,'timeseries',1);
+					md = checkfield(md,'fieldname','smb.temperatures_lgm','size',[md.mesh.numberofvertices+1 12],'NaN',1,'Inf',1,'timeseries',1);
+					md = checkfield(md,'fieldname','smb.precipitations_presentday','size',[md.mesh.numberofvertices+1 12],'NaN',1,'Inf',1,'timeseries',1);
+					md = checkfield(md,'fieldname','smb.precipitations_lgm','size',[md.mesh.numberofvertices+1 12],'NaN',1,'Inf',1,'timeseries',1);                                       
+					md = checkfield(md,'fieldname','smb.Pfac','NaN',1,'Inf',1,'size',[2,NaN],'singletimeseries',1);
+					md = checkfield(md,'fieldname','smb.Tdiff','NaN',1,'Inf',1,'size',[2,NaN],'singletimeseries',1);
+					md = checkfield(md,'fieldname','smb.sealev','NaN',1,'Inf',1,'size',[2,NaN],'singletimeseries',1);
 				end
 			end
+			md = checkfield(md,'fieldname','smb.requested_outputs','stringrow',1);
+			
 		end % }}}
 		function disp(self) % {{{
 			disp(sprintf('   surface forcings parameters:'));
@@ -107,64 +117,75 @@
 			fielddisplay(self,'s0t','should be set to elevation from temperature source (between 0 and a few 1000s m, default is 0) [m]');
 			fielddisplay(self,'rlaps','present day lapse rate [degree/km]');
 			fielddisplay(self,'rlapslgm','LGM lapse rate [degree/km]');
-                        if(self.isdelta18o==0 & self.ismungsm==0)
-                            fielddisplay(self,'monthlytemperatures',['monthly surface temperatures [K], required if pdd is activated and delta18o not activated']);
-                            fielddisplay(self,'precipitation',['monthly surface precipitation [m/yr water eq], required if pdd is activated and delta18o or mungsm not activated']);
-                        elseif(self.isdelta18o==1)
-                            fielddisplay(self,'delta18o','delta18o, required if pdd is activated and delta18o activated');
-                            fielddisplay(self,'delta18o_surface','surface elevation of the delta18o site, required if pdd is activated and delta18o activated');
-                            fielddisplay(self,'temperatures_presentday','monthly present day surface temperatures [K], required if delta18o/mungsm is activated');
-                            fielddisplay(self,'temperatures_lgm','monthly LGM surface temperatures [K], required if delta18o or mungsm is activated');
-                            fielddisplay(self,'precipitations_presentday','monthly surface precipitation [m/yr water eq], required if delta18o or mungsm is activated');
-                            fielddisplay(self,'precipitations_lgm','monthly surface precipitation [m/yr water eq], required if delta18o or mungsm is activated');
-                            fielddisplay(self,'Tdiff','time interpolation parameter for temperature, 1D(year), required if mungsm is activated');
-                            fielddisplay(self,'sealev','sea level [m], 1D(year), required if mungsm is activated');
-                        elseif(self.ismungsm==1)
-                            fielddisplay(self,'temperatures_presentday','monthly present day surface temperatures [K], required if delta18o/mungsm is activated');
-                            fielddisplay(self,'temperatures_lgm','monthly LGM surface temperatures [K], required if delta18o or mungsm is activated');
-                            fielddisplay(self,'precipitations_presentday','monthly surface precipitation [m/yr water eq], required if delta18o or mungsm is activated');
-                            fielddisplay(self,'precipitations_lgm','monthly surface precipitation [m/yr water eq], required if delta18o or mungsm is activated');
-                            fielddisplay(self,'Pfac','time interpolation parameter for precipitation, 1D(year), required if mungsm is activated');
-                            fielddisplay(self,'Tdiff','time interpolation parameter for temperature, 1D(year), required if mungsm is activated');
-                            fielddisplay(self,'sealev','sea level [m], 1D(year), required if mungsm is activated');
-                        end
+			if(self.isdelta18o==0 & self.ismungsm==0)
+				fielddisplay(self,'monthlytemperatures',['monthly surface temperatures [K], required if pdd is activated and delta18o not activated']);
+				fielddisplay(self,'precipitation',['monthly surface precipitation [m/yr water eq], required if pdd is activated and delta18o or mungsm not activated']);
+			elseif(self.isdelta18o==1)
+				fielddisplay(self,'delta18o','delta18o [per mil], required if pdd is activated and delta18o activated');
+				fielddisplay(self,'delta18o_surface','surface elevation of the delta18o site, required if pdd is activated and delta18o activated');
+				fielddisplay(self,'temperatures_presentday','monthly present day surface temperatures [K], required if delta18o/mungsm is activated');
+				fielddisplay(self,'temperatures_lgm','monthly LGM surface temperatures [K], required if delta18o or mungsm is activated');
+				fielddisplay(self,'precipitations_presentday','monthly surface precipitation [m/yr water eq], required if delta18o/mungsm is activated');
+				fielddisplay(self,'precipitations_lgm','monthly surface precipitation [m/yr water eq], required if delta18o/mungsm is activated');
+				fielddisplay(self,'Tdiff','time interpolation parameter for temperature, 1D(year), required if mungsm is activated');
+				fielddisplay(self,'sealev','sea level [m], 1D(year), required if mungsm is activated');
+			elseif(self.ismungsm==1)
+				fielddisplay(self,'temperatures_presentday','monthly present day surface temperatures [K], required if delta18o/mungsm is activated');
+				fielddisplay(self,'temperatures_lgm','monthly LGM surface temperatures [K], required if delta18o or mungsm is activated');
+				fielddisplay(self,'precipitations_presentday','monthly surface precipitation [m/yr water eq], required if delta18o/mungsm is activated');
+				fielddisplay(self,'precipitations_lgm','monthly surface precipitation [m/yr water eq], required if delta18o/mungsm is activated');
+				fielddisplay(self,'Pfac','time interpolation parameter for precipitation, 1D(year), required if mungsm is activated');
+				fielddisplay(self,'Tdiff','time interpolation parameter for temperature, 1D(year), required if mungsm is activated');
+				fielddisplay(self,'sealev','sea level [m], 1D(year), required if mungsm is activated');
+			end
+			fielddisplay(self,'requested_outputs','additional outputs requested');
 		end % }}}
 		function marshall(self,md,fid) % {{{
 
 			yts=365.0*24.0*3600.0;
 
-			WriteData(fid,'enum',SurfaceforcingsEnum(),'data',SMBpddEnum(),'format','Integer');
+			WriteData(fid,'enum',SmbEnum(),'data',SMBpddEnum(),'format','Integer');
 
-			WriteData(fid,'object',self,'class','surfaceforcings','fieldname','isdelta18o','format','Boolean');
-			WriteData(fid,'object',self,'class','surfaceforcings','fieldname','ismungsm','format','Boolean');
-			WriteData(fid,'object',self,'class','surfaceforcings','fieldname','desfac','format','Double');
-			WriteData(fid,'object',self,'class','surfaceforcings','fieldname','s0p','format','Double');
-			WriteData(fid,'object',self,'class','surfaceforcings','fieldname','s0t','format','Double');
-			WriteData(fid,'object',self,'class','surfaceforcings','fieldname','rlaps','format','Double');
-			WriteData(fid,'object',self,'class','surfaceforcings','fieldname','rlapslgm','format','Double');
+			WriteData(fid,'object',self,'class','smb','fieldname','isdelta18o','format','Boolean');
+			WriteData(fid,'object',self,'class','smb','fieldname','ismungsm','format','Boolean');
+			WriteData(fid,'object',self,'class','smb','fieldname','desfac','format','Double');
+			WriteData(fid,'object',self,'class','smb','fieldname','s0p','format','DoubleMat','mattype',1);
+			WriteData(fid,'object',self,'class','smb','fieldname','s0t','format','DoubleMat','mattype',1);
+			WriteData(fid,'object',self,'class','smb','fieldname','rlaps','format','Double');
+			WriteData(fid,'object',self,'class','smb','fieldname','rlapslgm','format','Double');
 
 			if(self.isdelta18o==0 & self.ismungsm==0)
-				%WriteData(fid,'object',self,'class','surfaceforcings','fieldname','monthlytemperatures','format','DoubleMat','mattype',1);
-				WriteData(fid,'object',self,'class','surfaceforcings','fieldname','monthlytemperatures','format','DoubleMat','mattype',1,'timeserieslength',md.mesh.numberofvertices+1);
-				WriteData(fid,'object',self,'class','surfaceforcings','fieldname','precipitation','format','DoubleMat','mattype',1,'scale',1./yts,'timeserieslength',md.mesh.numberofvertices+1);
+				%WriteData(fid,'object',self,'class','smb','fieldname','monthlytemperatures','format','DoubleMat','mattype',1);
+				WriteData(fid,'object',self,'class','smb','fieldname','monthlytemperatures','format','DoubleMat','mattype',1,'timeserieslength',md.mesh.numberofvertices+1);
+				WriteData(fid,'object',self,'class','smb','fieldname','precipitation','format','DoubleMat','mattype',1,'scale',1./yts,'timeserieslength',md.mesh.numberofvertices+1);
 			elseif self.isdelta18o
-				WriteData(fid,'object',self,'class','surfaceforcings','fieldname','temperatures_presentday','format','DoubleMat','mattype',1);
-				WriteData(fid,'object',self,'class','surfaceforcings','fieldname','temperatures_lgm','format','DoubleMat','mattype',1);
-				WriteData(fid,'object',self,'class','surfaceforcings','fieldname','precipitations_presentday','format','DoubleMat','mattype',1);
-				WriteData(fid,'object',self,'class','surfaceforcings','fieldname','precipitations_lgm','format','DoubleMat','mattype',1);
-				WriteData(fid,'object',self,'class','surfaceforcings','fieldname','delta18o_surface','format','DoubleMat','mattype',1);
-				WriteData(fid,'object',self,'class','surfaceforcings','fieldname','delta18o','format','DoubleMat','mattype',1);
-				WriteData(fid,'object',self,'class','surfaceforcings','fieldname','Tdiff','format','DoubleMat','mattype',1);
-				WriteData(fid,'object',self,'class','surfaceforcings','fieldname','sealev','format','DoubleMat','mattype',1);
+				WriteData(fid,'object',self,'class','smb','fieldname','temperatures_presentday','format','DoubleMat','mattype',1,'timeserieslength',md.mesh.numberofvertices+1);
+				WriteData(fid,'object',self,'class','smb','fieldname','temperatures_lgm','format','DoubleMat','mattype',1,'timeserieslength',md.mesh.numberofvertices+1);
+				WriteData(fid,'object',self,'class','smb','fieldname','precipitations_presentday','format','DoubleMat','mattype',1,'scale',1./yts,'timeserieslength',md.mesh.numberofvertices+1);
+				WriteData(fid,'object',self,'class','smb','fieldname','precipitations_lgm','format','DoubleMat','mattype',1,'scale',1./yts,'timeserieslength',md.mesh.numberofvertices+1);
+				WriteData(fid,'object',self,'class','smb','fieldname','delta18o_surface','format','DoubleMat','mattype',1,'timeserieslength',2);
+				WriteData(fid,'object',self,'class','smb','fieldname','delta18o','format','DoubleMat','mattype',1,'timeserieslength',2);
+				WriteData(fid,'object',self,'class','smb','fieldname','Tdiff','format','DoubleMat','mattype',1,'timeserieslength',2);
+				WriteData(fid,'object',self,'class','smb','fieldname','sealev','format','DoubleMat','mattype',1,'timeserieslength',2);
 			elseif self.ismungsm
-				WriteData(fid,'object',self,'class','surfaceforcings','fieldname','temperatures_presentday','format','DoubleMat','mattype',1);
-				WriteData(fid,'object',self,'class','surfaceforcings','fieldname','temperatures_lgm','format','DoubleMat','mattype',1);
-				WriteData(fid,'object',self,'class','surfaceforcings','fieldname','precipitations_presentday','format','DoubleMat','mattype',1);
-				WriteData(fid,'object',self,'class','surfaceforcings','fieldname','precipitations_lgm','format','DoubleMat','mattype',1);
-				WriteData(fid,'object',self,'class','surfaceforcings','fieldname','Pfac','format','DoubleMat','mattype',1);
-				WriteData(fid,'object',self,'class','surfaceforcings','fieldname','Tdiff','format','DoubleMat','mattype',1);
-				WriteData(fid,'object',self,'class','surfaceforcings','fieldname','sealev','format','DoubleMat','mattype',1);
+				WriteData(fid,'object',self,'class','smb','fieldname','temperatures_presentday','format','DoubleMat','mattype',1,'timeserieslength',md.mesh.numberofvertices+1);
+				WriteData(fid,'object',self,'class','smb','fieldname','temperatures_lgm','format','DoubleMat','mattype',1,'timeserieslength',md.mesh.numberofvertices+1);
+				WriteData(fid,'object',self,'class','smb','fieldname','precipitations_presentday','format','DoubleMat','mattype',1,'scale',1./yts,'timeserieslength',md.mesh.numberofvertices+1);
+				WriteData(fid,'object',self,'class','smb','fieldname','precipitations_lgm','format','DoubleMat','mattype',1,'scale',1./yts,'timeserieslength',md.mesh.numberofvertices+1);
+				WriteData(fid,'object',self,'class','smb','fieldname','Pfac','format','DoubleMat','mattype',1,'timeserieslength',2);
+				WriteData(fid,'object',self,'class','smb','fieldname','Tdiff','format','DoubleMat','mattype',1,'timeserieslength',2);
+				WriteData(fid,'object',self,'class','smb','fieldname','sealev','format','DoubleMat','mattype',1,'timeserieslength',2);
 			end
+			
+			%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,'data',outputs,'enum',SmbRequestedOutputsEnum,'format','StringArray');
+
 		end % }}}
 	end
 end

Modified: issm/trunk/src/m/classes/SMBpdd.py
===================================================================
--- issm/trunk/src/m/classes/SMBpdd.py	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/classes/SMBpdd.py	2016-04-13 04:32:01 UTC (rev 20500)
@@ -17,8 +17,8 @@
 		self.precipitation             = float('NaN')
 		self.monthlytemperatures       = float('NaN')
 		self.desfac                    = 0.
-		self.s0p                       = 0.
-		self.s0t                       = 0.
+		self.s0p                       = float('NaN')
+		self.s0t                       = float('NaN')
 		self.rlaps                     = 0.
 		self.rlapslgm                  = 0.
 		self.Pfac                      = float('NaN')
@@ -35,6 +35,7 @@
 
 		#set defaults
 		self.setdefaultparameters()
+		self.requested_outputs      = []
 		#}}}
 	def __repr__(self): # {{{
 		string="   surface forcings parameters:"
@@ -50,7 +51,7 @@
 			string="%s\n%s"%(string,fielddisplay(self,'monthlytemperatures',['monthly surface temperatures [K], required if pdd is activated and delta18o not activated']))
 			string="%s\n%s"%(string,fielddisplay(self,'precipitation',['monthly surface precipitation [m/yr water eq], required if pdd is activated and delta18o or mungsm not activated']))
 			if self.isdelta18o:
-				string="%s\n%s"%(string,fielddisplay(self,'delta18o','delta18o, required if pdd is activated and delta18o activated'))
+				string="%s\n%s"%(string,fielddisplay(self,'delta18o','delta18o [per mil], required if pdd is activated and delta18o activated'))
 				string="%s\n%s"%(string,fielddisplay(self,'delta18o_surface','surface elevation of the delta18o site, required if pdd is activated and delta18o activated'))
 				string="%s\n%s"%(string,fielddisplay(self,'temperatures_presentday','monthly present day surface temperatures [K], required if delta18o/mungsm is activated'))
 				string="%s\n%s"%(string,fielddisplay(self,'temperatures_lgm','monthly LGM surface temperatures [K], required if delta18o or mungsm is activated'))
@@ -66,8 +67,10 @@
 				string="%s\n%s"%(string,fielddisplay(self,'Pfac','time interpolation parameter for precipitation, 1D(year), required if mungsm is activated'))
 				string="%s\n%s"%(string,fielddisplay(self,'Tdiff','time interpolation parameter for temperature, 1D(year), required if mungsm is activated'))
 				string="%s\n%s"%(string,fielddisplay(self,'sealev','sea level [m], 1D(year), required if mungsm is activated'))
+		string="%s\n%s"%(string,fielddisplay(self,'requested_outputs','additional outputs requested'))
+				
 		return string
-		#}}}
+	# }}}
 	def extrude(self,md): # {{{
 
 		if not (self.isdelta18o and self.ismungsm):
@@ -81,15 +84,25 @@
 		if self.ismungsm: self.temperatures_presentday=project3d(md,'vector',self.temperatures_presentday,'type','node')
 		if self.ismungsm: self.precipitations_presentday=project3d(md,'vector',self.precipitations_presentday,'type','node')
 		if self.ismungsm: self.precipitations_lgm=project3d(md,'vector',self.precipitations_lgm,'type','node')
+		self.s0p=project3d(md,'vector',self.s0p,'type','node')
+		self.s0t=project3d(md,'vector',self.s0t,'type','node')
+
 		return self
 	#}}}
+	def defaultoutputs(self,md): # {{{
+		return []
+	#}}}
 	def initialize(self,md): # {{{
 
-		# if numpy.all(numpy.isnan(self.precipitation)):
-		# 	self.precipitation=numpy.zeros((md.mesh.numberofvertices,1))
-		# 	print "      no SMBpdd.precipitation specified: values set as zero"
-		# 
-		 return self
+		if numpy.all(numpy.isnan(self.s0p)):
+			self.s0p=numpy.zeros((md.mesh.numberofvertices,1))
+			print "      no SMBpdd.s0p specified: values set as zero"
+
+		if numpy.all(numpy.isnan(self.s0t)):
+			self.s0t=numpy.zeros((md.mesh.numberofvertices,1))
+			print "      no SMBpdd.s0t specified: values set as zero"
+
+		return self
 	#}}}
 	def setdefaultparameters(self): # {{{
 
@@ -97,8 +110,6 @@
 		self.isdelta18o = 0
 		self.ismungsm   = 0
 		self.desfac     = 0.5
-		self.s0p        = 0.
-		self.s0t        = 0.
 		self.rlaps      = 6.5 
 		self.rlapslgm   = 6.5
 
@@ -107,67 +118,77 @@
 	def checkconsistency(self,md,solution,analyses):    # {{{
 
 		if MasstransportAnalysisEnum() in analyses:
-			md = checkfield(md,'fieldname','surfaceforcings.desfac','<=',1,'numel',[1])
-			md = checkfield(md,'fieldname','surfaceforcings.s0p','>=',0,'numel',[1])
-			md = checkfield(md,'fieldname','surfaceforcings.s0t','>=',0,'numel',[1])
-			md = checkfield(md,'fieldname','surfaceforcings.rlaps','>=',0,'numel',[1])
-			md = checkfield(md,'fieldname','surfaceforcings.rlapslgm','>=',0,'numel',[1])
+			md = checkfield(md,'fieldname','smb.desfac','<=',1,'numel',[1])
+			md = checkfield(md,'fieldname','smb.s0p','>=',0,'NaN',1,'Inf',1,'size',[md.mesh.numberofvertices,1])
+			md = checkfield(md,'fieldname','smb.s0t','>=',0,'NaN',1,'Inf',1,'size',[md.mesh.numberofvertices,1])
+			md = checkfield(md,'fieldname','smb.rlaps','>=',0,'numel',[1])
+			md = checkfield(md,'fieldname','smb.rlapslgm','>=',0,'numel',[1])
 
 			if (self.isdelta18o==0 and self.ismungsm==0):
-				md = checkfield(md,'fieldname','surfaceforcings.monthlytemperatures','NaN',1)
-				md = checkfield(md,'fieldname','surfaceforcings.precipitation','NaN',1)
+				md = checkfield(md,'fieldname','smb.monthlytemperatures','NaN',1,'Inf',1,'timeseries',1)
+				md = checkfield(md,'fieldname','smb.precipitation','NaN',1,'Inf',1,'timeseries',1)
 			elif self.isdelta18o:
-				md = checkfield(md,'fieldname','surfaceforcings.delta18o','NaN',1)
-				md = checkfield(md,'fieldname','surfaceforcings.delta18o_surface','NaN',1)
-				md = checkfield(md,'fieldname','surfaceforcings.temperatures_presentday','size',[md.mesh.numberofvertices+1,12],'NaN',1)
-				md = checkfield(md,'fieldname','surfaceforcings.temperatures_lgm','size',[md.mesh.numberofvertices+1,12],'NaN',1)
-				md = checkfield(md,'fieldname','surfaceforcings.precipitations_presentday','size',[md.mesh.numberofvertices+1,12],'NaN',1)
-				md = checkfield(md,'fieldname','surfaceforcings.precipitations_lgm','size',[md.mesh.numberofvertices+1,12],'NaN',1)                                       
-				md = checkfield(md,'fieldname','surfaceforcings.Tdiff','NaN',1,'size',[2,numpy.nan])
-				md = checkfield(md,'fieldname','surfaceforcings.sealev','NaN',1,'size',[2,numpy.nan])
+				md = checkfield(md,'fieldname','smb.delta18o','NaN',1,'Inf',1,'size',[2,numpy.nan],'singletimeseries',1)
+				md = checkfield(md,'fieldname','smb.delta18o_surface','NaN',1,'Inf',1,'size',[2,numpy.nan],'singletimeseries',1)
+				md = checkfield(md,'fieldname','smb.temperatures_presentday','size',[md.mesh.numberofvertices+1,12],'NaN',1,'Inf',1,'timeseries',1)
+				md = checkfield(md,'fieldname','smb.temperatures_lgm','size',[md.mesh.numberofvertices+1,12],'NaN',1,'Inf',1,'timeseries',1)
+				md = checkfield(md,'fieldname','smb.precipitations_presentday','size',[md.mesh.numberofvertices+1,12],'NaN',1,'Inf',1,'timeseries',1)
+				md = checkfield(md,'fieldname','smb.precipitations_lgm','size',[md.mesh.numberofvertices+1,12],'NaN',1,'Inf',1,'timeseries',1)                                       
+				md = checkfield(md,'fieldname','smb.Tdiff','NaN',1,'Inf',1,'size',[2,numpy.nan],'singletimeseries',1)
+				md = checkfield(md,'fieldname','smb.sealev','NaN',1,'Inf',1,'size',[2,numpy.nan],'singletimeseries',1)
 			elif self.ismungsm:
-				md = checkfield(md,'fieldname','surfaceforcings.temperatures_presentday','size',[md.mesh.numberofvertices+1,12],'NaN',1)
-				md = checkfield(md,'fieldname','surfaceforcings.temperatures_lgm','size',[md.mesh.numberofvertices+1,12],'NaN',1)
-				md = checkfield(md,'fieldname','surfaceforcings.precipitations_presentday','size',[md.mesh.numberofvertices+1,12],'NaN',1)
-				md = checkfield(md,'fieldname','surfaceforcings.precipitations_lgm','size',[md.mesh.numberofvertices+1,12],'NaN',1)                                       
-				md = checkfield(md,'fieldname','surfaceforcings.Pfac','NaN',1,'size',[2,numpy.nan])
-				md = checkfield(md,'fieldname','surfaceforcings.Tdiff','NaN',1,'size',[2,numpy.nan])
-				md = checkfield(md,'fieldname','surfaceforcings.sealev','NaN',1,'size',[2,numpy.nan])
+				md = checkfield(md,'fieldname','smb.temperatures_presentday','size',[md.mesh.numberofvertices+1,12],'NaN',1,'Inf',1,'timeseries',1)
+				md = checkfield(md,'fieldname','smb.temperatures_lgm','size',[md.mesh.numberofvertices+1,12],'NaN',1,'Inf',1,'timeseries',1)
+				md = checkfield(md,'fieldname','smb.precipitations_presentday','size',[md.mesh.numberofvertices+1,12],'NaN',1,'Inf',1,'timeseries',1)
+				md = checkfield(md,'fieldname','smb.precipitations_lgm','size',[md.mesh.numberofvertices+1,12],'NaN',1,'Inf',1,'timeseries',1)                                       
+				md = checkfield(md,'fieldname','smb.Pfac','NaN',1,'Inf',1,'size',[2,numpy.nan],'singletimeseries',1)
+				md = checkfield(md,'fieldname','smb.Tdiff','NaN',1,'Inf',1,'size',[2,numpy.nan],'singletimeseries',1)
+				md = checkfield(md,'fieldname','smb.sealev','NaN',1,'Inf',1,'size',[2,numpy.nan],'singletimeseries',1)
 
+		md = checkfield(md,'fieldname','masstransport.requested_outputs','stringrow',1)
 		return md
-	# }}}
+	#}}}
 	def marshall(self,md,fid):    # {{{
 
 		yts=365.0*24.0*3600.0
 
-		WriteData(fid,'enum',SurfaceforcingsEnum(),'data',SMBpddEnum(),'format','Integer')
+		WriteData(fid,'enum',SmbEnum(),'data',SMBpddEnum(),'format','Integer')
 
-		WriteData(fid,'object',self,'class','surfaceforcings','fieldname','isdelta18o','format','Boolean')
-		WriteData(fid,'object',self,'class','surfaceforcings','fieldname','ismungsm','format','Boolean')
-		WriteData(fid,'object',self,'class','surfaceforcings','fieldname','desfac','format','Double')
-		WriteData(fid,'object',self,'class','surfaceforcings','fieldname','s0p','format','Double')
-		WriteData(fid,'object',self,'class','surfaceforcings','fieldname','s0t','format','Double')
-		WriteData(fid,'object',self,'class','surfaceforcings','fieldname','rlaps','format','Double')
-		WriteData(fid,'object',self,'class','surfaceforcings','fieldname','rlapslgm','format','Double')
+		WriteData(fid,'object',self,'class','smb','fieldname','isdelta18o','format','Boolean')
+		WriteData(fid,'object',self,'class','smb','fieldname','ismungsm','format','Boolean')
+		WriteData(fid,'object',self,'class','smb','fieldname','desfac','format','Double')
+		WriteData(fid,'object',self,'class','smb','fieldname','s0p','format','DoubleMat','mattype',1);
+		WriteData(fid,'object',self,'class','smb','fieldname','s0t','format','DoubleMat','mattype',1);
+		WriteData(fid,'object',self,'class','smb','fieldname','rlaps','format','Double')
+		WriteData(fid,'object',self,'class','smb','fieldname','rlapslgm','format','Double')
 
 		if (self.isdelta18o==0 and self.ismungsm==0):
-			WriteData(fid,'object',self,'class','surfaceforcings','fieldname','monthlytemperatures','format','DoubleMat','mattype',1)
-			WriteData(fid,'object',self,'class','surfaceforcings','fieldname','precipitation','format','DoubleMat','mattype',1,'scale',1./yts,'timeserieslength',md.mesh.numberofvertices+1)
+			WriteData(fid,'object',self,'class','smb','fieldname','monthlytemperatures','format','DoubleMat','mattype',1,'timeserieslength',md.mesh.numberofvertices+1)
+			WriteData(fid,'object',self,'class','smb','fieldname','precipitation','format','DoubleMat','mattype',1,'scale',1./yts,'timeserieslength',md.mesh.numberofvertices+1)
 		elif self.isdelta18o:
-			WriteData(fid,'object',self,'class','surfaceforcings','fieldname','temperatures_presentday','format','DoubleMat','mattype',1)
-			WriteData(fid,'object',self,'class','surfaceforcings','fieldname','temperatures_lgm','format','DoubleMat','mattype',1)
-			WriteData(fid,'object',self,'class','surfaceforcings','fieldname','precipitations_presentday','format','DoubleMat','mattype',1)
-			WriteData(fid,'object',self,'class','surfaceforcings','fieldname','precipitations_lgm','format','DoubleMat','mattype',1)
-			WriteData(fid,'object',self,'class','surfaceforcings','fieldname','delta18o_surface','format','DoubleMat','mattype',1)
-			WriteData(fid,'object',self,'class','surfaceforcings','fieldname','delta18o','format','DoubleMat','mattype',1)
-			WriteData(fid,'object',self,'class','surfaceforcings','fieldname','Tdiff','format','DoubleMat','mattype',1)
-			WriteData(fid,'object',self,'class','surfaceforcings','fieldname','sealev','format','DoubleMat','mattype',1)			
+			WriteData(fid,'object',self,'class','smb','fieldname','temperatures_presentday','format','DoubleMat','mattype',1,'timeserieslength',md.mesh.numberofvertices+1)
+			WriteData(fid,'object',self,'class','smb','fieldname','temperatures_lgm','format','DoubleMat','mattype',1,'timeserieslength',md.mesh.numberofvertices+1)
+			WriteData(fid,'object',self,'class','smb','fieldname','precipitations_presentday','format','DoubleMat','mattype',1,'scale',1./yts,'timeserieslength',md.mesh.numberofvertices+1)
+			WriteData(fid,'object',self,'class','smb','fieldname','precipitations_lgm','format','DoubleMat','mattype',1,'scale',1./yts,'timeserieslength',md.mesh.numberofvertices+1)
+			WriteData(fid,'object',self,'class','smb','fieldname','delta18o_surface','format','DoubleMat','mattype',1,'timeserieslength',2)
+			WriteData(fid,'object',self,'class','smb','fieldname','delta18o','format','DoubleMat','mattype',1,'timeserieslength',2)
+			WriteData(fid,'object',self,'class','smb','fieldname','Tdiff','format','DoubleMat','mattype',1,'timeserieslength',2)
+			WriteData(fid,'object',self,'class','smb','fieldname','sealev','format','DoubleMat','mattype',1,'timeserieslength',2)			
 		elif self.ismungsm:
-			WriteData(fid,'object',self,'class','surfaceforcings','fieldname','temperatures_presentday','format','DoubleMat','mattype',1)
-			WriteData(fid,'object',self,'class','surfaceforcings','fieldname','temperatures_lgm','format','DoubleMat','mattype',1)
-			WriteData(fid,'object',self,'class','surfaceforcings','fieldname','precipitations_presentday','format','DoubleMat','mattype',1)
-			WriteData(fid,'object',self,'class','surfaceforcings','fieldname','precipitations_lgm','format','DoubleMat','mattype',1)
-			WriteData(fid,'object',self,'class','surfaceforcings','fieldname','Pfac','format','DoubleMat','mattype',1)
-			WriteData(fid,'object',self,'class','surfaceforcings','fieldname','Tdiff','format','DoubleMat','mattype',1)
-			WriteData(fid,'object',self,'class','surfaceforcings','fieldname','sealev','format','DoubleMat','mattype',1)
+			WriteData(fid,'object',self,'class','smb','fieldname','temperatures_presentday','format','DoubleMat','mattype',1,'timeserieslength',md.mesh.numberofvertices+1)
+			WriteData(fid,'object',self,'class','smb','fieldname','temperatures_lgm','format','DoubleMat','mattype',1,'timeserieslength',md.mesh.numberofvertices+1)
+			WriteData(fid,'object',self,'class','smb','fieldname','precipitations_presentday','format','DoubleMat','mattype',1,'scale',1./yts,'timeserieslength',md.mesh.numberofvertices+1)
+			WriteData(fid,'object',self,'class','smb','fieldname','precipitations_lgm','format','DoubleMat','mattype',1,'scale',1./yts,'timeserieslength',md.mesh.numberofvertices+1)
+			WriteData(fid,'object',self,'class','smb','fieldname','Pfac','format','DoubleMat','mattype',1,'timeserieslength',2)
+			WriteData(fid,'object',self,'class','smb','fieldname','Tdiff','format','DoubleMat','mattype',1,'timeserieslength',2)
+			WriteData(fid,'object',self,'class','smb','fieldname','sealev','format','DoubleMat','mattype',1,'timeserieslength',2)
+			
+		#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,'data',outputs,'enum',SmbRequestedOutputsEnum(),'format','StringArray')
+
 	# }}}

Modified: issm/trunk/src/m/classes/adinversion.m
===================================================================
--- issm/trunk/src/m/classes/adinversion.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/classes/adinversion.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -72,7 +72,7 @@
 			md = checkfield(md,'fieldname','inversion.control_parameters','cell',1,'values',...
 				{'BalancethicknessThickeningRate' 'FrictionCoefficient' 'MaterialsRheologyBbar' 'DamageDbar',...
 				'Vx' 'Vy' 'Thickness' 'BalancethicknessOmega' 'BalancethicknessApparentMassbalance'});
-			md = checkfield(md,'fieldname','inversion.control_scaling_factors','size',[1 num_controls],'>',0,'NaN',1);
+			md = checkfield(md,'fieldname','inversion.control_scaling_factors','size',[1 num_controls],'>',0,'NaN',1,'Inf',1);
 			md = checkfield(md,'fieldname','inversion.maxsteps','numel',1,'>=',0);
 			md = checkfield(md,'fieldname','inversion.maxiter','numel',1,'>=',0);
 			md = checkfield(md,'fieldname','inversion.dxmin','numel',1,'>',0);
@@ -83,14 +83,14 @@
 			md = checkfield(md,'fieldname','inversion.max_parameters','size',[md.mesh.numberofvertices num_controls]);
 
 			if solution==BalancethicknessSolutionEnum()
-				md = checkfield(md,'fieldname','inversion.thickness_obs','size',[md.mesh.numberofvertices 1],'NaN',1);
-				md = checkfield(md,'fieldname','inversion.surface_obs','size',[md.mesh.numberofvertices 1],'NaN',1);
+				md = checkfield(md,'fieldname','inversion.thickness_obs','size',[md.mesh.numberofvertices 1],'NaN',1,'Inf',1);
+				md = checkfield(md,'fieldname','inversion.surface_obs','size',[md.mesh.numberofvertices 1],'NaN',1,'Inf',1);
 			elseif solution==BalancethicknessSoftSolutionEnum()
-				md = checkfield(md,'fieldname','inversion.thickness_obs','size',[md.mesh.numberofvertices 1],'NaN',1);
+				md = checkfield(md,'fieldname','inversion.thickness_obs','size',[md.mesh.numberofvertices 1],'NaN',1,'Inf',1);
 			else
-				md = checkfield(md,'fieldname','inversion.vx_obs','size',[md.mesh.numberofvertices 1],'NaN',1);
+				md = checkfield(md,'fieldname','inversion.vx_obs','size',[md.mesh.numberofvertices 1],'NaN',1,'Inf',1);
 				if ~strcmp(domaintype(md.mesh),'2Dvertical'),
-					md = checkfield(md,'fieldname','inversion.vy_obs','size',[md.mesh.numberofvertices 1],'NaN',1);
+					md = checkfield(md,'fieldname','inversion.vy_obs','size',[md.mesh.numberofvertices 1],'NaN',1,'Inf',1);
 				end
 			end
 		end % }}}

Modified: issm/trunk/src/m/classes/autodiff.m
===================================================================
--- issm/trunk/src/m/classes/autodiff.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/classes/autodiff.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -19,26 +19,6 @@
 		end
 		%}}}
 	methods
-     	function createxml(self,fid) % {{{
-            fprintf(fid, '<!-- autodiff -->\n');            
-                    
-            % automatic differentiation parameters 
-            fprintf(fid,'%s\n%s\n%s\n','<frame key="1" label="automatic differentiation parameters">','<section name="autodiff" />');                    
-                fprintf(fid,'%s%s%s\n%s\n%s%s%s\n%s\n%s\n','  <parameter key ="isautodiff" type="',class(self.isautodiff),'" optional="false">','     <section name="autodiff" />','         <option value="',convert2str(self.isautodiff),'" type="string" default="true"></option>','     <help> indicates if the automatic differentiation is activated </help>','  </parameter>');
-             
-                fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="dependents" type="',class(self.dependents),'" default="',convert2str(self.dependents),'">','     <section name="autodiff" />','     <help> list of dependent variables </help>','  </parameter>');
-                fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="independents" type="',class(self.independents),'" default="',convert2str(self.independents),'">','     <section name="autodiff" />','     <help> list of independent variables </help>','  </parameter>');
-                fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="driver" type="',class(self.driver),'" default="',convert2str(self.driver),'">','     <section name="autodiff" />','     <help> ADOLC driver (''fos_forward'' or ''fov_forward'') </help>','  </parameter>');
-                fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="obufsize" type="',class(self.obufsize),'" default="',convert2str(self.obufsize),'">','     <section name="autodiff" />','     <help> Number of operations per buffer (==OBUFSIZE in usrparms.h)  </help>','  </parameter>');
-                fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="lbufsize" type="',class(self.lbufsize),'" default="',convert2str(self.lbufsize),'">','     <section name="autodiff" />','     <help> Number of locations per buffer (==LBUFSIZE in usrparms.h) </help>','  </parameter>');
-                fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="cbufsize" type="',class(self.cbufsize),'" default="',convert2str(self.cbufsize),'">','     <section name="autodiff" />','     <help> Number of values per buffer (==CBUFSIZE in usrparms.h) </help>','  </parameter>');
-                fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="tbufsize" type="',class(self.tbufsize),'" default="',convert2str(self.tbufsize),'">','     <section name="autodiff" />','     <help> Number of taylors per buffer (&lt;=TBUFSIZE in usrparms.h) </help>','  </parameter>');
-                fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="gcTriggerRatio" type="',class(self.gcTriggerRatio),'" default="',convert2str(self.gcTriggerRatio),'">','     <section name="autodiff" />','     <help> free location block sorting/consolidation triggered if the ratio between allocated and used locations exceeds gcTriggerRatio </help>','  </parameter>');
-                fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="gcTriggerRatio" type="',class(self.gcTriggerRatio),'" default="',convert2str(self.gcTriggerRatio),'">','     <section name="autodiff" />','     <help> free location block sorting/consolidation triggered if the allocated locations exceed gcTriggerMaxSize </help>','  </parameter>');
-            
-            fprintf(fid,'%s\n%s\n','</frame>');    
-        
-        end % }}}
 		function self = autodiff(varargin) % {{{
 			switch nargin
 				case 0
@@ -256,5 +236,11 @@
 			%}}}
 
 		end % }}}
+		function savemodeljs(self,fid,modelname) % {{{
+			%do nothing for now
+			if self.isautodiff,
+				error('autodiff savemodeljs error message: not implemented yet!');
+			end
+		end % }}}
 	end
 end

Modified: issm/trunk/src/m/classes/autodiff.py
===================================================================
--- issm/trunk/src/m/classes/autodiff.py	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/classes/autodiff.py	2016-04-13 04:32:01 UTC (rev 20500)
@@ -5,6 +5,7 @@
 from EnumDefinitions import *
 from checkfield import checkfield
 from WriteData import WriteData
+from MatlabFuncs import *
 
 class autodiff(object):
 	"""
@@ -66,7 +67,7 @@
 		md = checkfield(md,'fieldname','autodiff.cbufsize','>=',524288)
 		md = checkfield(md,'fieldname','autodiff.tbufsize','>=',524288)
 		md = checkfield(md,'fieldname','autodiff.gcTriggerRatio','>=',2.0)
-		md = checkfield(md,'fieldname','autodiff.gcTriggerMaxSize','>=',2000000)
+		md = checkfield(md,'fieldname','autodiff.gcTriggerMaxSize','>=',65536)
 
 		#Driver value:
 		md = checkfield(md,'fieldname','autodiff.driver','values',['fos_forward','fov_forward','fov_forward_all','fos_reverse','fov_reverse','fov_reverse_all'])
@@ -107,7 +108,7 @@
 			indices=numpy.zeros(num_dependent_objects)
 
 			for i,dep in enumerate(self.dependents):
-				names[i]=dep.name
+				names.append(dep.name)
 				types[i]=dep.typetoscalar()
 				indices[i]=dep.index
 

Modified: issm/trunk/src/m/classes/balancethickness.m
===================================================================
--- issm/trunk/src/m/classes/balancethickness.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/classes/balancethickness.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -31,10 +31,10 @@
 			if solution~=BalancethicknessSolutionEnum(), return; end
 
 			md = checkfield(md,'fieldname','balancethickness.spcthickness');
-			md = checkfield(md,'fieldname','balancethickness.thickening_rate','size',[md.mesh.numberofvertices 1],'NaN',1);
+			md = checkfield(md,'fieldname','balancethickness.thickening_rate','size',[md.mesh.numberofvertices 1],'NaN',1,'Inf',1);
 			md = checkfield(md,'fieldname','balancethickness.stabilization','size',[1 1],'values',[0 1 2 3]);
 
-			%md = checkfield(md,'fieldname','balancethickness.omega','size',[md.mesh.numberofvertices 1],'NaN',1,'>=',0);
+			%md = checkfield(md,'fieldname','balancethickness.omega','size',[md.mesh.numberofvertices 1],'NaN',1,'Inf',1,'>=',0);
 		end % }}}
 		function disp(self) % {{{
 			disp(sprintf('   balance thickness solution parameters:'));
@@ -54,5 +54,13 @@
 
 			WriteData(fid,'object',self,'fieldname','omega','format','DoubleMat','mattype',1);
 		end % }}}
+		function savemodeljs(self,fid,modelname) % {{{
+		
+			writejs1Darray(fid,[modelname '.balancethickness.spcthickness'],self.spcthickness);
+			writejs1Darray(fid,[modelname '.balancethickness.thickening_rate'],self.thickening_rate);
+			writejsdouble(fid,[modelname '.balancethickness.stabilization'],self.stabilization);
+			writejs1Darray(fid,[modelname '.balancethickness.omega'],self.omega);
+
+		end % }}}
 	end
 end

Modified: issm/trunk/src/m/classes/balancethickness.py
===================================================================
--- issm/trunk/src/m/classes/balancethickness.py	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/classes/balancethickness.py	2016-04-13 04:32:01 UTC (rev 20500)
@@ -42,7 +42,7 @@
 			return md
 
 		md = checkfield(md,'fieldname','balancethickness.spcthickness')
-		md = checkfield(md,'fieldname','balancethickness.thickening_rate','size',[md.mesh.numberofvertices],'NaN',1)
+		md = checkfield(md,'fieldname','balancethickness.thickening_rate','size',[md.mesh.numberofvertices],'NaN',1,'Inf',1)
 		md = checkfield(md,'fieldname','balancethickness.stabilization','size',[1],'values',[0,1,2,3])
 
 		return md

Modified: issm/trunk/src/m/classes/basalforcings.m
===================================================================
--- issm/trunk/src/m/classes/basalforcings.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/classes/basalforcings.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -10,13 +10,6 @@
 		geothermalflux            = NaN;
 	end
 	methods
-		function createxml(self,fid) % {{{
-			fprintf(fid, '\n\n');
-			fprintf(fid, '%s\n', '<!-- basalforcings -->');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',    '<parameter key ="melting_rate" type="',            class(self.melting_rate),'" default="',              num2str(self.melting_rate),'">',              '     <section name="basalforcings" />','     <help> basal melting rate (positive if melting) [m/yr] </help>','</parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n',        '<parameter key ="geothermalflux" type="',          class(self.geothermalflux),'" default="',            num2str(self.geothermalflux),'">',            '     <section name="basalforcings" />','     <help> geothermal heat flux [W/m^2] </help>','</parameter>');
-
-		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); 
@@ -49,17 +42,17 @@
 		function md = checkconsistency(self,md,solution,analyses) % {{{
 
 			if ismember(MasstransportAnalysisEnum(),analyses) & ~(solution==TransientSolutionEnum() & md.transient.ismasstransport==0),
-				md = checkfield(md,'fieldname','basalforcings.groundedice_melting_rate','NaN',1,'timeseries',1);
-				md = checkfield(md,'fieldname','basalforcings.floatingice_melting_rate','NaN',1,'timeseries',1);
+				md = checkfield(md,'fieldname','basalforcings.groundedice_melting_rate','NaN',1,'Inf',1,'timeseries',1);
+				md = checkfield(md,'fieldname','basalforcings.floatingice_melting_rate','NaN',1,'Inf',1,'timeseries',1);
 			end
 			if ismember(BalancethicknessAnalysisEnum(),analyses),
-				md = checkfield(md,'fieldname','basalforcings.groundedice_melting_rate','NaN',1,'size',[md.mesh.numberofvertices 1]);
-				md = checkfield(md,'fieldname','basalforcings.floatingice_melting_rate','NaN',1,'size',[md.mesh.numberofvertices 1]);
+				md = checkfield(md,'fieldname','basalforcings.groundedice_melting_rate','NaN',1,'Inf',1,'size',[md.mesh.numberofvertices 1]);
+				md = checkfield(md,'fieldname','basalforcings.floatingice_melting_rate','NaN',1,'Inf',1,'size',[md.mesh.numberofvertices 1]);
 			end
 			if ismember(ThermalAnalysisEnum(),analyses) & ~(solution==TransientSolutionEnum() & md.transient.isthermal==0),
-				md = checkfield(md,'fieldname','basalforcings.groundedice_melting_rate','NaN',1,'timeseries',1);
-				md = checkfield(md,'fieldname','basalforcings.floatingice_melting_rate','NaN',1,'timeseries',1);
-				md = checkfield(md,'fieldname','basalforcings.geothermalflux','NaN',1,'timeseries',1,'>=',0);
+				md = checkfield(md,'fieldname','basalforcings.groundedice_melting_rate','NaN',1,'Inf',1,'timeseries',1);
+				md = checkfield(md,'fieldname','basalforcings.floatingice_melting_rate','NaN',1,'Inf',1,'timeseries',1);
+				md = checkfield(md,'fieldname','basalforcings.geothermalflux','NaN',1,'Inf',1,'timeseries',1,'>=',0);
 			end
 		end % }}}
 		function disp(self) % {{{
@@ -79,5 +72,12 @@
 			WriteData(fid,'object',self,'fieldname','floatingice_melting_rate','format','DoubleMat','mattype',1,'scale',1./yts,'timeserieslength',md.mesh.numberofvertices+1)
 			WriteData(fid,'object',self,'fieldname','geothermalflux','format','DoubleMat','mattype',1,'timeserieslength',md.mesh.numberofvertices+1);
 		end % }}}
+		function savemodeljs(self,fid,modelname) % {{{
+		
+			writejs1Darray(fid,[modelname '.basalforcings.groundedice_melting_rate'],self.groundedice_melting_rate);
+			writejs1Darray(fid,[modelname '.basalforcings.floatingice_melting_rate'],self.floatingice_melting_rate);
+			writejs1Darray(fid,[modelname '.basalforcings.geothermalflux'],self.geothermalflux);
+
+		end % }}}
 	end
 end

Modified: issm/trunk/src/m/classes/basalforcings.py
===================================================================
--- issm/trunk/src/m/classes/basalforcings.py	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/classes/basalforcings.py	2016-04-13 04:32:01 UTC (rev 20500)
@@ -54,17 +54,17 @@
 	def checkconsistency(self,md,solution,analyses):    # {{{
 
 		if MasstransportAnalysisEnum() in analyses and not (solution==TransientSolutionEnum() and not md.transient.ismasstransport):
-			md = checkfield(md,'fieldname','basalforcings.groundedice_melting_rate','NaN',1,'timeseries',1)
-			md = checkfield(md,'fieldname','basalforcings.floatingice_melting_rate','NaN',1,'timeseries',1)
+			md = checkfield(md,'fieldname','basalforcings.groundedice_melting_rate','NaN',1,'Inf',1,'timeseries',1)
+			md = checkfield(md,'fieldname','basalforcings.floatingice_melting_rate','NaN',1,'Inf',1,'timeseries',1)
 
 		if BalancethicknessAnalysisEnum() in analyses:
-			md = checkfield(md,'fieldname','basalforcings.groundedice_melting_rate','NaN',1,'size',[md.mesh.numberofvertices])
-			md = checkfield(md,'fieldname','basalforcings.floatingice_melting_rate','NaN',1,'size',[md.mesh.numberofvertices])
+			md = checkfield(md,'fieldname','basalforcings.groundedice_melting_rate','NaN',1,'Inf',1,'size',[md.mesh.numberofvertices])
+			md = checkfield(md,'fieldname','basalforcings.floatingice_melting_rate','NaN',1,'Inf',1,'size',[md.mesh.numberofvertices])
 
 		if ThermalAnalysisEnum() in analyses and not (solution==TransientSolutionEnum() and not md.transient.isthermal):
-			md = checkfield(md,'fieldname','basalforcings.groundedice_melting_rate','NaN',1,'timeseries',1)
-			md = checkfield(md,'fieldname','basalforcings.floatingice_melting_rate','NaN',1,'timeseries',1)
-			md = checkfield(md,'fieldname','basalforcings.geothermalflux','NaN',1,'timeseries',1,'>=',0)
+			md = checkfield(md,'fieldname','basalforcings.groundedice_melting_rate','NaN',1,'Inf',1,'timeseries',1)
+			md = checkfield(md,'fieldname','basalforcings.floatingice_melting_rate','NaN',1,'Inf',1,'timeseries',1)
+			md = checkfield(md,'fieldname','basalforcings.geothermalflux','NaN',1,'Inf',1,'timeseries',1,'>=',0)
 
 		return md
 	# }}}

Modified: issm/trunk/src/m/classes/calving.m
===================================================================
--- issm/trunk/src/m/classes/calving.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/classes/calving.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -5,7 +5,6 @@
 
 classdef calving
 	properties (SetAccess=public) 
-		stabilization = 0;
 		calvingrate   = NaN;
 		meltingrate   = NaN;
 	end
@@ -34,30 +33,30 @@
 		end % }}}
 		function self = setdefaultparameters(self) % {{{
 
-			%stabilization = 2 by default
-			self.stabilization = 2;
-
 		end % }}}
 		function md = checkconsistency(self,md,solution,analyses) % {{{
 			%Early return
-			if (solution~=TransientSolutionEnum() | md.transient.iscalving==0), return; end
+			if (solution~=TransientSolutionEnum() | md.transient.ismovingfront==0), return; end
 
-			md = checkfield(md,'fieldname','calving.stabilization','values',[0 1 2]);
-			md = checkfield(md,'fieldname','calving.calvingrate(1:md.mesh.numberofvertices,:)','>=',0,'timeseries',1,'NaN',1);
-			md = checkfield(md,'fieldname','calving.meltingrate(1:md.mesh.numberofvertices,:)','>=',0,'timeseries',1,'NaN',1);
+			md = checkfield(md,'fieldname','calving.calvingrate(1:md.mesh.numberofvertices,:)','>=',0,'timeseries',1,'NaN',1,'Inf',1);
+			md = checkfield(md,'fieldname','calving.meltingrate(1:md.mesh.numberofvertices,:)','>=',0,'timeseries',1,'NaN',1,'Inf',1);
 		end % }}}
 		function disp(self) % {{{
 			disp(sprintf('   Calving parameters:'));
-			fielddisplay(self,'stabilization','0: no, 1: artificial_diffusivity, 2: streamline upwinding');
 			fielddisplay(self,'calvingrate','calving rate at given location [m/a]');
 			fielddisplay(self,'meltingrate','melting rate at given location [m/a]');
 		end % }}}
 		function marshall(self,md,fid) % {{{
 			yts=365.0*24.0*3600.0;
 			WriteData(fid,'enum',CalvingLawEnum(),'data',DefaultCalvingEnum(),'format','Integer');
-			WriteData(fid,'enum',LevelsetStabilizationEnum(),'data',self.stabilization,'format','Integer');
 			WriteData(fid,'object',self,'fieldname','calvingrate','format','DoubleMat','mattype',1,'timeserieslength',md.mesh.numberofvertices+1,'scale',1./yts);
 			WriteData(fid,'object',self,'fieldname','meltingrate','format','DoubleMat','mattype',1,'timeserieslength',md.mesh.numberofvertices+1,'scale',1./yts);
 		end % }}}
+		function savemodeljs(self,fid,modelname) % {{{
+		
+			writejs1Darray(fid,[modelname '.calving.calvingrate'],self.calvingrate);
+			writejs1Darray(fid,[modelname '.calving.meltingrate'],self.meltingrate);
+
+		end % }}}
 	end
 end

Modified: issm/trunk/src/m/classes/calving.py
===================================================================
--- issm/trunk/src/m/classes/calving.py	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/classes/calving.py	2016-04-13 04:32:01 UTC (rev 20500)
@@ -15,7 +15,6 @@
 
 	def __init__(self): # {{{
 
-		self.stabilization = 0
 		self.calvingrate   = float('NaN')
 		self.meltingrate   = float('NaN')
 
@@ -25,7 +24,6 @@
 		#}}}
 	def __repr__(self): # {{{
 		string='   Calving parameters:'
-		string="%s\n%s"%(string,fielddisplay(self,'stabilization','0: no, 1: artificial_diffusivity, 2: streamline upwinding'))
 		string="%s\n%s"%(string,fielddisplay(self,'calvingrate','calving rate at given location [m/a]'))
 		string="%s\n%s"%(string,fielddisplay(self,'meltingrate','melting rate at given location [m/a]'))
 
@@ -38,20 +36,16 @@
 	#}}}
 	def setdefaultparameters(self): # {{{
 
-		#stabilization = 2 by default
-		self.stabilization = 2
-
 		return self
 	#}}}
 	def checkconsistency(self,md,solution,analyses):    # {{{
 
 		#Early return
-		if (solution!=TransientSolutionEnum()) or (not md.transient.iscalving):
+		if (solution!=TransientSolutionEnum()) or (not md.transient.ismovingfront):
 			return md
 
-		md = checkfield(md,'fieldname','calving.stabilization','values',[0,1,2]);
-		md = checkfield(md,'fieldname','calving.calvingrate','>=',0,'timeseries',1,'NaN',1);
-		md = checkfield(md,'fieldname','calving.meltingrate','>=',0,'timeseries',1,'NaN',1);
+		md = checkfield(md,'fieldname','calving.calvingrate','>=',0,'timeseries',1,'NaN',1,'Inf',1);
+		md = checkfield(md,'fieldname','calving.meltingrate','>=',0,'timeseries',1,'NaN',1,'Inf',1);
 
 		return md
 	# }}}
@@ -60,7 +54,6 @@
 		yts=365.*24.*3600.
 
 		WriteData(fid,'enum',CalvingLawEnum(),'data',DefaultCalvingEnum(),'format','Integer');
-		WriteData(fid,'enum',LevelsetStabilizationEnum(),'data',self.stabilization,'format','Integer');
 		WriteData(fid,'object',self,'fieldname','calvingrate','format','DoubleMat','mattype',1,'timeserieslength',md.mesh.numberofvertices+1,'scale',1./yts)
 		WriteData(fid,'object',self,'fieldname','meltingrate','format','DoubleMat','mattype',1,'timeserieslength',md.mesh.numberofvertices+1,'scale',1./yts)
 	# }}}

Modified: issm/trunk/src/m/classes/calvingdev.m
===================================================================
--- issm/trunk/src/m/classes/calvingdev.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/classes/calvingdev.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -5,7 +5,6 @@
 
 classdef calvingdev
 	properties (SetAccess=public) 
-		stabilization = 0;
 		coeff         = NaN;
 		meltingrate   = NaN;
 	end
@@ -28,25 +27,24 @@
 					error('constructor not supported');
 			end
 		end % }}}
+		function self = extrude(self,md) % {{{
+			self.coeff=project3d(md,'vector',self.coeff,'type','node');
+			self.meltingrate=project3d(md,'vector',self.meltingrate,'type','node');
+		end % }}}
 		function self = setdefaultparameters(self) % {{{
 
-			%stabilization = 2 by default
-			self.stabilization = 2;
-
 			%Proportionality coefficient in Pi model
 			self.coeff=2e13;
 		end % }}}
 		function md = checkconsistency(self,md,solution,analyses) % {{{
 			%Early return
-			if (solution~=TransientSolutionEnum() | md.transient.iscalving==0), return; end
+			if (solution~=TransientSolutionEnum() | md.transient.ismovingfront==0), return; end
 
-			md = checkfield(md,'fieldname','calving.stabilization','values',[0 1 2]);
 			md = checkfield(md,'fieldname','calving.coeff','>',0,'size',[md.mesh.numberofvertices 1]);
-			md = checkfield(md,'fieldname','calving.meltingrate','NaN',1,'size',[md.mesh.numberofvertices 1],'>=',0);
+			md = checkfield(md,'fieldname','calving.meltingrate','NaN',1,'Inf',1,'size',[md.mesh.numberofvertices 1],'>=',0);
 		end % }}}
 		function disp(self) % {{{
 			disp(sprintf('   Calving Pi parameters:'));
-			fielddisplay(self,'stabilization','0: no, 1: artificial_diffusivity, 2: streamline upwinding');
 			fielddisplay(self,'coeff','proportionality coefficient in Pi model');
 			fielddisplay(self,'meltingrate','melting rate at given location [m/a]');
 
@@ -54,8 +52,7 @@
 		function marshall(self,md,fid) % {{{
 			yts=365.0*24.0*3600.0;
 			WriteData(fid,'enum',CalvingLawEnum(),'data',CalvingDevEnum(),'format','Integer');
-			WriteData(fid,'enum',LevelsetStabilizationEnum(),'data',self.stabilization,'format','Integer');
-			WriteData(fid,'enum',CalvingpiCoeffEnum(),'data',self.coeff,'format','DoubleMat','mattype',1);
+			WriteData(fid,'enum',CalvingdevCoeffEnum(),'data',self.coeff,'format','DoubleMat','mattype',1);
 			WriteData(fid,'class','calving','object',self,'fieldname','meltingrate','format','DoubleMat','mattype',1,'forcinglength',md.mesh.numberofvertices+1,'scale',1./yts);
 		end % }}}
 	end

Modified: issm/trunk/src/m/classes/calvinglevermann.m
===================================================================
--- issm/trunk/src/m/classes/calvinglevermann.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/classes/calvinglevermann.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -5,7 +5,6 @@
 
 classdef calvinglevermann
 	properties (SetAccess=public) 
-		stabilization = 0;
 		coeff         = NaN;
 		meltingrate   = NaN;
 	end
@@ -34,23 +33,18 @@
 		end % }}}
 		function self = setdefaultparameters(self) % {{{
 
-			%stabilization = 2 by default
-			self.stabilization = 2;
-
 			%Proportionality coefficient in Levermann model
 			self.coeff=2e13;
 		end % }}}
 		function md = checkconsistency(self,md,solution,analyses) % {{{
 			%Early return
-			if (solution~=TransientSolutionEnum() | md.transient.iscalving==0), return; end
+			if (solution~=TransientSolutionEnum() | md.transient.ismovingfront==0), return; end
 
-			md = checkfield(md,'fieldname','calving.stabilization','values',[0 1 2]);
 			md = checkfield(md,'fieldname','calving.coeff','>',0,'size',[md.mesh.numberofvertices 1]);
-			md = checkfield(md,'fieldname','calving.meltingrate','NaN',1,'size',[md.mesh.numberofvertices 1],'>=',0);
+			md = checkfield(md,'fieldname','calving.meltingrate','NaN',1,'Inf',1,'size',[md.mesh.numberofvertices 1],'>=',0);
 		end % }}}
 		function disp(self) % {{{
 			disp(sprintf('   Calving Levermann parameters:'));
-			fielddisplay(self,'stabilization','0: no, 1: artificial_diffusivity, 2: streamline upwinding');
 			fielddisplay(self,'coeff','proportionality coefficient in Levermann model');
 			fielddisplay(self,'meltingrate','melting rate at given location [m/a]');
 
@@ -58,7 +52,6 @@
 		function marshall(self,md,fid) % {{{
 			yts=365.0*24.0*3600.0;
 			WriteData(fid,'enum',CalvingLawEnum(),'data',CalvingLevermannEnum(),'format','Integer');
-			WriteData(fid,'enum',LevelsetStabilizationEnum(),'data',self.stabilization,'format','Integer');
 			WriteData(fid,'enum',CalvinglevermannCoeffEnum(),'data',self.coeff,'format','DoubleMat','mattype',1);
 			WriteData(fid,'object',self,'fieldname','meltingrate','format','DoubleMat','mattype',1,'timeserieslength',md.mesh.numberofvertices+1,'scale',1./yts);
 		end % }}}

Modified: issm/trunk/src/m/classes/calvinglevermann.py
===================================================================
--- issm/trunk/src/m/classes/calvinglevermann.py	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/classes/calvinglevermann.py	2016-04-13 04:32:01 UTC (rev 20500)
@@ -13,7 +13,7 @@
 	"""
 
 	def __init__(self): # {{{
-		self.stabilization = 0
+
 		self.coeff         = float('NaN')
 		self.meltingrate   = float('NaN')
 
@@ -23,7 +23,6 @@
 		#}}}
 	def __repr__(self): # {{{
 		string='   Calving Levermann parameters:'
-		string="%s\n%s"%(string,fielddisplay(self,'stabilization','0: no, 1: artificial_diffusivity, 2: streamline upwinding'))
 		string="%s\n%s"%(string,fielddisplay(self,'coeff','proportionality coefficient in Levermann model'))
 		string="%s\n%s"%(string,fielddisplay(self,'meltingrate','melting rate at given location [m/a]'))
 
@@ -36,27 +35,22 @@
 	#}}}
 	def setdefaultparameters(self): # {{{
 
-		#stabilization = 2 by default
-		self.stabilization = 2
-
 		#Proportionality coefficient in Levermann model
 		self.coeff=2e13;
 	#}}}
 	def checkconsistency(self,md,solution,analyses):    # {{{
 
 		#Early return
-		if (solution!=TransientSolutionEnum()) or (not md.transient.iscalving):
+		if (solution!=TransientSolutionEnum()) or (not md.transient.ismovingfront):
 			return md
 
-		md = checkfield(md,'fieldname','calving.stabilization','values',[0,1,2]);
 		md = checkfield(md,'fieldname','calving.coeff','size',[md.mesh.numberofvertices],'>',0)
-		md = checkfield(md,'fieldname','calving.meltingrate','NaN',1,'size',[md.mesh.numberofvertices],'>=',0)
+		md = checkfield(md,'fieldname','calving.meltingrate','NaN',1,'Inf',1,'size',[md.mesh.numberofvertices],'>=',0)
 		return md
 	# }}}
 	def marshall(self,md,fid):    # {{{
 		yts=365.*24.*3600.
 		WriteData(fid,'enum',CalvingLawEnum(),'data',CalvingLevermannEnum(),'format','Integer');
-		WriteData(fid,'enum',LevelsetStabilizationEnum(),'data',self.stabilization,'format','Integer');
 		WriteData(fid,'enum',CalvinglevermannCoeffEnum(),'data',self.coeff,'format','DoubleMat','mattype',1)
 		WriteData(fid,'object',self,'fieldname','meltingrate','format','DoubleMat','mattype',1,'timeserieslength',md.mesh.numberofvertices+1,'scale',1./yts)
 	# }}}

Modified: issm/trunk/src/m/classes/clusters/acenet.m
===================================================================
--- issm/trunk/src/m/classes/clusters/acenet.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/classes/clusters/acenet.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -14,27 +14,26 @@
 		 login='klemorza';
 		 np=10;
 		 port=0;
-		 queue='shortq';
+		 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';
+		 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)));
@@ -46,18 +45,17 @@
 			 disp(sprintf('    time: %i',cluster.time));
 			 disp(sprintf('    codepath: %s',cluster.codepath));
 			 disp(sprintf('    executionpath: %s',cluster.executionpath));
-		 end
+                 end
 		 %}}}
 		 function md = checkconsistency(cluster,md,solution,analyses) % {{{
 
 			 available_queues={'debug','shortq','longq'};
-			 queue_requirements_time=[48*1 48*2 48*5];
+			 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) % {{{
+		 function BuildQueueScript(cluster,dirname,modelname,solution,io_gather,isvalgrind,isgprof,isdakota) % {{{
 
 			 if(isvalgrind), disp('valgrind not supported by cluster, ignoring...'); end
 			 if(isgprof),    disp('gprof not supported by cluster, ignoring...'); end
@@ -66,38 +64,76 @@
 			 fid=fopen([modelname '.queue'],'w');
 			 fprintf(fid,'#!/bin/bash\n');
 			 fprintf(fid,'#$ -cwd\n');
-          fprintf(fid,'#$ -N issm\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_vmem=4G\n');
-          fprintf(fid,'#$ -pe ompi* %i\n',cluster.np);
-          fprintf(fid,'#$ -j y\n');
-          fprintf(fid,'#$ -l h=cl27*|cl28*|cl29*|cl30*|cl31*|cl320|cl267|cl268|cl269|cl338 \n');
-          %fprintf(fid,'#$ -l h=cl338 \n');
-          %fprintf(fid,'#$ -pe openmp 20 \n');
-          %fprintf(fid,'#$ -q !tarasov.q\n'); %
-          fprintf(fid,'#$ -pe openmp 8\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');
 
-          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,EnumToString(solution),[cluster.executionpath '/' dirname],modelname,modelname,modelname);
-          %fprintf(fid,'echo $HOSTNAME >>%s.outlog',modelname);
+                         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');
+
+                         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');
+
+                         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,EnumToString(solution),[cluster.executionpath '/' dirname],modelname,modelname,modelname);
+                         %fprintf(fid,'echo $HOSTNAME >>%s.outlog',modelname);
 			 fclose(fid);
 
 		 end
 		 %}}}
-		 function LaunchQueueJob(cluster,modelname,dirname,filelist)% {{{
+		 function UploadQueueJob(cluster,modelname,dirname,filelist)% {{{
 
 			 %compress the files into one zip.
 			 compressstring=['tar -zcf ' dirname '.tar.gz '];
@@ -109,11 +145,20 @@
 			 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)% {{{
+
 			 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 && qsub ' modelname '.queue '];
+			 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

Modified: issm/trunk/src/m/classes/clusters/castor.m
===================================================================
--- issm/trunk/src/m/classes/clusters/castor.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/classes/clusters/castor.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -45,7 +45,7 @@
 			 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) % {{{
+		 function BuildQueueScript(cluster,dirname,modelname,solution,io_gather,isvalgrind,isgprof,isdakota) % {{{
 
 			 if(isvalgrind), disp('valgrind not supported by cluster, ignoring...'); end
 			 if(isgprof),    disp('gprof not supported by cluster, ignoring...'); end
@@ -69,7 +69,7 @@
 
 		 end
 		 %}}}
-		 function LaunchQueueJob(cluster,modelname,dirname,filelist)% {{{
+		 function UploadQueueJob(cluster,modelname,dirname,filelist)% {{{
 
 			 %compress the files into one zip.
 			 compressstring=['tar -zcf ' dirname '.tar.gz '];
@@ -84,9 +84,16 @@
 			 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)% {{{
+
 			 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  && qsub ' modelname '.queue '];
+			 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)% {{{

Modified: issm/trunk/src/m/classes/clusters/cloud.m
===================================================================
--- issm/trunk/src/m/classes/clusters/cloud.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/classes/clusters/cloud.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -47,7 +47,7 @@
 			end
 		end
 		%}}}
-		function BuildQueueScript(cluster,dirname,modelname,solution,io_gather,isvalgrind,isgprof) % {{{
+		function BuildQueueScript(cluster,dirname,modelname,solution,io_gather,isvalgrind,isgprof,isdakota) % {{{
 
 			%write queuing script 
 			fid=fopen([modelname '.queue'],'w');
@@ -64,7 +64,7 @@
 			end
 		end
 		%}}}
-		function LaunchQueueJob(cluster,modelname,dirname,filelist)% {{{
+		function UploadQueueJob(cluster,modelname,dirname,filelist)% {{{
 
 			%compress the files into one zip.
 			compressstring=['tar -zcf ' dirname '.tar.gz '];
@@ -79,14 +79,25 @@
 			disp('uploading input file and queueing script');
 			issmstscpout(cluster.name,cluster.executionpath,cluster.login,{[dirname '.tar.gz']});
 
+		end %}}}
+		function LaunchQueueJob(cluster,modelname,dirname,filelist,restart)% {{{
+
 			if cluster.interactive, 
 				disp('sending files to remote cluster. once done, please log into cluster and launch job');
-				launchcommand=['cd ' cluster.executionpath ' && rm -rf ./' dirname ' && mkdir ' dirname ...
-					' && cd ' dirname ' && mv ../' dirname '.tar.gz ./ && tar -zxf ' dirname '.tar.gz '];
+				if ~isempty(restart)
+					launchcommand=['cd ' cluster.executionpath ' && cd ' dirname];
+				else
+					launchcommand=['cd ' cluster.executionpath ' && rm -rf ./' dirname ' && mkdir ' dirname ...
+						' && cd ' dirname ' && mv ../' dirname '.tar.gz ./ && tar -zxf ' dirname '.tar.gz '];
+				end
 			else
 				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  && qsub  ' modelname '.queue '];
+				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
 			issmstssh(cluster.name,cluster.login,launchcommand);
 		end %}}}

Modified: issm/trunk/src/m/classes/clusters/cosmos.m
===================================================================
--- issm/trunk/src/m/classes/clusters/cosmos.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/classes/clusters/cosmos.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -45,7 +45,7 @@
 			 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) % {{{
+		 function BuildQueueScript(cluster,dirname,modelname,solution,io_gather,isvalgrind,isgprof,isdakota) % {{{
 
 			 if(isvalgrind), disp('valgrind not supported by cluster, ignoring...'); end
 			 if(isgprof),    disp('gprof not supported by cluster, ignoring...'); end
@@ -69,7 +69,7 @@
 
 		 end
 		 %}}}
-		 function LaunchQueueJob(cluster,modelname,dirname,filelist)% {{{
+		 function UploadQueueJob(cluster,modelname,dirname,filelist)% {{{
 
 			 %compress the files into one zip.
 			 compressstring=['tar -zcf ' dirname '.tar.gz '];
@@ -84,9 +84,16 @@
 			 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)% {{{
+
 			 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  && qsub ' modelname '.queue '];
+			 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)% {{{

Modified: issm/trunk/src/m/classes/clusters/discover.m
===================================================================
--- issm/trunk/src/m/classes/clusters/discover.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/classes/clusters/discover.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -10,11 +10,12 @@
 		 % {{{
 		 name=oshostname();
 		 login='';
+		 modules        = {};
 		 numnodes=20;
 		 cpuspernode=8; 
 		 port=0;
 		 queue='general';
-		 time=12*60;
+		 time=12*60*60;
 		 processor='west';
 		 codepath='';
 		 executionpath='';
@@ -22,11 +23,9 @@
 		 bbftp=0;
 		 numstreams=8;
 		 hyperthreading=0;
+		 email='';
 	 end
-	 properties (SetAccess=private) 
-		 np=20*8;
-		 % }}}
-	 end
+	 %}}}
 	 methods
 		 function cluster=discover(varargin) % {{{
 
@@ -42,6 +41,7 @@
 			 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));
@@ -53,13 +53,19 @@
 			 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={'general_long','general','debug'};
-			 queue_requirements_time=[24*60 12*60 60];
-			 queue_requirements_np=[516 1024 32];
+			 available_queues={'long','general','debug'};
+			 queue_requirements_time=[24*60*60 12*60*60 60];
+			 queue_requirements_np=[4116 532 532];
 
 			 QueueRequirements(available_queues,queue_requirements_time,queue_requirements_np,cluster.queue,cluster.np,cluster.time)
 
@@ -68,12 +74,12 @@
 				 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,'west'),
-				 if ((cluster.cpuspernode>12 ) | (cluster.cpuspernode<1)),
-					 md = checkmessage(md,'cpuspernode should be between 1 and 12 for ''west'' processors');
+			 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 ''west'' ');
+				 md = checkmessage(md,'unknown processor type, should be ''sand'' or ''hasw'' ');
 			 end
 
 			 %Miscelaneous
@@ -83,35 +89,46 @@
 
 		 end
 		 %}}}
-		 function BuildQueueScript(cluster,dirname,modelname,solution,io_gather,isvalgrind,isgprof) % {{{
+		 function BuildQueueScript(cluster,dirname,modelname,solution,io_gather,isvalgrind,isgprof,isdakota) % {{{
 
 			 if(isgprof),    disp('gprof not supported by cluster, ignoring...'); end
 
-			 %compute number of processors
-			 cluster.np=cluster.numnodes*cluster.cpuspernode;
+			 executable='issm.exe';
+			 if isdakota,
+				 version=IssmConfig('_DAKOTA_VERSION_'); version=str2num(version(1:3));
+				 if (version>=6),
+					 executable='issm_dakota.exe';
+				 end
+			 end
 
-			 %write queuing script 
+			 %write queuing script
 			 fid=fopen([modelname '.queue'],'w');
+
 			 fprintf(fid,'#!/bin/bash\n');
-%			 fprintf(fid,'#PBS -N %s\n',modelname);
-			 fprintf(fid,'#PBS -l select=%i:mpiprocs=%i:proc=%s\n',cluster.numnodes,cluster.cpuspernode,cluster.processor);
-			 fprintf(fid,'#PBS -l walltime=%i:00\n',cluster.time); %SLURM walltime is in minutes:
-			 if ~strcmp(cluster.queue,'general'),
-				 fprintf(fid,'#PBS -q %s \n',cluster.queue);
+			 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 s1010 \n\n');
+			 for i=1:numel(cluster.modules),
+				 fprintf(fid,['module load ' cluster.modules{i} '\n']);
 			 end
-			 fprintf(fid,'#PBS -W group_list=s1010\n');
-			 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]);
+			 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 purge\n');
-			 fprintf(fid,'module load comp/intel-11.1.038\n');
+			 fprintf(fid,'module load comp/intel-15.0.0.090\n');
 			 fprintf(fid,'module load mpi/impi-4.0.3.008\n');
-			 fprintf(fid,'module load lib/mkl-10.1.2.024\n\n');
 			 fprintf(fid,'export PATH="$PATH:."\n\n');
-			 fprintf(fid,'export MPI_GROUP_MAX=64\n\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,EnumToString(solution),[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,'cd %s/%s\n\n',cluster.executionpath,dirname);
+
+			 fprintf(fid,'mpirun -np %i %s/%s %s %s %s\n',cluster.np,cluster.codepath,executable,EnumToString(solution),[cluster.executionpath '/' dirname],modelname);
 			 if ~io_gather, %concatenate the output files:
 				 fprintf(fid,'cat %s.outbin.* > %s.outbin',modelname,modelname);
 			 end
@@ -121,9 +138,9 @@
 			 if cluster.interactive,
 				 fid=fopen([modelname '.run'],'w');
 				 if ~isvalgrind,
-					 fprintf(fid,'mpirun -np %i %s/issm.exe %s %s %s\n',cluster.np,cluster.codepath,EnumToString(solution),[cluster.executionpath '/' dirname],modelname);
+					 fprintf(fid,'mpirun -np %i %s/%s %s %s %s\n',cluster.np,cluster.codepath,executable,EnumToString(solution),[cluster.executionpath '/' dirname],modelname);
 				 else
-					 fprintf(fid,'mpirun -np %i valgrind --leak-check=full %s/issm.exe %s %s %s\n',cluster.np,cluster.codepath,EnumToString(solution),[cluster.executionpath '/' dirname],modelname);
+					 fprintf(fid,'mpirun -np %i valgrind --leak-check=full %s/%s %s %s %s\n',cluster.np,cluster.codepath,executable,EnumToString(solution),[cluster.executionpath '/' dirname],modelname);
 				 end
 				 if ~io_gather, %concatenate the output files:
 					 fprintf(fid,'cat %s.outbin.* > %s.outbin',modelname,modelname);
@@ -135,7 +152,7 @@
 				 fclose(fid);
 			 end
 		 end %}}}
-		 function LaunchQueueJob(cluster,modelname,dirname,filelist)% {{{
+		 function UploadQueueJob(cluster,modelname,dirname,filelist)% {{{
 
 			 %compress the files into one zip.
 			 compressstring=['tar -zcf ' dirname '.tar.gz '];
@@ -160,12 +177,23 @@
 				 issmbbftpout(cluster.name,directory,cluster.login,cluster.port,cluster.numstreams,{[dirname '.tar.gz']});
 			 end
 
-			 %lauch command, to be executed via ssh
+		 end
+		 %}}}
+		 function LaunchQueueJob(cluster,modelname,dirname,filelist,restart,batch)% {{{
+
 			 if ~cluster.interactive, 
-				 launchcommand=['cd ' cluster.executionpath ' && rm -rf ./' dirname ' && mkdir ' dirname ...
-					 ' && cd ' dirname ' && mv ../' dirname '.tar.gz ./ && tar -zxf ' dirname '.tar.gz  && qsub ' modelname '.queue '];
+				 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
-				 launchcommand=['cd ' cluster.executionpath '/Interactive' num2str(cluster.interactive) ' && tar -zxf ' dirname '.tar.gz'];
+				 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');

Modified: issm/trunk/src/m/classes/clusters/gemini.m
===================================================================
--- issm/trunk/src/m/classes/clusters/gemini.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/classes/clusters/gemini.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -45,7 +45,7 @@
 			 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) % {{{
+		 function BuildQueueScript(cluster,dirname,modelname,solution,io_gather,isvalgrind,isgprof,isdakota) % {{{
 
 			 if(isvalgrind), disp('valgrind not supported by cluster, ignoring...'); end
 			 if(isgprof),    disp('gprof not supported by cluster, ignoring...'); end
@@ -70,7 +70,7 @@
 
 		 end
 		 %}}}
-		 function LaunchQueueJob(cluster,modelname,dirname,filelist)% {{{
+		 function UploadQueueJob(cluster,modelname,dirname,filelist)% {{{
 
 			 %compress the files into one zip.
 			 compressstring=['tar -zcf ' dirname '.tar.gz '];
@@ -85,9 +85,16 @@
 			 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)% {{{
+
 			 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  && qsub ' modelname '.queue '];
+			 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)% {{{

Modified: issm/trunk/src/m/classes/clusters/generic.m
===================================================================
--- issm/trunk/src/m/classes/clusters/generic.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/classes/clusters/generic.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -23,24 +23,6 @@
 		%}}}
 	end
 	methods
-        function createxml(self,fid) % {{{
-            fprintf(fid, '\n\n');
-            fprintf(fid, '%s\n', '<!-- generic -->');
-            
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',    '<parameter key ="name" type="',class(self.name),'" default="',convert2str(self.name),'">',	'     <section name="cluster" />','     <help> N/A </help>','</parameter>');
-            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',    '<parameter key ="login" type="',class(self.login),'" default="',convert2str(self.login),'">',     '     <section name="cluster" />','     <help> N/A </help>','</parameter>');
-            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',	'<parameter key ="np" type="',class(self.np),'" default="',convert2str(self.np),'">',	'     <section name="cluster" />','     <help> N/A </help>','</parameter>');
-            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',    '<parameter key ="port" type="',class(self.port),'" default="',convert2str(self.port),'">',	'     <section name="cluster" />','     <help> N/A </help>','</parameter>');
-            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',    '<parameter key ="codepath" type="',class(self.codepath),'" default="',convert2str(self.codepath),'">',     '     <section name="cluster" />','     <help> N/A </help>','</parameter>');
-             
-            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',    '<parameter key ="executionpath" type="',class(self.executionpath),'" default="',convert2str(self.executionpath),'">',	'     <section name="cluster" />','     <help> N/A </help>','</parameter>');
-            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',    '<parameter key ="etcpath" type="',class(self.etcpath),'" default="',convert2str(self.etcpath),'">',     '     <section name="cluster" />','     <help> N/A </help>','</parameter>');
-            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',    '<parameter key ="valgrind" type="',class(self.valgrind),'" default="',convert2str(self.valgrind),'">',	'     <section name="cluster" />','     <help> N/A </help>','</parameter>');
-            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',    '<parameter key ="valgrindlib" type="',class(self.valgrindlib),'" default="',convert2str(self.valgrindlib),'">',     '     <section name="cluster" />','     <help> N/A </help>','</parameter>');
-            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',    '<parameter key ="valgrindsup" type="',class(self.valgrindsup),'" default="',convert2str(self.valgrindsup),'">',     '     <section name="cluster" />','     <help> N/A </help>','</parameter>');
-            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n',    	'<parameter key ="verbose" type="',class(self.verbose),'" default="',convert2str(self.verbose),'">',	'     <section name="cluster" />','     <help> N/A </help>','</parameter>');
-             
-        end % }}}
 		function cluster=generic(varargin) % {{{
 
 			%Change the defaults if ispc
@@ -72,7 +54,7 @@
 			disp(sprintf('    port: %i',cluster.port));
 			disp(sprintf('    codepath: %s',cluster.codepath));
 			disp(sprintf('    executionpath: %s',cluster.executionpath));
-			disp(sprintf('    etcpath: %s',cluster.executionpath));
+			disp(sprintf('    etcpath: %s',cluster.etcpath));
 			disp(sprintf('    valgrind: %s',cluster.valgrind));
 			disp(sprintf('    valgrindlib: %s',cluster.valgrindlib));
 			disp(sprintf('    valgrindsup: %s',cluster.valgrindsup));
@@ -89,9 +71,18 @@
 			end
 		end
 		%}}}
-		function BuildQueueScript(cluster,dirname,modelname,solution,io_gather,isvalgrind,isgprof) % {{{
+		function BuildQueueScript(cluster,dirname,modelname,solution,io_gather,isvalgrind,isgprof,isdakota) % {{{
 
 			%write queuing script 
+			%what is the executable being called? 
+			executable='issm.exe';
+			if isdakota,
+				version=IssmConfig('_DAKOTA_VERSION_'); version=str2num(version(1:3));
+				if (version>=6),
+					executable='issm_dakota.exe';
+				end
+			end
+
 			if ~ispc(),
 
 				fid=fopen([modelname '.queue'],'w');
@@ -99,15 +90,15 @@
 				if ~isvalgrind,
 					if cluster.interactive
 						if IssmConfig('_HAVE_MPI_'),
-							fprintf(fid,'mpiexec -np %i %s/issm.exe %s %s %s \n',cluster.np,cluster.codepath,EnumToString(solution),[cluster.executionpath '/' dirname],modelname);
+							fprintf(fid,'mpiexec -np %i %s/%s %s %s %s \n',cluster.np,cluster.codepath,executable,EnumToString(solution),[cluster.executionpath '/' dirname],modelname);
 						else
-							fprintf(fid,'%s/issm.exe %s %s %s ',cluster.codepath,EnumToString(solution),[cluster.executionpath '/' dirname],modelname);
+							fprintf(fid,'%s/%s %s %s %s ',cluster.codepath,executable,EnumToString(solution),[cluster.executionpath '/' dirname],modelname);
 						end
 					else
 						if IssmConfig('_HAVE_MPI_'),
-							fprintf(fid,'mpiexec -np %i %s/issm.exe %s %s %s 2> %s.errlog >%s.outlog ',cluster.np,cluster.codepath,EnumToString(solution),[cluster.executionpath '/' dirname],modelname,modelname,modelname);
+							fprintf(fid,'mpiexec -np %i %s/%s %s %s %s 2> %s.errlog >%s.outlog &',cluster.np,cluster.codepath,executable,EnumToString(solution),[cluster.executionpath '/' dirname],modelname,modelname,modelname);
 						else
-							fprintf(fid,'%s/issm.exe %s %s %s 2> %s.errlog >%s.outlog ',cluster.codepath,EnumToString(solution),[cluster.executionpath '/' dirname],modelname,modelname,modelname);
+							fprintf(fid,'%s/%s %s %s %s 2> %s.errlog >%s.outlog &',cluster.codepath,executable,EnumToString(solution),[cluster.executionpath '/' dirname],modelname,modelname,modelname);
 						end
 					end
 				elseif isgprof,
@@ -117,18 +108,18 @@
 					fprintf(fid,'LD_PRELOAD=%s \\\n',cluster.valgrindlib);
 					if ismac, 
 						if IssmConfig('_HAVE_MPI_'),
-							fprintf(fid,'mpiexec -np %i %s --leak-check=full --dsymutil=yes --suppressions=%s %s/issm.exe %s %s %s 2> %s.errlog >%s.outlog ',...
+							fprintf(fid,'mpiexec -np %i %s --leak-check=full --error-limit=no --dsymutil=yes --suppressions=%s %s/issm.exe %s %s %s 2> %s.errlog >%s.outlog ',...
 							cluster.np,cluster.valgrind,cluster.valgrindsup,cluster.codepath,EnumToString(solution),[cluster.executionpath '/' dirname], modelname,modelname,modelname);
 						else
-							fprintf(fid,'%s --leak-check=full --dsymutil=yes --suppressions=%s %s/issm.exe %s %s %s 2> %s.errlog >%s.outlog ',...
+							fprintf(fid,'%s --leak-check=full --dsymutil=yes --error-limit=no --suppressions=%s %s/issm.exe %s %s %s 2> %s.errlog >%s.outlog ',...
 							cluster.valgrind,cluster.valgrindsup,cluster.codepath,EnumToString(solution),[cluster.executionpath '/' dirname], modelname,modelname,modelname);
 						end
 					else
 						if IssmConfig('_HAVE_MPI_'),
-							fprintf(fid,'mpiexec -np %i %s --leak-check=full --suppressions=%s %s/issm.exe %s %s %s 2> %s.errlog >%s.outlog ',...
+							fprintf(fid,'mpiexec -np %i %s --leak-check=full --error-limit=no --suppressions=%s %s/issm.exe %s %s %s 2> %s.errlog >%s.outlog ',...
 							cluster.np,cluster.valgrind,cluster.valgrindsup,cluster.codepath,EnumToString(solution),[cluster.executionpath '/' dirname],modelname,modelname,modelname);
 						else
-							fprintf(fid,'%s --leak-check=full --suppressions=%s %s/issm.exe %s %s %s 2> %s.errlog >%s.outlog ',...
+							fprintf(fid,'%s --leak-check=full --error-limit=no --suppressions=%s %s/issm.exe %s %s %s 2> %s.errlog >%s.outlog ',...
 							cluster.valgrind,cluster.valgrindsup,cluster.codepath,EnumToString(solution),[cluster.executionpath '/' dirname],modelname,modelname,modelname);
 						end
 					end
@@ -143,8 +134,10 @@
 				fid=fopen([modelname '.bat'],'w');
 				fprintf(fid,'@echo off\n');
 
-				warning('parallel runs not allowed yet in Windows. Defaulting to 1 cpus');
-				cluster.np=1;
+				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/issm.exe" %s ./ %s ',cluster.np,cluster.codepath,EnumToString(solution),modelname);
@@ -161,6 +154,57 @@
 			end
 		end
 		%}}}
+		function BuildQueueScriptMultipleModels(cluster,dirname,modelname,solution,dirnames,modelnames,nps) % {{{
+		
+			%some checks: 
+			if isempty(modelname), error('BuildQueueScriptMultipleModels error message: need a non empty model name!');end
+
+			%what is the executable being called? 
+			executable='issm_slr.exe';
+
+			if ispc(), error('BuildQueueScriptMultipleModels not support yet on windows machines');end;
+			
+			%write queuing script 
+			fid=fopen([modelname '.queue'],'w');
+			
+			fprintf(fid,'#!%s\n',cluster.shell);
+
+			%number of cpus: 
+			mpistring=sprintf('mpiexec -np %i ',cluster.np);
+
+			%executable: 
+			mpistring=[mpistring sprintf('%s/%s ',cluster.codepath,executable)];
+			
+			%solution name: 
+			mpistring=[mpistring sprintf('%s ',EnumToString(solution))];
+
+			%execution directory and model name: 
+			mpistring=[mpistring sprintf('%s/%s %s',cluster.executionpath,dirname,modelname)];
+
+			%inform main executable of how many icecaps, glaciers and earth models are being run: 
+			mpistring=[mpistring sprintf(' %i ',length(dirnames))];
+			
+			%icecaps, glaciers and earth location, names and number of processors associated:
+			for i=1:length(dirnames),
+			mpistring=[mpistring sprintf(' %s/%s %s %i ',cluster.executionpath,dirnames{i},modelnames{i},nps{i})];
+			end
+
+			%log files: 
+			if ~cluster.interactive,
+				mpistring=[mpistring sprintf('2> %s.errlog> %s.outlog',modelname,modelname)];
+			end
+
+			%write this long string to disk: 
+			fprintf(fid,mpistring);
+			fclose(fid);
+
+			%in interactive mode, create a run file, and errlog and outlog file
+			if cluster.interactive,
+				fid=fopen([modelname '.errlog'],'w'); fclose(fid);
+				fid=fopen([modelname '.outlog'],'w'); fclose(fid);
+			end
+		end
+		%}}}
 		function BuildKrigingQueueScript(cluster,modelname,solution,io_gather,isvalgrind,isgprof) % {{{
 
 			%write queuing script 
@@ -207,17 +251,10 @@
 			end
 		end
 		%}}}
-		function LaunchQueueJob(cluster,modelname,dirname,filelist)% {{{
+		function UploadQueueJob(cluster,modelname,dirname,filelist)% {{{
 
 			if ~ispc,
 
-				%figure out what shell extension we will use:
-				if isempty(strfind(cluster.shell,'csh')),
-					shellext='sh';
-				else
-					shellext='csh';
-				end
-
 				%compress the files into one zip.
 				compressstring=['tar -zcf ' dirname '.tar.gz '];
 				for i=1:numel(filelist),
@@ -230,14 +267,37 @@
 
 				if cluster.verbose, disp('uploading input file and queueing script'); end
 				issmscpout(cluster.name,cluster.executionpath,cluster.login,cluster.port,{[dirname '.tar.gz']});
+			end
+		end %}}}
+		function LaunchQueueJob(cluster,modelname,dirname,filelist,restart,batch)% {{{
 
+			if ~ispc,
+
+				%figure out what shell extension we will use:
+				if isempty(strfind(cluster.shell,'csh')),
+					shellext='sh';
+				else
+					shellext='csh';
+				end
+
 				if cluster.verbose, disp('launching solution sequence on remote cluster'); end
-				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 '];
+
+				if ~isempty(restart)
+					launchcommand=['source ' cluster.etcpath '/environment.' shellext ' && cd ' cluster.executionpath ' && cd ' dirname ' && source ' modelname '.queue '];
+				else
+					if ~batch,
+					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 ...
+						' && cd ' dirname ' && mv ../' dirname '.tar.gz ./ && tar -zxf ' dirname '.tar.gz '];
+					end
+				end
 				issmssh(cluster.name,cluster.login,cluster.port,launchcommand);
 			else
 				system([modelname '.bat']);
 			end
+
 		end %}}}
 		function Download(cluster,dirname,filelist)% {{{
 

Modified: issm/trunk/src/m/classes/clusters/generic.py
===================================================================
--- issm/trunk/src/m/classes/clusters/generic.py	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/classes/clusters/generic.py	2016-04-13 04:32:01 UTC (rev 20500)
@@ -68,8 +68,15 @@
 
 		return md
 	# }}}
-	def BuildQueueScript(self,dirname,modelname,solution,io_gather,isvalgrind,isgprof):    # {{{
+	def BuildQueueScript(self,dirname,modelname,solution,io_gather,isvalgrind,isgprof,isdakota):    # {{{
 
+		executable='issm.exe';
+		if isdakota:
+			version=IssmConfig('_DAKOTA_VERSION_')[0:2]
+			version=float(version)
+			if version>=6:
+				executable='issm_dakota.exe'
+
 		#write queuing script 
 		if not m.ispc():
 
@@ -78,25 +85,25 @@
 			if not isvalgrind:
 				if self.interactive: 
 					if IssmConfig('_HAVE_MPI_')[0]:
-						fid.write('mpiexec -np %i %s/issm.exe %s %s/%s %s ' % (self.np,self.codepath,EnumToString(solution)[0],self.executionpath,dirname,modelname))
+						fid.write('mpiexec -np %i %s/%s %s %s/%s %s ' % (self.np,self.codepath,executable,EnumToString(solution)[0],self.executionpath,dirname,modelname))
 					else:
-						fid.write('%s/issm.exe %s %s/%s %s ' % (self.codepath,EnumToString(solution)[0],self.executionpath,dirname,modelname))
+						fid.write('%s/%s %s %s/%s %s ' % (self.codepath,executable,EnumToString(solution)[0],self.executionpath,dirname,modelname))
 				else:
 					if IssmConfig('_HAVE_MPI_')[0]:
-						fid.write('mpiexec -np %i %s/issm.exe %s %s/%s %s 2> %s.errlog >%s.outlog ' % (self.np,self.codepath,EnumToString(solution)[0],self.executionpath,dirname,modelname,modelname,modelname))
+						fid.write('mpiexec -np %i %s/%s %s %s/%s %s 2> %s.errlog >%s.outlog ' % (self.np,self.codepath,executable,EnumToString(solution)[0],self.executionpath,dirname,modelname,modelname,modelname))
 					else:
-						fid.write('%s/issm.exe %s %s/%s %s 2> %s.errlog >%s.outlog ' % (self.codepath,EnumToString(solution)[0],self.executionpath,dirname,modelname,modelname,modelname))
+						fid.write('%s/%s %s %s/%s %s 2> %s.errlog >%s.outlog ' % (self.codepath,executable,EnumToString(solution)[0],self.executionpath,dirname,modelname,modelname,modelname))
 			elif isgprof:
-				fid.write('\n gprof %s/issm.exe gmon.out > %s.performance' % (self.codepath,modelname))
+				fid.write('\n gprof %s/%s gmon.out > %s.performance' % (self.codepath,executable,modelname))
 			else:
 				#Add --gen-suppressions=all to get suppression lines
 				fid.write('LD_PRELOAD=%s \\\n' % self.valgrindlib)
 				if IssmConfig('_HAVE_MPI_')[0]:
-					fid.write('mpiexec -np %i %s --leak-check=full --suppressions=%s %s/issm.exe %s %s/%s %s 2> %s.errlog >%s.outlog ' % \
-							(self.np,self.valgrind,self.valgrindsup,self.codepath,EnumToString(solution)[0],self.executionpath,dirname,modelname,modelname,modelname))
+					fid.write('mpiexec -np %i %s --leak-check=full --suppressions=%s %s/%s %s %s/%s %s 2> %s.errlog >%s.outlog ' % \
+							(self.np,self.valgrind,self.valgrindsup,self.codepath,executable,EnumToString(solution)[0],self.executionpath,dirname,modelname,modelname,modelname))
 				else:	
-					fid.write('%s --leak-check=full --suppressions=%s %s/issm.exe %s %s/%s %s 2> %s.errlog >%s.outlog ' % \
-							(self.valgrind,self.valgrindsup,self.codepath,EnumToString(solution)[0],self.executionpath,dirname,modelname,modelname,modelname))
+					fid.write('%s --leak-check=full --suppressions=%s %s/%s %s %s/%s %s 2> %s.errlog >%s.outlog ' % \
+							(self.valgrind,self.valgrindsup,self.codepath,executable,EnumToString(solution)[0],self.executionpath,dirname,modelname,modelname,modelname))
 
 			if not io_gather:    #concatenate the output files:
 				fid.write('\ncat %s.outbin.* > %s.outbin' % (modelname,modelname))
@@ -107,10 +114,10 @@
 			fid=open(modelname+'.bat','w')
 			fid.write('@echo off\n')
 			if self.interactive:
-				fid.write('"%s/issm.exe" %s "%s/%s" %s ' % (self.codepath,EnumToString(solution)[0],self.executionpath,dirname,modelname))
+				fid.write('"%s/%s" %s "%s/%s" %s ' % (self.codepath,executable,EnumToString(solution)[0],self.executionpath,dirname,modelname))
 			else:
-				fid.write('"%s/issm.exe" %s "%s/%s" %s 2> %s.errlog >%s.outlog' % \
-					(self.codepath,EnumToString(solution)[0],self.executionpath,dirname,modelname,modelname,modelname))
+				fid.write('"%s/%s" %s "%s/%s" %s 2> %s.errlog >%s.outlog' % \
+					(self.codepath,executable,EnumToString(solution)[0],self.executionpath,dirname,modelname,modelname,modelname))
 			fid.close()
 
 		#in interactive mode, create a run file, and errlog and outlog file
@@ -161,7 +168,7 @@
 			fid=open(modelname+'.outlog','w')
 			fid.close()
 	# }}}
-	def LaunchQueueJob(self,modelname,dirname,filelist):    # {{{
+	def UploadQueueJob(self,modelname,dirname,filelist):    # {{{
 
 		#compress the files into one zip.
 		compressstring='tar -zcf %s.tar.gz ' % dirname
@@ -174,9 +181,19 @@
 		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'
-		launchcommand='cd %s && rm -rf ./%s && mkdir %s && cd %s && mv ../%s.tar.gz ./ && tar -zxf %s.tar.gz  && chmod 777 %s.queue && ./%s.queue' % \
-			(self.executionpath,dirname,dirname,dirname,dirname,dirname,modelname,modelname)
+		if restart:
+			launchcommand='cd %s && cd %s chmod 777 %s.queue && ./%s.queue' % (self.executionpath,dirname,modelname,modelname)
+		else:
+			if batch:
+				launchcommand='cd %s && rm -rf ./%s && mkdir %s && cd %s && mv ../%s.tar.gz ./ && tar -zxf %s.tar.gz' % \
+						(self.executionpath,dirname,dirname,dirname,dirname,dirname)
+			else:
+				launchcommand='cd %s && rm -rf ./%s && mkdir %s && cd %s && mv ../%s.tar.gz ./ && tar -zxf %s.tar.gz  && chmod 777 %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):     # {{{

Modified: issm/trunk/src/m/classes/clusters/generic_static.m
===================================================================
--- issm/trunk/src/m/classes/clusters/generic_static.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/classes/clusters/generic_static.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -48,7 +48,7 @@
 			end
 		end
 		%}}}
-		function BuildQueueScript(cluster,dirname,modelname,solution,io_gather,isvalgrind,isgprof) % {{{
+		function BuildQueueScript(cluster,dirname,modelname,solution,io_gather,isvalgrind,isgprof,isdakota) % {{{
 
 			%write queuing script 
 			fid=fopen([modelname '.queue'],'w');
@@ -61,8 +61,12 @@
 			fid=fopen([modelname '.outlog'],'w'); fclose(fid);
 		end
 		%}}}
-		function LaunchQueueJob(cluster,modelname,dirname,filelist)% {{{
+		function UploadQueueJob(cluster,modelname,dirname,filelist)% {{{
 
+			%do nothing
+		end %}}}
+		function LaunchQueueJob(cluster,modelname,dirname,filelist,restart,batch)% {{{
+
 			if ~ispc,
 
 				%figure out what shell extension we will use:

Modified: issm/trunk/src/m/classes/clusters/greenplanet.m
===================================================================
--- issm/trunk/src/m/classes/clusters/greenplanet.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/classes/clusters/greenplanet.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -20,10 +20,7 @@
 		 time          = 24*60;
 		 memory        = 2;
 	 end
-	 properties (SetAccess=private) 
-		 np=20*8;
-		 % }}}
-	 end
+	 %}}}
 	 methods
 		 function cluster=greenplanet(varargin) % {{{
 
@@ -51,6 +48,11 @@
 			 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) % {{{
 
 			 available_queues={'c6145','default'};
@@ -71,9 +73,6 @@
 			 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;
-
 			 %write queuing script 
 			 fid=fopen([modelname '.queue'],'w');
 			 fprintf(fid,'#PBS -S /bin/bash\n');
@@ -96,27 +95,21 @@
 			 fclose(fid);
 		 end
 		 %}}}
-		 function BuildQueueScript(cluster,dirname,modelname,solution,io_gather,isvalgrind,isgprof) % {{{
+		 function BuildQueueScript(cluster,dirname,modelname,solution,io_gather,isvalgrind,isgprof,isdakota) % {{{
 
 			 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;
-
 			 %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 -q %s \n',cluster.queue);
-			 fprintf(fid,'#PBS -l nodes=%i:ppn=%i\n',cluster.numnodes, ...
-							 cluster.cpuspernode);
-			 fprintf(fid,'#PBS -l walltime=%i\n',cluster.time*60); %walltime is in seconds.
-			 fprintf(fid,'#PBS -l mem=%igb\n',cluster.memory);
-			 fprintf(fid,'#PBS -m bea\n');
-			 fprintf(fid,'#PBS -M mmorligh at uci.edu\n');
-			 fprintf(fid,'#PBS -o %s.outlog \n',modelname);
-			 fprintf(fid,'#PBS -e %s.errlog \n\n',modelname);
+			 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);
@@ -140,7 +133,7 @@
 				 fclose(fid);
 			 end
 		 end %}}}
-		 function LaunchQueueJob(cluster,modelname,dirname,filelist)% {{{
+		 function UploadQueueJob(cluster,modelname,dirname,filelist)% {{{
 
 			 %compress the files into one zip.
 			 compressstring=['tar -zcf ' dirname '.tar.gz '];
@@ -155,9 +148,16 @@
 			 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)% {{{
+
 			 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 '];
+			 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)% {{{

Modified: issm/trunk/src/m/classes/clusters/hpc.m
===================================================================
--- issm/trunk/src/m/classes/clusters/hpc.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/classes/clusters/hpc.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -1,4 +1,4 @@
-%PFE class definition
+%HPC class definition
 %
 %   Usage:
 %      cluster=hpc();
@@ -18,10 +18,7 @@
 		 executionpath='';
 		 interactive=0;
 	 end
-	 properties (SetAccess=private) 
-		 np=20*8;
-		 % }}}
-	 end
+	 %}}}
 	 methods
 		 function cluster=hpc(varargin) % {{{
 
@@ -47,6 +44,11 @@
 			 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) % {{{
 
 			 available_queues={'pub64','free64','free48','free*,pub64','free*'};
@@ -67,9 +69,6 @@
 			 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;
-
 			 %write queuing script 
 			 fid=fopen([modelname '.queue'],'w');
 			 fprintf(fid,'#!/bin/bash\n');
@@ -90,14 +89,11 @@
 			 fclose(fid);
 		 end
 		 %}}}
-		 function BuildQueueScript(cluster,dirname,modelname,solution,io_gather,isvalgrind,isgprof) % {{{
+		 function BuildQueueScript(cluster,dirname,modelname,solution,io_gather,isvalgrind,isgprof,isdakota) % {{{
 
 			 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;
-
 			 %write queuing script 
 			 fid=fopen([modelname '.queue'],'w');
 			 fprintf(fid,'#!/bin/bash\n');
@@ -131,7 +127,7 @@
 				 fclose(fid);
 			 end
 		 end %}}}
-		 function LaunchQueueJob(cluster,modelname,dirname,filelist)% {{{
+		 function UploadQueueJob(cluster,modelname,dirname,filelist)% {{{
 
 			 %compress the files into one zip.
 			 compressstring=['tar -zcf ' dirname '.tar.gz '];
@@ -146,9 +142,16 @@
 			 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)% {{{
+
 			 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 '];
+			 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)% {{{

Modified: issm/trunk/src/m/classes/clusters/pfe.m
===================================================================
--- issm/trunk/src/m/classes/clusters/pfe.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/classes/clusters/pfe.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -10,6 +10,7 @@
 		 % {{{
 		 name           = 'pfe'
 		 login          = '';
+		 modules        = {'comp-intel/2015.0.090' 'mpi-sgi/mpt.2.12r16'};
 		 numnodes       = 20;
 		 cpuspernode    = 8;
 		 port           = 1025;
@@ -24,10 +25,7 @@
 		 numstreams     = 8;
 		 hyperthreading = 0;
 	 end
-	 properties (SetAccess=private) 
-		 np=20*8;
-		 % }}}
-	 end
+	 %}}}
 	 methods
 		 function cluster=pfe(varargin) % {{{
 
@@ -43,6 +41,8 @@
 			 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));
@@ -57,6 +57,11 @@
 			 disp(sprintf('    hyperthreading: %i',cluster.hyperthreading));
 		 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','normal','debug','devel','alphatst at pbspl233'};
@@ -66,18 +71,8 @@
 			 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,'har') | strcmpi(cluster.processor,'neh')),
+			 if strcmpi(cluster.processor,'wes'),
 				 if cluster.hyperthreading,
-					 if ((cluster.cpuspernode>16 ) | (cluster.cpuspernode<1)),
-						 md = checkmessage(md,'cpuspernode should be between 1 and 16 for ''neh'' and ''har'' processors in hyperthreading mode');
-					 end
-				 else
-					 if ((cluster.cpuspernode>8 ) | (cluster.cpuspernode<1)),
-						 md = checkmessage(md,'cpuspernode should be between 1 and 8 for ''neh'' and ''har'' processors');
-					 end
-				 end
-			 elseif strcmpi(cluster.processor,'wes'),
-				 if cluster.hyperthreading,
 					 if ((cluster.cpuspernode>24 ) | (cluster.cpuspernode<1)),
 						 md = checkmessage(md,'cpuspernode should be between 1 and 24 for ''wes'' processors in hyperthreading mode');
 					 end
@@ -96,9 +91,31 @@
 						 md = checkmessage(md,'cpuspernode should be between 1 and 20 for ''ivy'' processors');
 					 end
 				 end
+			 
+			 elseif strcmpi(cluster.processor,'has'),
+				 if cluster.hyperthreading,
+					 if ((cluster.cpuspernode>48 ) | (cluster.cpuspernode<1)),
+						 md = checkmessage(md,'cpuspernode should be between 1 and 48 for ''has'' processors in hyperthreading mode');
+					 end
+				 else
+					 if ((cluster.cpuspernode>24 ) | (cluster.cpuspernode<1)),
+						 md = checkmessage(md,'cpuspernode should be between 1 and 24 for ''has'' processors');
+					 end
+				 end
+			 
+			 elseif strcmpi(cluster.processor,'san'),
+				 if cluster.hyperthreading,
+					 if ((cluster.cpuspernode>32 ) | (cluster.cpuspernode<1)),
+						 md = checkmessage(md,'cpuspernode should be between 1 and 32 for ''san'' processors in hyperthreading mode');
+					 end
+				 else
+					 if ((cluster.cpuspernode>16 ) | (cluster.cpuspernode<1)),
+						 md = checkmessage(md,'cpuspernode should be between 1 and 16 for ''san'' processors');
+					 end
+				 end
 
 			 else
-				 md = checkmessage(md,'unknown processor type, should be ''neh'',''wes'' or ''har'' or ''ivy''');
+				 md = checkmessage(md,'unknown processor type, should be ''wes'' or ''has'' or ''ivy'' or ''san''');
 			 end
 
 			 %Miscelaneous
@@ -109,12 +126,17 @@
 
 		 end
 		 %}}}
-		 function BuildQueueScript(cluster,dirname,modelname,solution,io_gather,isvalgrind,isgprof) % {{{
+		 function BuildQueueScript(cluster,dirname,modelname,solution,io_gather,isvalgrind,isgprof,isdakota) % {{{
 
 			 if(isgprof),    disp('gprof not supported by cluster, ignoring...'); end
 
-			 %compute number of processors
-			 cluster.np=cluster.numnodes*cluster.cpuspernode;
+			 executable='issm.exe';
+			 if isdakota,
+				 version=IssmConfig('_DAKOTA_VERSION_'); version=str2num(version(1:3));
+				 if (version>=6),
+					 executable='issm_dakota.exe';
+				 end
+			 end
 
 			 %write queuing script 
 			 fid=fopen([modelname '.queue'],'w');
@@ -129,16 +151,16 @@
 			 fprintf(fid,'#PBS -e %s.errlog \n\n',[cluster.executionpath '/' dirname '/' modelname]);
 			 fprintf(fid,'. /usr/share/modules/init/bash\n\n');
 			 fprintf(fid,'module load comp-intel/2015.0.090\n');
-			 fprintf(fid,'module load mpi-sgi/mpt.2.11r13\n');
+			 fprintf(fid,'module load mpi-sgi/mpt.2.12r16\n');
 			 fprintf(fid,'export PATH="$PATH:."\n\n');
 			 fprintf(fid,'export MPI_GROUP_MAX=64\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);
 			 if ~isvalgrind,
-				 fprintf(fid,'mpiexec -np %i %s/issm.exe %s %s %s\n',cluster.np,cluster.codepath,EnumToString(solution),[cluster.executionpath '/' dirname],modelname);
+				 fprintf(fid,'mpiexec -np %i %s/%s %s %s %s\n',cluster.np,cluster.codepath,executable,EnumToString(solution),[cluster.executionpath '/' dirname],modelname);
 			 else
-				 fprintf(fid,'mpiexec -np %i valgrind --leak-check=full %s/issm.exe %s %s %s\n',cluster.np,cluster.codepath,EnumToString(solution),[cluster.executionpath '/' dirname],modelname);
+				 fprintf(fid,'mpiexec -np %i valgrind --leak-check=full %s/%s %s %s %s\n',cluster.np,cluster.codepath,executable,EnumToString(solution),[cluster.executionpath '/' dirname],modelname);
 			 end
 			 if ~io_gather, %concatenate the output files:
 				 fprintf(fid,'cat %s.outbin.* > %s.outbin',modelname,modelname);
@@ -148,10 +170,15 @@
 			 %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/issm.exe %s %s %s\n',cluster.np,cluster.codepath,EnumToString(solution),[cluster.executionpath '/Interactive' num2str(cluster.interactive)],modelname);
+				 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,EnumToString(solution),[pwd() '/run'],modelname);
 				 else
-					 fprintf(fid,'mpiexec -np %i valgrind --leak-check=full %s/issm.exe %s %s %s\n',cluster.np,cluster.codepath,EnumToString(solution),[cluster.executionpath '/Interactive' num2str(cluster.interactive)],modelname);
+					 if ~isvalgrind,
+						 fprintf(fid,'mpiexec -np %i %s/%s %s %s %s\n',cluster.np,cluster.codepath,executable,EnumToString(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,EnumToString(solution),[cluster.executionpath '/Interactive' num2str(cluster.interactive)],modelname);
+					 end
 				 end
 				 if ~io_gather, %concatenate the output files:
 					 fprintf(fid,'cat %s.outbin.* > %s.outbin',modelname,modelname);
@@ -163,13 +190,99 @@
 				 fclose(fid);
 			 end
 		 end %}}}
+		function BuildQueueScriptMultipleModels(cluster,dirname,modelname,solution,dirnames,modelnames,nps) % {{{
+		
+			%some checks: 
+			if isempty(modelname), error('BuildQueueScriptMultipleModels error message: need a non empty model name!');end
+
+			%what is the executable being called? 
+			executable='issm_slr.exe';
+
+			if ispc(), error('BuildQueueScriptMultipleModels not support yet on windows machines');end;
+			
+			%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: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 -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,'. /usr/share/modules/init/bash\n\n');
+			fprintf(fid,'module load comp-intel/2015.0.090\n');
+			fprintf(fid,'module load mpi-sgi/mpt.2.12r16\n');
+			fprintf(fid,'export PATH="$PATH:."\n\n');
+			fprintf(fid,'export MPI_GROUP_MAX=64\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);
+
+			%number of cpus: 
+			mpistring=sprintf('mpiexec -np %i ',cluster.numnodes*cluster.cpuspernode);
+
+			%executable: 
+			mpistring=[mpistring sprintf('%s/%s ',cluster.codepath,executable)];
+			
+			%solution name: 
+			mpistring=[mpistring sprintf('%s ',EnumToString(solution))];
+
+			%execution directory and model name: 
+			mpistring=[mpistring sprintf('%s/%s %s',cluster.executionpath,dirname,modelname)];
+
+			%inform main executable of how many icecaps, glaciers and earth models are being run: 
+			mpistring=[mpistring sprintf(' %i ',length(dirnames))];
+			
+			%icecaps, glaciers and earth location, names and number of processors associated:
+			for i=1:length(dirnames),
+			mpistring=[mpistring sprintf(' %s/%s %s %i ',cluster.executionpath,dirnames{i},modelnames{i},nps{i})];
+			end
+
+			%write this long string to disk: 
+			fprintf(fid,mpistring);
+			fclose(fid);
+			
+			if cluster.interactive,
+				fid=fopen([modelname '.run'],'w');
+				
+				%number of cpus: 
+				mpistring=sprintf('mpiexec -np %i ',cluster.numnodes*cluster.cpuspernode);
+
+				%executable: 
+				mpistring=[mpistring sprintf('%s/%s ',cluster.codepath,executable)];
+
+				%solution name: 
+				mpistring=[mpistring sprintf('%s ',EnumToString(solution))];
+
+				%execution directory and model name: 
+				mpistring=[mpistring sprintf('%s/%s %s',cluster.executionpath,dirname,modelname)];
+
+				%inform main executable of how many icecaps, glaciers and earth models are being run: 
+				mpistring=[mpistring sprintf(' %i ',length(dirnames))];
+
+				%icecaps, glaciers and earth location, names and number of processors associated:
+				for i=1:length(dirnames),
+					mpistring=[mpistring sprintf(' %s/Interactive%i %s %i ',cluster.executionpath,cluster.interactive,modelnames{i},nps{i})];
+				end
+						 
+				%write this long string to disk: 
+				fprintf(fid,mpistring);
+				fclose(fid);
+
+				fid=fopen([modelname '.errlog'],'w');
+				fclose(fid);
+				fid=fopen([modelname '.outlog'],'w');
+				fclose(fid);
+			 end
+		end
+		%}}}
 		 function BuildKrigingQueueScript(cluster,modelname,solution,io_gather,isvalgrind,isgprof) % {{{
 
 			 if(isgprof),    disp('gprof not supported by cluster, ignoring...'); end
 
-			 %compute number of processors
-			 cluster.np=cluster.numnodes*cluster.cpuspernode;
-
 			 %write queuing script 
 			 fid=fopen([modelname '.queue'],'w');
 			 fprintf(fid,'#PBS -S /bin/bash\n');
@@ -182,8 +295,9 @@
 			 fprintf(fid,'#PBS -o %s.outlog \n',modelname);
 			 fprintf(fid,'#PBS -e %s.errlog \n\n',modelname);
 			 fprintf(fid,'. /usr/share/modules/init/bash\n\n');
-			 fprintf(fid,'module load comp-intel/2015.0.090\n');
-			 fprintf(fid,'module load mpi-sgi/mpt.2.11r13\n');
+			 for i=1:numel(cluster.modules),
+				 fprintf(fid,['module load ' cluster.modules{i} '\n']);
+			 end
 			 fprintf(fid,'export PATH="$PATH:."\n');
 			 fprintf(fid,'export ISSM_DIR="%s/../"\n',cluster.codepath); %FIXME
 			 fprintf(fid,'source $ISSM_DIR/etc/environment.sh\n');       %FIXME
@@ -219,7 +333,7 @@
 			 fid=fopen([modelname '.queue'],'w');
 			 fprintf(fid,'#PBS -S /bin/bash\n');
 			 fprintf(fid,'#PBS -l select=1:ncpus=%i:model=%s\n',np,cluster.processor);
-			 fprintf(fid,'#PBS -l walltime=%i\n',cluster.time); %walltime is in seconds.
+			 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 -W group_list=%s\n',cluster.grouplist);
 			 fprintf(fid,'#PBS -m e\n');
@@ -240,8 +354,21 @@
 		%	 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,'module load mpi-mvapich2/1.4.1/gcc\n');
+				 fprintf(fid,['mpiexec -np %i ./mitgcmuv \n'],np);
+				 fprintf(fid,['touch ' modelname '.lock %s\n']);
+				 fclose(fid);
+				 fid=fopen([modelname '.errlog'],'w');
+				 fclose(fid);
+				 fid=fopen([modelname '.outlog'],'w');
+				 fclose(fid);
+			 end
+
 		 end %}}}
-		 function LaunchQueueJob(cluster,modelname,dirname,filelist)% {{{
+		 function UploadQueueJob(cluster,modelname,dirname,filelist)% {{{
 
 			 %compress the files into one zip.
 			 compressstring=['tar -zcf ' dirname '.tar.gz '];
@@ -254,7 +381,9 @@
 			 system(compressstring);
 
 			 disp('uploading input file and queueing script');
-			 if cluster.interactive,
+			 if cluster.interactive==10,
+				 directory=[pwd() '/run/'];
+			 elseif cluster.interactive,
 				 directory=[cluster.executionpath '/Interactive' num2str(cluster.interactive)];
 			 else 
 				 directory=cluster.executionpath;
@@ -266,12 +395,28 @@
 				 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, 
-				 launchcommand=['cd ' cluster.executionpath ' && rm -rf ./' dirname ' && mkdir ' dirname ...
-					 ' && cd ' dirname ' && mv ../' dirname '.tar.gz ./ && tar -zxf ' dirname '.tar.gz  && qsub ' modelname '.queue '];
+				 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
-				 launchcommand=['cd ' cluster.executionpath '/Interactive' num2str(cluster.interactive) ' && tar -zxf ' dirname '.tar.gz'];
+				 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');
@@ -281,7 +426,9 @@
 		 function Download(cluster,dirname,filelist)% {{{
 
 			 %copy files from cluster to current directory
-			 if ~cluster.interactive,
+			 if cluster.interactive==10,
+				 directory=[pwd() '/run/'];
+			 elseif ~cluster.interactive,
 				 directory=[cluster.executionpath '/' dirname '/'];
 			 else
 				 directory=[cluster.executionpath '/Interactive' num2str(cluster.interactive) '/'];

Modified: issm/trunk/src/m/classes/clusters/pollux.m
===================================================================
--- issm/trunk/src/m/classes/clusters/pollux.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/classes/clusters/pollux.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -45,7 +45,7 @@
 			 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) % {{{
+		 function BuildQueueScript(cluster,dirname,modelname,solution,io_gather,isvalgrind,isgprof,isdakota) % {{{
 
 			 if(isvalgrind), disp('valgrind not supported by cluster, ignoring...'); end
 			 if(isgprof),    disp('gprof not supported by cluster, ignoring...'); end
@@ -69,8 +69,19 @@
 
 		 end
 		 %}}}
-		 function LaunchQueueJob(cluster,modelname,dirname,filelist)% {{{
+		 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)% {{{
+
 			 %compress the files into one zip.
 			 compressstring=['tar -zcf ' dirname '.tar.gz '];
 			 for i=1:numel(filelist),
@@ -81,13 +92,6 @@
 			 end
 			 system(compressstring);
 
-			 disp('uploading input file and queueing script');
-			 issmscpout(cluster.name,cluster.executionpath,cluster.login,cluster.port,{[dirname '.tar.gz']});
-
-			 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  && qsub ' modelname '.queue '];
-			 issmssh(cluster.name,cluster.login,cluster.port,launchcommand);
 		 end %}}}
 		 function Download(cluster,dirname,filelist)% {{{
 

Modified: issm/trunk/src/m/classes/constants.m
===================================================================
--- issm/trunk/src/m/classes/constants.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/classes/constants.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -11,13 +11,6 @@
 		referencetemperature = 0.;
 	end
 	methods
-        function createxml(self,fid) % {{{
-            fprintf(fid, '\n\n');
-            fprintf(fid, '%s\n', '<!-- constants -->');
-			 fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="g" type="',class(self.g),'" default="',num2str(self.g),'">','     <section name="constants" />','     <help> gravitational acceleration [m/s^2] </help>','</parameter>');
-             fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="yts" type="',class(self.yts),'" default="',num2str(self.yts),'">','     <section name="constants" />','     <help> number of seconds in a year [s/yr] </help>','</parameter>');
-             fprintf(fid,'%s%s%s%s%s\n%s\n%s\n','<parameter key ="referencetemperature" type="',class(self.referencetemperature),'" default="',num2str(self.referencetemperature),'">','     <section name="constants" />','     <help> reference temperature used in the enthalpy model [K] </help>','</parameter>');
-		end % }}}
 		function self = constants(varargin) % {{{
 			switch nargin
 				case 0
@@ -60,9 +53,16 @@
 		end % }}}
 		function marshall(self,md,fid) % {{{
 			WriteData(fid,'object',self,'fieldname','g','format','Double');
-			WriteData(fid,'object',self,'fieldname','omega','format','Double');
 			WriteData(fid,'object',self,'fieldname','yts','format','Double');
 			WriteData(fid,'object',self,'fieldname','referencetemperature','format','Double');
 		end % }}}
+		function savemodeljs(self,fid,modelname) % {{{
+		
+			writejsdouble(fid,[modelname '.constants.g'],self.g);
+			writejsdouble(fid,[modelname '.constants.omega'],self.omega);
+			writejsdouble(fid,[modelname '.constants.yts'],self.yts);
+			writejsdouble(fid,[modelname '.constants.referencetemperature'],self.referencetemperature);
+
+		end % }}}
 	end
 end

Modified: issm/trunk/src/m/classes/damage.m
===================================================================
--- issm/trunk/src/m/classes/damage.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/classes/damage.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -16,12 +16,10 @@
 		stabilization       = 0;
 		maxiter             = 0;
 		elementinterp       = '';
-		penalty_threshold   = 0;
-		penalty_lock        = 0;
-		penalty_factor      = 0;
 		
 		%general parameters for evolution law: 
 		stress_threshold    = 0;
+		kappa               = 0;
 		c1                  = 0;
 		c2                  = 0;
 		c3                  = 0;
@@ -31,59 +29,6 @@
 		requested_outputs   = {};
 	end
 	methods
-		function createxml(self,fid) % {{{
-			fprintf(fid, '\n\n');
-			fprintf(fid, '%s\n', '<!-- damage -->');
-			fprintf(fid, '%s\n', '<!-- Note: this class depends on different input of law -->');
-
-			%fprintf(fid,'%s%s%s%s\n%s\n%s\n%s\n',    '<parameter key ="law" type="logical"',           '" default="',                num2str(self.law),'">',   '     <section name="damage" />','     <help> damage law (string) from {"undamaged","pralong"} </help>','</parameter>');
-			% drop-down 
-			fprintf(fid,'%s%s%s%s%s\n\t%s\n','<parameter key ="law" type="','alternative','" optional="','false','">','<section name="damage" />');
-
-			% law = 'undamage'
-			fprintf(fid,'\t%s%s%s%s%s\n\t\t%s\n','<option value="undamage" type="','string','" default="','true','">','<help> law = undamage </help>');
-			% footer for option
-			fprintf(fid,'\t%s\n%s\n','</option>');
-
-			% law = 'pralong'
-			fprintf(fid,'\t%s%s%s%s%s\n\t\t%s\n','<option value="pralong" type="','string','" default="','false','">','<help> law = pralong </help>');
-
-			fprintf(fid,'\t\t%s%s%s%s%s\n\t\t\t%s\n\t\t%s\n',   '<parameter key ="stress_threshold" type="',class(self.stress_threshold),'" default="',num2str(self.stress_threshold),'">','<help> damage stress threshold [Pa] </help>','</parameter>');
-			fprintf(fid,'\t\t%s%s%s%s%s\n\t\t\t%s\n\t\t%s\n',	'<parameter key ="c1" type="', class(self.c1),'" default="',   num2str(self.c1),'">',   '<help> damage parameter 1 </help>','</parameter>');
-			fprintf(fid,'\t\t%s%s%s%s%s\n\t\t\t%s\n\t\t%s\n',  	'<parameter key ="c2" type="',          class(self.c2),'" default="',            num2str(self.c2),'">','<help> damage parameter 2 </help>','</parameter>');
-			fprintf(fid,'\t\t%s%s%s%s%s\n\t\t\t%s\n\t\t%s\n',  	'<parameter key ="c3" type="',          class(self.c3),'" default="',            num2str(self.c3),'">','<help> damage parameter 3 [W/m^2] </help>','</parameter>');
-			fprintf(fid,'\t\t%s%s%s%s%s\n\t\t\t%s\n\t\t%s\n',  	'<parameter key ="c4" type="',            class(self.c4),'" default="',              num2str(self.c4),'">','<help> damage parameter 4 </help>','</parameter>');
-			fprintf(fid,'\t\t%s%s%s%s%s\n\t\t\t%s\n\t\t%s\n',  	'<parameter key ="healing" type="', class(self.healing),'" default="',   num2str(self.healing),'">','<help> damage healing parameter 1 </help>','</parameter>');
-			fprintf(fid,'\t\t%s%s%s%s%s\n\t\t\t%s\n\t\t%s\n',  	'<parameter key ="equiv_stress" type="',          class(self.equiv_stress),'" default="',convert2str(self.equiv_stress),'">','<help> 0: von Mises </help>','</parameter>');
-			fprintf(fid,'\t\t%s%s%s%s%s\n\t\t\t%s\n\t\t%s\n',  	'<parameter key ="requested_outputs" type="',          class(self.requested_outputs),'" default="',convert2str(self.requested_outputs),'">','<help> additional outputs requested </help>','</parameter>');
-
-
-			% footer for option
-			fprintf(fid,'\t%s\n%s\n','</option>');
-
-
-			% footer for drop-down
-			fprintf(fid,'\t%s\n%s\n%s','<help> damage law (string) from {"undamaged","pralong"} </help>','</parameter>');
-
-
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',    '<parameter key ="D" type="',              class(self.D),'" default="',                  num2str(self.D),'">',              '     <section name="damage" />','     <help> damage tensor (scalar) </help>','</parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',    '<parameter key ="law" type="',            class(self.law),'" default="',                num2str(self.law),'">',   '     <section name="damage" />','     <help> damage law (string) from {"undamaged","pralong"} </help>','</parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',        '<parameter key ="spcdamage" type="',      class(self.spcdamage),'" default="',          num2str(self.spcdamage),'">',            '     <section name="damage" />','     <help> damage constraints (NaN means no constraint) </help>','</parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',        '<parameter key ="max_damage" type="',     class(self.max_damage),'" default="',         num2str(self.max_damage),'">',            '     <section name="damage" />','     <help> maximum possible damage (0&lt;=max_damage&lt;1) </help>','</parameter>');
-
-			% stabilization (0,1, or 2) drop-down
-			fprintf(fid,'%s\n%s\n%s\n%s\n',    '<parameter key ="stabilization" type="alternative" optional="false">','     <section name="damage" />','     <help> 0: no, 1: artificial_diffusivity, 2: SUPG </help>');
-			fprintf(fid, '%s\n', '       <option value="0" type="string" default="true"></option>');
-			fprintf(fid, '%s\n', '       <option value="1" type="string" default="false"></option>');
-			fprintf(fid, '%s\n', '       <option value="2" type="string" default="false"></option>');
-			fprintf(fid, '%s\n','</parameter>');
-
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',    '<parameter key ="maxiter" type="',             class(self.maxiter),'" default="',   num2str(self.maxiter),'">',   '     <section name="damage" />','     <help> maximum number of non linear iterations </help>','</parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',        '<parameter key ="penalty_lock" type="',        class(self.penalty_lock),'" default="',            num2str(self.penalty_lock),'">',            '     <section name="damage" />','     <help> stabilize unstable damage constraints that keep zigzagging after n iteration (default is 0, no stabilization) </help>','</parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',        '<parameter key ="penalty_threshold" type="',   class(self.penalty_threshold),'" default="',            num2str(self.penalty_threshold),'">',            '     <section name="damage" />','     <help> threshold to declare convergence of damage evolution solution (default is 0) </help>','</parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',        '<parameter key ="penalty_factor" type="',      class(self.penalty_factor),'" default="',            num2str(self.penalty_factor),'">',            '     <section name="damage" />','     <help> scaling exponent (default is 3) </help>','</parameter>');
-
-		end % }}}
 		function self = damage(varargin) % {{{
 			switch nargin
 				case 0
@@ -116,7 +61,7 @@
 			self.max_damage=1-1e-5; %if damage reaches 1, solve becomes singular, as viscosity becomes nil
 		
 			%Type of stabilization used
-			self.stabilization=2;
+			self.stabilization=4;
 			
 			%Maximum number of iterations
 			self.maxiter=100;
@@ -124,17 +69,9 @@
 			%finite element interpolation
 			self.elementinterp='P1';
 
-			%factor used to compute the values of the penalties: kappa=max(stiffness matrix)*10^penalty_factor
-			self.penalty_factor=3;
-			
-			%stabilize unstable damage constraints that keep zigzagging after n iteration (default is 0, no stabilization)
-			self.penalty_lock=0;
-			
-			%threshold to declare convergence of thermal solution (default is 0)
-			self.penalty_threshold=0;
-		
 			%damage evolution parameters 
-			self.stress_threshold=0;
+			self.stress_threshold=1.3e5;
+			self.kappa=2.8;
 			self.healing=0;
 			self.c1=0;
 			self.c2=0;
@@ -152,20 +89,18 @@
 			if self.isdamage,
 				md = checkfield(md,'fieldname','damage.law','numel',[1],'values',[0,1,2]);
 				md = checkfield(md,'fieldname','damage.D','>=',0,'<=',self.max_damage,'size',[md.mesh.numberofvertices 1]);
-				md = checkfield(md,'fieldname','damage.spcdamage','timeseries',1);
+				md = checkfield(md,'fieldname','damage.spcdamage','Inf',1,'timeseries',1);
 				md = checkfield(md,'fieldname','damage.max_damage','<',1,'>=',0);
-				md = checkfield(md,'fieldname','damage.stabilization','numel',[1],'values',[0 1 2]);
+				md = checkfield(md,'fieldname','damage.stabilization','numel',[1],'values',[0 1 2 4]);
 				md = checkfield(md,'fieldname','damage.maxiter','>=0',0);
 				md = checkfield(md,'fieldname','damage.elementinterp','values',{'P1','P2'});
-				md = checkfield(md,'fieldname','damage.penalty_factor','>=',0);
-				md = checkfield(md,'fieldname','damage.penalty_lock','>=',0);
-				md = checkfield(md,'fieldname','damage.penalty_threshold','>=',0);
+				md = checkfield(md,'fieldname','damage.stress_threshold','>=',0);
+				md = checkfield(md,'fieldname','damage.kappa','>',1);
 				md = checkfield(md,'fieldname','damage.healing','>=',0);
 				md = checkfield(md,'fieldname','damage.c1','>=',0);
 				md = checkfield(md,'fieldname','damage.c2','>=',0);
 				md = checkfield(md,'fieldname','damage.c3','>=',0);
 				md = checkfield(md,'fieldname','damage.c4','>=',0);
-				md = checkfield(md,'fieldname','damage.stress_threshold','>=',0);
 				md = checkfield(md,'fieldname','damage.equiv_stress','numel',[1],'values',[0 1]);
 				md = checkfield(md,'fieldname','damage.requested_outputs','stringrow',1);
 			elseif (self.law~=0),
@@ -187,23 +122,21 @@
 
 			fielddisplay(self,'isdamage','is damage mechanics being used? {true,false}');
 			if self.isdamage,
-				fielddisplay(self,'law','damage law {''0: undamaged'',''1: pralong''}');
+				fielddisplay(self,'law','damage law {''0: analytical'',''1: pralong''}');
 				fielddisplay(self,'D','damage tensor (scalar)');
 				fielddisplay(self,'spcdamage','damage constraints (NaN means no constraint)');
 				fielddisplay(self,'max_damage','maximum possible damage (0<=max_damage<1)');
 				
-				fielddisplay(self,'stabilization','0: no, 1: artificial_diffusivity, 2: SUPG');
+				fielddisplay(self,'stabilization','0: no, 1: artificial_diffusivity, 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''}');
-				fielddisplay(self,'penalty_lock','stabilize unstable damage constraints that keep zigzagging after n iteration (default is 0, no stabilization)');
-				fielddisplay(self,'penalty_threshold','threshold to declare convergence of damage evolution solution (default is 0)');
-				fielddisplay(self,'penalty_factor','scaling exponent (default is 3)');
+				fielddisplay(self,'stress_threshold','stress threshold for damage initiation [Pa]');
+				fielddisplay(self,'kappa','ductility parameter for stress softening and damage');
 				fielddisplay(self,'c1','damage parameter 1');
 				fielddisplay(self,'c2','damage parameter 2');
 				fielddisplay(self,'c3','damage parameter 3');
 				fielddisplay(self,'c4','damage parameter 4');
 				fielddisplay(self,'healing','damage healing parameter');
-				fielddisplay(self,'stress_threshold','damage stress threshold [Pa]');
 				fielddisplay(self,'equiv_stress','0: von Mises, 1: max principal');
 				fielddisplay(self,'requested_outputs','additional outputs requested');
 			end
@@ -221,14 +154,12 @@
 				WriteData(fid,'object',self,'fieldname','stabilization','format','Integer');
 				WriteData(fid,'object',self,'fieldname','maxiter','format','Integer');
 				WriteData(fid,'enum',DamageElementinterpEnum(),'data',StringToEnum(self.elementinterp),'format','Integer');
-				WriteData(fid,'object',self,'fieldname','penalty_threshold','format','Integer');
-				WriteData(fid,'object',self,'fieldname','penalty_lock','format','Integer');
-				WriteData(fid,'object',self,'fieldname','penalty_factor','format','Double');
+				WriteData(fid,'object',self,'fieldname','stress_threshold','format','Double');
+				WriteData(fid,'object',self,'fieldname','kappa','format','Double');
 				WriteData(fid,'object',self,'fieldname','c1','format','Double');
 				WriteData(fid,'object',self,'fieldname','c2','format','Double');
 				WriteData(fid,'object',self,'fieldname','c3','format','Double');
 				WriteData(fid,'object',self,'fieldname','c4','format','Double');
-				WriteData(fid,'object',self,'fieldname','stress_threshold','format','Double');
 				WriteData(fid,'object',self,'fieldname','healing','format','Double');
 				WriteData(fid,'object',self,'fieldname','equiv_stress','format','Integer');
 			end
@@ -245,5 +176,13 @@
 			end
 
 		end % }}}
+		function savemodeljs(self,fid,modelname) % {{{
+		
+			writejsdouble(fid,[modelname '.damage.isdamage'],self.isdamage);
+			if self.isdamage,
+				error('savemodeljs error message: not implemented  yet!');
+			end
+
+		end % }}}
 	end
 end

Modified: issm/trunk/src/m/classes/damage.py
===================================================================
--- issm/trunk/src/m/classes/damage.py	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/classes/damage.py	2016-04-13 04:32:01 UTC (rev 20500)
@@ -18,26 +18,24 @@
 			
 		#damage: 
 		self.isdamage           = 0.
-		self.D						= float('NaN')
-		self.law						= float('NaN')
-		self.spcdamage				= float('NaN')
-		self.max_damage			= float('NaN')
+		self.D			= float('NaN')
+		self.law		= float('NaN')
+		self.spcdamage		= float('NaN')
+		self.max_damage		= float('NaN')
 		
 		#numerical
-		self.stabilization		= float('NaN')
-		self.maxiter				= float('NaN')
+		self.stabilization	= float('NaN')
+		self.maxiter		= float('NaN')
 		self.elementinterp      = ''
-		self.penalty_threshold	= float('NaN')
-		self.penalty_lock			= float('NaN')
-		self.penalty_factor		= float('NaN')
 
 		#general parameters for evolution law: 
 		self.stress_threshold   = float('NaN')
+		self.kappa              = float('NaN')
 		self.c1                 = float('NaN')
 		self.c2                 = float('NaN')
 		self.c3                 = float('NaN')
 		self.c4                 = float('NaN')
-		self.healing				= float('NaN')
+		self.healing		= float('NaN')
 		self.equiv_stress       = float('NaN')
 		self.requested_outputs  = []
 
@@ -53,21 +51,19 @@
 		s+="%s\n" % fielddisplay(self,"isdamage","is damage mechanics being used? [0 (default) or 1]")
 		if self.isdamage:
 			s+="%s\n" % fielddisplay(self,"D","damage tensor (scalar for now)")
-			s+="%s\n" % fielddisplay(self,"law","damage law ['0: undamaged','1: pralong']")
+			s+="%s\n" % fielddisplay(self,"law","damage law ['0: analytical','1: pralong']")
 			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")
+                        s+="%s\n" % fielddisplay(self,"stabilization","0: no, 1: artificial_diffusivity, 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'']")
-			s+="%s\n" % fielddisplay(self,"penalty_lock","stabilize unstable damage constraints that keep zigzagging after n iteration (default is 0, no stabilization)")
-			s+="%s\n" % fielddisplay(self,"penalty_threshold","threshold to declare convergence of damage evolution solution (default is 0)")
-			s+="%s\n" % fielddisplay(self,"penalty_factor","scaling exponent (default is 3)")
+			s+="%s\n" % fielddisplay(self,"stress_threshold","stress threshold for damage initiation [Pa]")
+			s+="%s\n" % fielddisplay(self,"kappa","ductility parameter for stress softening and damage [>1]")
 			s+="%s\n" % fielddisplay(self,"c1","damage parameter 1 ")
 			s+="%s\n" % fielddisplay(self,"c2","damage parameter 2 ")
 			s+="%s\n" % fielddisplay(self,"c3","damage parameter 3 ")
 			s+="%s\n" % fielddisplay(self,"c4","damage parameter 4 ")
-			s+="%s\n" % fielddisplay(self,"stress_threshold","damage stress threshold [Pa]")
 			s+="%s\n" % fielddisplay(self,"healing","damage healing parameter")
 			s+="%s\n" % fielddisplay(self,"equiv_stress","0: von Mises, 1: max principal")
 			s+="%s\n" % fielddisplay(self,'requested_outputs','additional outputs requested')
@@ -89,7 +85,7 @@
 		self.max_damage=1-1e-5 #if damage reaches 1, solve becomes singular, as viscosity becomes nil
 		
 		#Type of stabilization used
-		self.stabilization=2
+		self.stabilization=4
 			
 		#Maximum number of iterations
 		self.maxiter=100
@@ -97,17 +93,9 @@
 		#finite element interpolation
 		self.elementinterp='P1'
 
-		#factor used to compute the values of the penalties: kappa=max(stiffness matrix)*10^penalty_factor
-		self.penalty_factor=3
-			
-		#stabilize unstable damage constraints that keep zigzagging after n iteration (default is 0, no stabilization)
-		self.penalty_lock=0
-			
-		#threshold to declare convergence of thermal solution (default is 0)
-		self.penalty_threshold=0
-		
 		#damage evolution parameters 
-		self.stress_threshold=0
+		self.stress_threshold=1.3e5
+		self.kappa=2.8
 		self.c1=0
 		self.c2=0
 		self.c3=0
@@ -136,19 +124,17 @@
 			md = checkfield(md,'fieldname','damage.D','>=',0,'<=',self.max_damage,'size',[md.mesh.numberofvertices])
 			md = checkfield(md,'fieldname','damage.max_damage','<',1,'>=',0)
 			md = checkfield(md,'fieldname','damage.law','numel',[1],'values',[0,1,2,3])
-			md = checkfield(md,'fieldname','damage.spcdamage','timeseries',1)
-			md = checkfield(md,'fieldname','damage.stabilization','numel',[1],'values',[0,1,2])
+			md = checkfield(md,'fieldname','damage.spcdamage','Inf',1,'timeseries',1)
+			md = checkfield(md,'fieldname','damage.stabilization','numel',[1],'values',[0,1,2,4])
 			md = checkfield(md,'fieldname','damage.maxiter','>=0',0)
 			md = checkfield(md,'fieldname','damage.elementinterp','values',['P1','P2'])
-			md = checkfield(md,'fieldname','damage.penalty_factor','>=0',0)
-			md = checkfield(md,'fieldname','damage.penalty_lock','>=0',0)
-			md = checkfield(md,'fieldname','damage.penalty_threshold','>=0',0)
+			md = checkfield(md,'fieldname','damage.stress_threshold','>=',0)
+			md = checkfield(md,'fieldname','damage.kappa','>',1)
 			md = checkfield(md,'fieldname','damage.healing','>=',0)
 			md = checkfield(md,'fieldname','damage.c1','>=',0)
 			md = checkfield(md,'fieldname','damage.c2','>=',0)
 			md = checkfield(md,'fieldname','damage.c3','>=',0)
 			md = checkfield(md,'fieldname','damage.c4','>=',0)
-			md = checkfield(md,'fieldname','damage.stress_threshold','>=',0)
 			md = checkfield(md,'fieldname','damage.healing','>=',0)
 			md = checkfield(md,'fieldname','damage.equiv_stress','numel',[1],'values',[0,1])
 			md = checkfield(md,'fieldname','damage.requested_outputs','stringrow',1)
@@ -169,14 +155,12 @@
 			WriteData(fid,'object',self,'fieldname','stabilization','format','Integer')
 			WriteData(fid,'object',self,'fieldname','maxiter','format','Integer')
 			WriteData(fid,'enum',DamageElementinterpEnum(),'data',StringToEnum(self.elementinterp)[0],'format','Integer')
-			WriteData(fid,'object',self,'fieldname','penalty_threshold','format','Integer')
-			WriteData(fid,'object',self,'fieldname','penalty_lock','format','Integer')
-			WriteData(fid,'object',self,'fieldname','penalty_factor','format','Double')
+			WriteData(fid,'object',self,'fieldname','stress_threshold','format','Double')
+			WriteData(fid,'object',self,'fieldname','kappa','format','Double')
 			WriteData(fid,'object',self,'fieldname','c1','format','Double')
 			WriteData(fid,'object',self,'fieldname','c2','format','Double')
 			WriteData(fid,'object',self,'fieldname','c3','format','Double')
 			WriteData(fid,'object',self,'fieldname','c4','format','Double')
-			WriteData(fid,'object',self,'fieldname','stress_threshold','format','Double')
 			WriteData(fid,'object',self,'fieldname','healing','format','Double')
 			WriteData(fid,'object',self,'fieldname','equiv_stress','format','Integer')
 			

Modified: issm/trunk/src/m/classes/debug.m
===================================================================
--- issm/trunk/src/m/classes/debug.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/classes/debug.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -10,18 +10,6 @@
 		profiling = false;
 	end
 	methods
-        function createxml(self,fid) % {{{
-            fprintf(fid, '\n\n');
-            fprintf(fid, '%s\n', '<!-- Debug -->');
-            
-            %valgrind drop-down (0 or 1)
-			fprintf(fid,'%s\n%s\n%s%s%s\n%s\n%s\n',    '<parameter key ="valgrind" type="alternative" optional="false">','     <section name="debug" />','     <help> use Valgrind to debug (0 or 1) </help>');
-            fprintf(fid,'%s\n','       <option value="0" type="string" default="true"> </option>');
-            fprintf(fid,'%s\n%s\n','       <option value="1" type="string" default="false"> </option>','</parameter>');
-          
-            fprintf(fid,'%s%s%s\n%s\n%s%s%s\n%s\n%s\n',    '<parameter key ="gprof" type="',              class(self.gprof),'" optional="false">',              '     <section name="debug" />','        <option value="',convert2str(self.gprof),'" type="string" default="true"></option>','     <help> use gnu-profiler to find out where the time is spent </help>','</parameter>');
-            fprintf(fid,'%s%s%s\n%s\n%s%s%s\n%s\n',    '<parameter key ="profiling" type="',              class(self.profiling),'" optional="false">',              '     <section name="debug" />','        <option value="',convert2str(self.profiling),'" type="string" default="true"></option>','     <help> enables profiling (memory, flops, time) </help>','</parameter>');
-        end % }}}
 		function self = debug(varargin) % {{{
 			switch nargin
 				case 0
@@ -44,5 +32,12 @@
 		function marshall(self,md,fid) % {{{
 			WriteData(fid,'object',self,'fieldname','profiling','format','Boolean');
 		end % }}}
+		function savemodeljs(self,fid,modelname) % {{{
+		
+			writejsdouble(fid,[modelname '.debug.valgrind'],self.valgrind);
+			writejsdouble(fid,[modelname '.debug.gprof'],self.gprof);
+			writejsdouble(fid,[modelname '.debug.profiling'],self.profiling);
+
+		end % }}}
 	end
 end

Modified: issm/trunk/src/m/classes/dependent.py
===================================================================
--- issm/trunk/src/m/classes/dependent.py	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/classes/dependent.py	2016-04-13 04:32:01 UTC (rev 20500)
@@ -2,7 +2,7 @@
 import numpy
 from pairoptions import pairoptions
 from fielddisplay import fielddisplay
-import MatlabFuncs as m
+from MatlabFuncs import *
 from EnumDefinitions import *
 from MeshProfileIntersection import MeshProfileIntersection
 

Modified: issm/trunk/src/m/classes/flaim.m
===================================================================
--- issm/trunk/src/m/classes/flaim.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/classes/flaim.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -20,39 +20,6 @@
 		opt_niter          = 30000
 	end
 	methods
-  	 	function createxml(self,fid) % {{{
-            fprintf(fid, '<!-- flaim -->\n');            
-                    
-            % Input
-            fprintf(fid,'%s\n%s\n%s\n','<frame key="1" label="Input:">','<section name="flaim" />');                    
-            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="targets" type="',class(self.targets),'" default="',convert2str(self.targets),'">','     <section name="flaim" />','     <help> name of kml output targets file </help>','  </parameter>');
-            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="tracks" type="',class(self.tracks),'" default="',convert2str(self.tracks),'">','     <section name="flaim" />','     <help> name of kml input tracks file </help>','  </parameter>');
-            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="flightreqs" type="',class(self.flightreqs),'" default="',convert2str(self.flightreqs),'">','     <section name="flaim" />','     <help> structure of kml flight requirements (not used yet) </help>','  </parameter>');
-            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="criterion" type="',class(self.criterion),'" default="',convert2str(self.criterion),'">','     <section name="flaim" />','     <help> element or nodal criterion for flight path evaluation (metric) </help>','  </parameter>');
-        	fprintf(fid,'%s\n%s\n','</frame>');    
-            
-            % Arguments
-            fprintf(fid,'%s\n%s\n%s\n','<frame key="2" label="Arguments:">','<section name="flaim" />');                    
-            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="gridsatequator" type="',class(self.gridsatequator),'" default="',convert2str(self.gridsatequator),'">','     <section name="flaim" />','     <help> number of grids at equator (determines resolution) </help>','  </parameter>');
-            fprintf(fid,'%s%s%s\n%s\n%s%s%s\n%s\n%s\n','  <parameter key ="usevalueordering" type="',class(self.usevalueordering),'" optional="false">','     <section name="flaim" />','         <option value="',convert2str(self.usevalueordering),'" type="string" default="true"></option>','     <help> flag to consider target values for flight path evaluation </help>','  </parameter>');
-            fprintf(fid,'%s%s%s\n%s\n%s%s%s\n%s\n%s\n','  <parameter key ="split_antimeridian" type="',class(self.split_antimeridian),'" optional="false">','     <section name="flaim" />','         <option value="',convert2str(self.split_antimeridian),'" type="string" default="true"></option>','     <help> flag to split polygons on the antimeridian </help>','  </parameter>');
-            fprintf(fid,'%s\n%s\n','</frame>');   
-            
-            % Optimization
-            fprintf(fid,'%s\n%s\n%s\n','<frame key="3" label="Optimization:">','<section name="flaim" />');                    
-            fprintf(fid,'%s%s%s\n%s\n%s%s%s\n%s\n%s\n','  <parameter key ="path_optimize" type="',class(self.path_optimize),'" optional="false">','     <section name="flaim" />','         <option value="',convert2str(self.path_optimize),'" type="string" default="true"></option>','     <help> optimize? (default false) </help>','  </parameter>');
-            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="opt_ndir" type="',class(self.opt_ndir),'" default="',convert2str(self.opt_ndir),'">','     <section name="flaim" />','     <help> number of directions to test when moving a point.  If this value = 1, a random direction is tested. A value > 1 results in directions equally spaced from [0, 2*PI] being tested. For example, 4 would result in directions [0, PI/2, PI, 3PI/2] </help>','  </parameter>');
-            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="opt_dist" type="',class(self.opt_dist),'" default="',convert2str(self.opt_dist),'">','     <section name="flaim" />','     <help> specifies the distance in km (default 25) to move a randomly selected path point on each iteration </help>','  </parameter>');
-            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="opt_niter" type="',class(self.opt_niter),'" default="',convert2str(self.opt_niter),'">','     <section name="flaim" />','     <help> number of iterations (default 30,000) to run for flightplan optimization, i.e. the number of times to randomly select a point and move it. </help>','  </parameter>');
-        	fprintf(fid,'%s\n%s\n','</frame>');     
-            
-            % Output
-            fprintf(fid,'%s\n%s\n%s\n','<frame key="4" label="Output:">','<section name="flaim" />');                    
-            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="solution" type="',class(self.solution),'" default="',convert2str(self.solution),'">','     <section name="flaim" />','     <help> name of kml solution file </help>','  </parameter>');
-            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="quality" type="',class(self.quality),'" default="',convert2str(self.quality),'">','     <section name="flaim" />','     <help> quality of kml solution </help>','  </parameter>');
-            fprintf(fid,'%s\n%s\n','</frame>');              
-        
-        end % }}}
 		function self = flaim(varargin) % {{{
 			switch nargin
 				case 0
@@ -105,5 +72,13 @@
 			fielddisplay(self,'solution'           ,'name of kml solution file');
 			fielddisplay(self,'quality'            ,'quality of kml solution');
 		end % }}}
+		function savemodeljs(self,fid,modelname) % {{{
+		
+			%do nothing for now!
+			if ~isempty(self.targets),
+				error('flaim savemodeljs error message: not supported yet!');
+			end
+
+		end % }}}
 	end
 end

Modified: issm/trunk/src/m/classes/flowequation.m
===================================================================
--- issm/trunk/src/m/classes/flowequation.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/classes/flowequation.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -61,51 +61,6 @@
 		end% }}}
 	end
 	methods
-		function createxml(self,fid) % {{{
-			fprintf(fid, '\n\n');
-			fprintf(fid, '%s\n', '<!-- flowequation -->');
-			fprintf(fid,'%s\n%s\n%s\n','<frame key="1" label="Flow equation parameters">','<section name="flowequation" />');                    
-
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',    '<parameter key ="isSIA" type="',              class(self.isSIA),'" default="',                  convert2str(self.isSIA),'">',              '     <section name="flowequation" />','     <help> is the Shallow Ice Approximation (SIA) used ? </help>','</parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',    '<parameter key ="isSSA" type="',            class(self.isSSA),'" default="',                convert2str(self.isSSA),'">',   '     <section name="flowequation" />','     <help> is the Shelfy-Stream Approximation (SSA) used ? </help>','</parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',        '<parameter key ="isL1L2" type="',      class(self.isL1L2),'" default="',          convert2str(self.isL1L2),'">',            '     <section name="flowequation" />','     <help> is the L1L2 approximation used ? </help>','</parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',        '<parameter key ="isHO" type="',     class(self.isHO),'" default="',         convert2str(self.isHO),'">',            '     <section name="flowequation" />','     <help> is the Higher-Order (HO) approximation used ? </help>','</parameter>');
-
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',    '<parameter key ="isFS" type="',       class(self.isFS),'" default="',              convert2str(self.isFS),'">',              '     <section name="flowequation" />','     <help> are the Full-FS (FS) equations used ? </help>','</parameter>');
-
-			% fe_SSA drop-down (P1, P1bubble, P1bubblecondensed, P2)
-			fprintf(fid,'%s\n%s\n%s\n%s\n',    '<parameter key ="fe_SSA" type="alternative" optional="false">','     <section name="flowequation" />','     <help> Finite Element for SSA  "P1", "P1bubble" "P1bubblecondensed" "P2" </help>');
-			fprintf(fid,'%s\n','       <option value="P1" type="string" default="true"> </option>');
-			fprintf(fid,'%s\n','       <option value="P1bubble" type="string" default="false"> </option>');
-			fprintf(fid,'%s\n','       <option value="P1bubblecondensed" type="string" default="false"> </option>');
-			fprintf(fid,'%s\n%s\n','       <option value="P2" type="string" default="false"> </option>','</parameter>');
-
-			%fe_HO drop-down (P1, P1bubble, P1bubblecondensed, P1xP2, P2xP1, P2)
-			fprintf(fid,'%s\n%s\n%s\n%s\n',        '<parameter key ="fe_HO" type="alternative" optional="false">','     <section name="flowequation" />','     <help> Finite Element for HO   "P1" "P1bubble" "P1bubblecondensed" "P1xP2" "P2xP1" "P2" </help>');
-			fprintf(fid,'%s\n','       <option value="P1" type="string" default="true"> </option>');
-			fprintf(fid,'%s\n','       <option value="P1bubble" type="string" default="false"> </option>');
-			fprintf(fid,'%s\n','       <option value="P1bubblecondensed" type="string" default="false"> </option>');
-			fprintf(fid,'%s\n','       <option value="P1xP2" type="string" default="false"> </option>');
-			fprintf(fid,'%s\n','       <option value="P2xP1" type="string" default="false"> </option>');
-			fprintf(fid,'%s\n%s\n','       <option value="P2" type="string" default="false"> </option>','</parameter>');
-
-			% fe_FS drop-down (P1P1, P1P1GLS, MINIcondensed, MINI, TaylowHood)
-			fprintf(fid,'%s\n%s\n%s\n%s\n',        '<parameter key ="fe_FS" type="alternative" optional="false">','     <section name="flowequation" />','     <help> Finite Element for FS   "P1P1" (debugging only) "P1P1GLS" "MINIcondensed" "MINI" "TaylorHood" </help>');
-			fprintf(fid,'%s\n','       <option value="P1P1" type="string" default="true"> </option>');
-			fprintf(fid,'%s\n','       <option value="P1P1GLS" type="string" default="false"> </option>');
-			fprintf(fid,'%s\n','       <option value="MINIcondensed" type="string" default="false"> </option>');
-			fprintf(fid,'%s\n','       <option value="MINI" type="string" default="false"> </option>');
-			fprintf(fid,'%s\n%s\n','       <option value="TaylorHood" type="string" default="false"> </option>','</parameter>');
-
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',        '<parameter key ="vertex_equation" type="',      class(self.vertex_equation),'" default="',            convert2str(self.vertex_equation),'">',            '     <section name="flowequation" />','     <help> flow equation for each vertex </help>','</parameter>');
-
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',    '<parameter key ="element_equation" type="',            class(self.element_equation),'" default="',              convert2str(self.element_equation),'">',              '     <section name="flowequation" />','     <help> flow equation for each element </help>','</parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',    '<parameter key ="borderSSA" type="', class(self.borderSSA),'" default="',   convert2str(self.borderSSA),'">',   '     <section name="flowequation" />','     <help> vertices on SSAs border (for tiling) </help>','</parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',        '<parameter key ="borderHO" type="',          class(self.borderHO),'" default="',            convert2str(self.borderHO),'">',            '     <section name="flowequation" />','     <help> vertices on HOs border (for tiling) </help>','</parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n',        '<parameter key ="borderFS" type="',          class(self.borderFS),'" default="',            convert2str(self.borderFS),'">',            '     <section name="flowequation" />','     <help> vertices on FS border (for tiling) </help>','</parameter>');
-
-			fprintf(fid,'%s\n%s\n','</frame>');
-		end % }}}
 		function self = extrude(self,md) % {{{
 			self.element_equation=project3d(md,'vector',self.element_equation,'type','element');
 			self.vertex_equation=project3d(md,'vector',self.vertex_equation,'type','node');
@@ -134,7 +89,6 @@
 		end % }}}
 		function md = checkconsistency(self,md,solution,analyses) % {{{
 
-
 			%Early return
 			if (~ismember(StressbalanceAnalysisEnum(),analyses) & ~ismember(StressbalanceSIAAnalysisEnum(),analyses)) | (solution==TransientSolutionEnum() & md.transient.isstressbalance==0), return; end
 
@@ -146,10 +100,10 @@
 			md = checkfield(md,'fieldname','flowequation.fe_SSA','values',{'P1','P1bubble','P1bubblecondensed','P2','P2bubble'});
 			md = checkfield(md,'fieldname','flowequation.fe_HO' ,'values',{'P1','P1bubble','P1bubblecondensed','P1xP2','P2xP1','P2','P2bubble','P1xP3','P2xP4'});
 			md = checkfield(md,'fieldname','flowequation.fe_FS' ,'values',{'P1P1','P1P1GLS','MINIcondensed','MINI','TaylorHood','LATaylorHood','XTaylorHood','OneLayerP4z','CrouzeixRaviart','LACrouzeixRaviart'});
-			md = checkfield(md,'fieldname','flowequation.augmented_lagrangian_r','numel',[1],'>',0.);
-			md = checkfield(md,'fieldname','flowequation.augmented_lagrangian_rlambda','numel',[1],'>',0.);
-			md = checkfield(md,'fieldname','flowequation.augmented_lagrangian_rhop','numel',[1],'>',0.);
-			md = checkfield(md,'fieldname','flowequation.augmented_lagrangian_rholambda','numel',[1],'>',0.);
+			md = checkfield(md,'fieldname','flowequation.augmented_lagrangian_r','numel',[1],'>=',0.);
+			md = checkfield(md,'fieldname','flowequation.augmented_lagrangian_rlambda','numel',[1],'>=',0.);
+			md = checkfield(md,'fieldname','flowequation.augmented_lagrangian_rhop','numel',[1],'>=',0.);
+			md = checkfield(md,'fieldname','flowequation.augmented_lagrangian_rholambda','numel',[1],'>=',0.);
 			md = checkfield(md,'fieldname','flowequation.XTH_theta','numel',[1],'>=',0.,'<',0.5);
 			md = checkfield(md,'fieldname','flowequation.borderSSA','size',[md.mesh.numberofvertices 1],'values',[0 1]);
 			md = checkfield(md,'fieldname','flowequation.borderHO','size',[md.mesh.numberofvertices 1],'values',[0 1]);
@@ -242,5 +196,27 @@
 			pos=find(data==8); data(pos,end)=HOFSApproximationEnum();
 			WriteData(fid,'data',data,'enum',FlowequationElementEquationEnum(),'format','DoubleMat','mattype',2);
 		end % }}}
+		function savemodeljs(self,fid,modelname) % {{{
+		
+			writejsdouble(fid,[modelname '.flowequation.isSIA'],self.isSIA);
+			writejsdouble(fid,[modelname '.flowequation.isSSA'],self.isSSA);
+			writejsdouble(fid,[modelname '.flowequation.isL1L2'],self.isL1L2);
+			writejsdouble(fid,[modelname '.flowequation.isHO'],self.isHO);
+			writejsdouble(fid,[modelname '.flowequation.isFS'],self.isFS);
+			writejsstring(fid,[modelname '.flowequation.fe_SSA'],self.fe_SSA);
+			writejsstring(fid,[modelname '.flowequation.fe_HO'],self.fe_HO);
+			writejsstring(fid,[modelname '.flowequation.fe_FS'],self.fe_FS);
+			writejsdouble(fid,[modelname '.flowequation.augmented_lagrangian_r'],self.augmented_lagrangian_r);
+			writejsdouble(fid,[modelname '.flowequation.augmented_lagrangian_rhop'],self.augmented_lagrangian_rhop);
+			writejsdouble(fid,[modelname '.flowequation.augmented_lagrangian_rlambda'],self.augmented_lagrangian_rlambda);
+			writejsdouble(fid,[modelname '.flowequation.augmented_lagrangian_rholambda'],self.augmented_lagrangian_rholambda);
+			writejsdouble(fid,[modelname '.flowequation.XTH_theta'],self.XTH_theta);
+			writejs1Darray(fid,[modelname '.flowequation.vertex_equation'],self.vertex_equation);
+			writejs1Darray(fid,[modelname '.flowequation.element_equation'],self.element_equation);
+			writejs1Darray(fid,[modelname '.flowequation.borderSSA'],self.borderSSA);
+			writejs1Darray(fid,[modelname '.flowequation.borderHO'],self.borderHO);
+			writejs1Darray(fid,[modelname '.flowequation.borderFS'],self.borderFS);
+
+		end % }}}
 	end
 end

Modified: issm/trunk/src/m/classes/flowequation.py
===================================================================
--- issm/trunk/src/m/classes/flowequation.py	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/classes/flowequation.py	2016-04-13 04:32:01 UTC (rev 20500)
@@ -137,26 +137,29 @@
 		WriteData(fid,'object',self,'fieldname','borderHO','format','DoubleMat','mattype',1)
 		WriteData(fid,'object',self,'fieldname','borderFS','format','DoubleMat','mattype',1)
 		#convert approximations to enums
-		data=copy.deepcopy(self.vertex_equation)
-		data[numpy.nonzero(data==0)]=NoneApproximationEnum()
-		data[numpy.nonzero(data==1)]=SIAApproximationEnum()
-		data[numpy.nonzero(data==2)]=SSAApproximationEnum()
-		data[numpy.nonzero(data==3)]=L1L2ApproximationEnum()
-		data[numpy.nonzero(data==4)]=HOApproximationEnum()
-		data[numpy.nonzero(data==5)]=FSApproximationEnum()
-		data[numpy.nonzero(data==6)]=SSAHOApproximationEnum()
-		data[numpy.nonzero(data==7)]=HOFSApproximationEnum()
-		data[numpy.nonzero(data==8)]=SSAFSApproximationEnum()
+		data=copy.deepcopy(self.vertex_equation); 
+
+		if isinstance(data, (list, tuple, numpy.ndarray)):
+			data[numpy.nonzero(data==0)]=NoneApproximationEnum()
+			data[numpy.nonzero(data==1)]=SIAApproximationEnum()
+			data[numpy.nonzero(data==2)]=SSAApproximationEnum()
+			data[numpy.nonzero(data==3)]=L1L2ApproximationEnum()
+			data[numpy.nonzero(data==4)]=HOApproximationEnum()
+			data[numpy.nonzero(data==5)]=FSApproximationEnum()
+			data[numpy.nonzero(data==6)]=SSAHOApproximationEnum()
+			data[numpy.nonzero(data==7)]=HOFSApproximationEnum()
+			data[numpy.nonzero(data==8)]=SSAFSApproximationEnum()
 		WriteData(fid,'data',data,'enum',FlowequationVertexEquationEnum(),'format','DoubleMat','mattype',1)
 		data=copy.deepcopy(self.element_equation)
-		data[numpy.nonzero(data==0)]=NoneApproximationEnum()
-		data[numpy.nonzero(data==1)]=SIAApproximationEnum()
-		data[numpy.nonzero(data==2)]=SSAApproximationEnum()
-		data[numpy.nonzero(data==3)]=L1L2ApproximationEnum()
-		data[numpy.nonzero(data==4)]=HOApproximationEnum()
-		data[numpy.nonzero(data==5)]=FSApproximationEnum()
-		data[numpy.nonzero(data==6)]=SSAHOApproximationEnum()
-		data[numpy.nonzero(data==7)]=SSAFSApproximationEnum()
-		data[numpy.nonzero(data==8)]=HOFSApproximationEnum()
+		if isinstance(data, (list, tuple, numpy.ndarray)):
+			data[numpy.nonzero(data==0)]=NoneApproximationEnum()
+			data[numpy.nonzero(data==1)]=SIAApproximationEnum()
+			data[numpy.nonzero(data==2)]=SSAApproximationEnum()
+			data[numpy.nonzero(data==3)]=L1L2ApproximationEnum()
+			data[numpy.nonzero(data==4)]=HOApproximationEnum()
+			data[numpy.nonzero(data==5)]=FSApproximationEnum()
+			data[numpy.nonzero(data==6)]=SSAHOApproximationEnum()
+			data[numpy.nonzero(data==7)]=SSAFSApproximationEnum()
+			data[numpy.nonzero(data==8)]=HOFSApproximationEnum()
 		WriteData(fid,'data',data,'enum',FlowequationElementEquationEnum(),'format','DoubleMat','mattype',2)
 	# }}}

Modified: issm/trunk/src/m/classes/friction.m
===================================================================
--- issm/trunk/src/m/classes/friction.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/classes/friction.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -10,15 +10,6 @@
 		q           = NaN;
 	end
 	methods
-		function createxml(self,fid) % {{{
-			fprintf(fid, '\n\n');
-			fprintf(fid, '%s\n', '<!-- Friction: Sigma= drag^2 * Neff ^r * u ^s, with Neff=rho_ice*g*thickness+rho_water*g*bed, r=q/p and s=1/p -->');
-			fprintf(fid,'%s\n%s\n%s\n','<frame key="1" label="Friction: Sigma= drag^2 * Neff ^r * u ^s, with Neff=rho_ice*g*thickness+rho_water*g*bed, r=q/p and s=1/p">','<section name="friction" />');   
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',    '<parameter key ="coefficient" type="',   	class(self.coefficient),'" default="',     	convert2str(self.coefficient),'">',              '     <section name="friction" />','     <help> friction coefficient [SI] </help>','</parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',    '<parameter key ="p" type="',               class(self.p),'" default="',                 convert2str(self.p),'">',   '     <section name="friction" />','     <help> p exponent </help>','</parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n',        '<parameter key ="q" type="',               class(self.q),'" default="',                 convert2str(self.q),'">',            '     <section name="friction" />','     <help> q exponent </help>','</parameter>');
-			fprintf(fid,'%s\n%s\n','</frame>');
-		end % }}}
 		function self = extrude(self,md) % {{{
 			self.coefficient=project3d(md,'vector',self.coefficient,'type','node','layer',1);
 			self.p=project3d(md,'vector',self.p,'type','element');
@@ -39,9 +30,11 @@
 
 			%Early return
 			if ~ismember(StressbalanceAnalysisEnum(),analyses) & ~ismember(ThermalAnalysisEnum(),analyses), return; end
-			md = checkfield(md,'fieldname','friction.coefficient','timeseries',1,'NaN',1);
-			md = checkfield(md,'fieldname','friction.q','NaN',1,'size',[md.mesh.numberofelements 1]);
-			md = checkfield(md,'fieldname','friction.p','NaN',1,'size',[md.mesh.numberofelements 1]);
+			if (solution==TransientSolutionEnum() &  md.transient.isstressbalance ==0 & md.transient.isthermal == 0), return; end
+
+			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]);
 		end % }}}
 		function disp(self) % {{{
 			disp(sprintf('Basal shear stress parameters: Sigma_b = coefficient^2 * Neff ^r * |u_b|^(s-1) * u_b\n(effective stress Neff=rho_ice*g*thickness+rho_water*g*bed, r=q/p and s=1/p)'));
@@ -60,5 +53,12 @@
 			
 
 		end % }}}
+		function savemodeljs(self,fid,modelname) % {{{
+		
+			writejs1Darray(fid,[modelname '.friction.coefficient'],self.coefficient);
+			writejs1Darray(fid,[modelname '.friction.p'],self.p);
+			writejs1Darray(fid,[modelname '.friction.q'],self.q);
+
+		end % }}}
 	end
 end

Modified: issm/trunk/src/m/classes/friction.py
===================================================================
--- issm/trunk/src/m/classes/friction.py	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/classes/friction.py	2016-04-13 04:32:01 UTC (rev 20500)
@@ -9,7 +9,7 @@
 	FRICTION class definition
 
 	   Usage:
-	      friction=friction();
+	      friction=friction()
 	"""
 
 	def __init__(self): # {{{
@@ -44,9 +44,9 @@
 		if StressbalanceAnalysisEnum() not in analyses and ThermalAnalysisEnum() not in analyses:
 			return md
 
-		md = checkfield(md,'fieldname','friction.coefficient','timeseries',1,'NaN',1)
-		md = checkfield(md,'fieldname','friction.q','NaN',1,'size',[md.mesh.numberofelements])
-		md = checkfield(md,'fieldname','friction.p','NaN',1,'size',[md.mesh.numberofelements])
+		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])
+		md = checkfield(md,'fieldname','friction.p','NaN',1,'Inf',1,'size',[md.mesh.numberofelements])
 
 		return md
 	# }}}

Modified: issm/trunk/src/m/classes/frictionhydro.m
===================================================================
--- issm/trunk/src/m/classes/frictionhydro.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/classes/frictionhydro.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -5,6 +5,7 @@
 
 classdef frictionhydro
 	properties (SetAccess=public) 
+		Coupling           = 0;
 		q                  = NaN;
 		C                  = NaN;
 		As                 = NaN;
@@ -26,29 +27,39 @@
 
 			%Early return
 			if ~ismember(StressbalanceAnalysisEnum(),analyses) & ~ismember(ThermalAnalysisEnum(),analyses), return; end
-			md = checkfield(md,'fieldname','friction.q','NaN',1,'size',[md.mesh.numberofelements 1]);
-			md = checkfield(md,'fieldname','friction.C','NaN',1,'size',[md.mesh.numberofelements 1]);
-			md = checkfield(md,'fieldname','friction.As','NaN',1,'size',[md.mesh.numberofelements 1]);
+			md = checkfield(md,'fieldname','friction.Coupling','numel',[1],'values',[0 1]);
+			md = checkfield(md,'fieldname','friction.q','NaN',1,'Inf',1,'size',[md.mesh.numberofelements 1]);
+			md = checkfield(md,'fieldname','friction.C','NaN',1,'Inf',1,'size',[md.mesh.numberofelements 1]);
+			md = checkfield(md,'fieldname','friction.As','NaN',1,'Inf',1,'size',[md.mesh.numberofelements 1]);
+			if self.Coupling==0,
+				md = checkfield(md,'fieldname','friction.effective_pressure','NaN',1,'Inf',1,'timeseries',1);
+	    end
 		end % }}}
 		function self = extrude(self,md) % {{{
 			self.q=project3d(md,'vector',self.q,'type','element');
 			self.C=project3d(md,'vector',self.C,'type','element');
 			self.As=project3d(md,'vector',self.As,'type','element');
-			self.effective_pressure=project3d(md,'vector',self.effective_pressure,'type','node','layer',1);
-		end % }}}
+			if self.Coupling==0,
+				self.effective_pressure=project3d(md,'vector',self.effective_pressure,'type','node','layer',1);
+			end
+	  end % }}}
 		function disp(self) % {{{
 			disp(sprintf('Effective Pressure based friction law described in Gagliardini 2007'));
+			fielddisplay(self,'Coupling','Coupling flag, 1 for coupling and 0 for forcing');
 			fielddisplay(self,'q','friction law exponent q>=1');
 			fielddisplay(self,'C','friction law max value [SI]');
 			fielddisplay(self,'As','Sliding Parameter without cavitation [m Pa^-n s^-1]');
-			fielddisplay(self,'effective_pressure','Effective Pressure [Pa]');
+			fielddisplay(self,'effective_pressure','Effective Pressure for the forcing if not coupled [Pa]');
 		end % }}}
 		function marshall(self,md,fid) % {{{
 			WriteData(fid,'enum',FrictionLawEnum,'data',3,'format','Integer');
+			WriteData(fid,'class','friction','object',self,'fieldname','Coupling','format','Integer');
 			WriteData(fid,'class','friction','object',self,'fieldname','q','format','DoubleMat','mattype',2);
 			WriteData(fid,'class','friction','object',self,'fieldname','C','format','DoubleMat','mattype',2);
 			WriteData(fid,'class','friction','object',self,'fieldname','As','format','DoubleMat','mattype',2);
-			WriteData(fid,'class','friction','object',self,'fieldname','effective_pressure','format','DoubleMat','mattype',1,'timeserieslength',md.mesh.numberofvertices+1);
-		end % }}}
+			if self.Coupling==0,
+				WriteData(fid,'class','friction','object',self,'fieldname','effective_pressure','format','DoubleMat','mattype',1,'timeserieslength',md.mesh.numberofvertices+1);
+			end
+	  end % }}}
 	end
 end

Modified: issm/trunk/src/m/classes/frictiontemp.m
===================================================================
--- issm/trunk/src/m/classes/frictiontemp.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/classes/frictiontemp.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -11,6 +11,11 @@
 		q           = NaN;
 	end
 	methods
+		function self = 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');
+		end % }}}
 		function self = frictiontemp(varargin) % {{{
 			switch nargin
 				case 0
@@ -33,13 +38,13 @@
 			%Early return
 			if ~ismember(StressbalanceAnalysisEnum(),analyses) & ~ismember(ThermalAnalysisEnum(),analyses), return; end
 
-			md = checkfield(md,'fieldname','friction.coefficient','timeseries',1,'NaN',1);
-			md = checkfield(md,'fieldname','friction.q','NaN',1,'size',[md.mesh.numberofelements 1]);
-			md = checkfield(md,'fieldname','friction.p','NaN',1,'size',[md.mesh.numberofelements 1]);
-			md = checkfield(md,'fieldname','friction.gamma','NaN',1,'numel',1,'>',0.);
+			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.gamma','NaN',1,'Inf',1,'numel',1,'>',0.);
 
 			%Check that temperature is provided
-			md = checkfield(md,'fieldname','initialization.temperature','NaN',1,'size',[md.mesh.numberofvertices 1]);
+			md = checkfield(md,'fieldname','initialization.temperature','NaN',1,'Inf',1,'size',[md.mesh.numberofvertices 1]);
 		end % }}}
 		function disp(self) % {{{
 			disp(sprintf('Basal shear stress parameters: tau_b = coefficient^2 * Neff ^r * |u_b|^(s-1) * u_b * 1/f(T)\n(effective stress Neff=rho_ice*g*thickness+rho_water*g*bed, r=q/p and s=1/p)'));

Modified: issm/trunk/src/m/classes/frictionwaterlayer.m
===================================================================
--- issm/trunk/src/m/classes/frictionwaterlayer.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/classes/frictionwaterlayer.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -6,6 +6,7 @@
 classdef frictionwaterlayer
 	properties (SetAccess=public) 
 		coefficient = NaN;
+		f           = NaN;
 		p           = NaN;
 		q           = NaN;
 		water_layer = NaN;
@@ -29,10 +30,11 @@
 			%Early return
 			if ~ismember(StressbalanceAnalysisEnum(),analyses) & ~ismember(ThermalAnalysisEnum(),analyses), return; end
 
-			md = checkfield(md,'fieldname','friction.coefficient','timeseries',1,'NaN',1);
-			md = checkfield(md,'fieldname','friction.q','NaN',1,'size',[md.mesh.numberofelements 1]);
-			md = checkfield(md,'fieldname','friction.p','NaN',1,'size',[md.mesh.numberofelements 1]);
-			md = checkfield(md,'fieldname','thermal.spctemperature','timeseries',1,'>=',0.);
+			md = checkfield(md,'fieldname','friction.coefficient','timeseries',1,'NaN',1,'Inf',1);
+			md = checkfield(md,'fieldname','friction.f','size',[1 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','thermal.spctemperature','Inf',1,'timeseries',1,'>=',0.);
 
 		end % }}}
 		function self = extrude(self,md) % {{{
@@ -44,6 +46,7 @@
 		function disp(self) % {{{
 			disp(sprintf('Basal shear stress parameters: tau_b = coefficient^2 * Neff ^r * |u_b|^(s-1) * u_b * 1/f(T)\n(effective stress Neff=rho_ice*g*thickness+rho_water*g*(bed+water_layer), r=q/p and s=1/p)'));
 			fielddisplay(self,'coefficient','frictiontemp coefficient [SI]');
+			fielddisplay(self,'f','f variable for effective pressure');
 			fielddisplay(self,'p','p exponent');
 			fielddisplay(self,'q','q exponent');
 			fielddisplay(self,'water_layer','water thickness at the base of the ice (m)');
@@ -52,6 +55,7 @@
 
 			WriteData(fid,'enum',FrictionLawEnum,'data',5,'format','Integer');
 			WriteData(fid,'class','friction','object',self,'fieldname','coefficient','format','DoubleMat','mattype',1,'timeserieslength',md.mesh.numberofvertices+1);
+			WriteData(fid,'class','friction','object',self,'fieldname','f','format','Double');
 			WriteData(fid,'class','friction','object',self,'fieldname','p','format','DoubleMat','mattype',2);
 			WriteData(fid,'class','friction','object',self,'fieldname','q','format','DoubleMat','mattype',2);
 			WriteData(fid,'class','friction','object',self,'fieldname','water_layer','format','DoubleMat','mattype',1,'timeserieslength',md.mesh.numberofvertices+1);

Modified: issm/trunk/src/m/classes/frictionweertman.m
===================================================================
--- issm/trunk/src/m/classes/frictionweertman.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/classes/frictionweertman.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -9,15 +9,6 @@
 		m = NaN;
 	end
 	methods
-		function createxml(self,fid) % {{{
-			fprintf(fid, '\n\n');
-			fprintf(fid, '%s\n', '<!-- Friction: Sigma= drag^2 * Neff ^r * u ^s, with Neff=rho_ice*g*thickness+rho_water*g*bed, r=q/p and s=1/p -->');
-			fprintf(fid,'%s\n%s\n%s\n','<frame key="1" label="Friction: Sigma= drag^2 * Neff ^r * u ^s, with Neff=rho_ice*g*thickness+rho_water*g*bed, r=q/p and s=1/p">','<section name="frictionweertman" />');   
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',    '<parameter key ="coefficient" type="',   	class(self.coefficient),'" default="',     	convert2str(self.coefficient),'">',              '     <section name="frictionweertman" />','     <help> frictionweertman coefficient [SI] </help>','</parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',    '<parameter key ="p" type="',               class(self.p),'" default="',                 convert2str(self.p),'">',   '     <section name="frictionweertman" />','     <help> p exponent </help>','</parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n',        '<parameter key ="q" type="',               class(self.q),'" default="',                 convert2str(self.q),'">',            '     <section name="frictionweertman" />','     <help> q exponent </help>','</parameter>');
-			fprintf(fid,'%s\n%s\n','</frame>');
-		end % }}}
 		function self = frictionweertman(varargin) % {{{
 			switch nargin
 				case 0
@@ -37,8 +28,8 @@
 
 			%Early return
 			if ~ismember(StressbalanceAnalysisEnum(),analyses) & ~ismember(ThermalAnalysisEnum(),analyses), return; end
-			md = checkfield(md,'fieldname','friction.C','timeseries',1,'NaN',1);
-			md = checkfield(md,'fieldname','friction.m','NaN',1,'size',[md.mesh.numberofelements 1]);
+			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]);
 		end % }}}
 		function disp(self) % {{{
 			disp('Weertman sliding law parameters:');

Modified: issm/trunk/src/m/classes/frictionweertman.py
===================================================================
--- issm/trunk/src/m/classes/frictionweertman.py	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/classes/frictionweertman.py	2016-04-13 04:32:01 UTC (rev 20500)
@@ -36,8 +36,8 @@
 		if StressbalanceAnalysisEnum() not in analyses and ThermalAnalysisEnum() not in analyses:
 			return md
 
-		md = checkfield(md,'fieldname','friction.C','timeseries',1,'NaN',1)
-		md = checkfield(md,'fieldname','friction.m','NaN',1,'size',[md.mesh.numberofelements])
+		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])
 
 		return md
 	# }}}

Modified: issm/trunk/src/m/classes/frictionweertmantemp.m
===================================================================
--- issm/trunk/src/m/classes/frictionweertmantemp.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/classes/frictionweertmantemp.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -25,8 +25,8 @@
 
 			%Early return
 			if ~ismember(StressbalanceAnalysisEnum(),analyses) & ~ismember(ThermalAnalysisEnum(),analyses), return; end
-			md = checkfield(md,'fieldname','friction.C','timeseries',1,'NaN',1);
-			md = checkfield(md,'fieldname','friction.m','NaN',1,'size',[md.mesh.numberofelements 1]);
+			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]);
 		end % }}}
 		function disp(self) % {{{
 			disp('Weertman sliding law parameters:');

Modified: issm/trunk/src/m/classes/geometry.m
===================================================================
--- issm/trunk/src/m/classes/geometry.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/classes/geometry.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -32,17 +32,6 @@
 		end% }}}
 	end
 	methods
-		function createxml(self, fid)% {{{
-			fprintf(fid, '\n\n');
-			fprintf(fid, '%s\n', '<!-- geometry -->');
-			fprintf(fid,'%s\n%s\n%s\n','<frame key="1" label="Geometry parameters">','<section name="geometry" />'); 
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="surface" type="','path','" optional="','false','">','     <section name="geometry" />','     <help> surface elevation [m] </help>','</parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="thickness" type="','path','" optional="','false','">','     <section name="geometry" />','     <help> ice thickness [m] </help>','</parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="bed" type="','path','" optional="','false','">','     <section name="geometry" />','     <help> bed elevation [m] </help>','</parameter>');
-			%fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="bathymetry" type="',class(self.bathymetry),'" default="',convert2str(self.bathymetry),'">','     <section name="geometry" />','     <help> bathymetry elevation [m] </help>','</parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n','<parameter key ="hydrostatic_ratio" type="',class(self.hydrostatic_ratio),'" default="',convert2str(self.hydrostatic_ratio),'">','     <section name="geometry" />','     <help> coefficient for ice shelves; thickness correction: hydrostatic_ratio H_obs+ (1-hydrostatic_ratio) H_hydro </help>','</parameter>');
-			fprintf(fid,'%s\n%s\n','</frame>');
-		end % }}}
 		function self = extrude(self,md) % {{{
 			self.surface=project3d(md,'vector',self.surface,'type','node');
 			self.thickness=project3d(md,'vector',self.thickness,'type','node');
@@ -64,16 +53,16 @@
 		function md = checkconsistency(self,md,solution,analyses) % {{{
 
 			if (solution==TransientSolutionEnum() & md.transient.isgia) | (solution==GiaSolutionEnum()),
-				md = checkfield(md,'fieldname','geometry.thickness','timeseries',1,'NaN',1,'>=',0);
+				md = checkfield(md,'fieldname','geometry.thickness','timeseries',1,'NaN',1,'Inf',1,'>=',0);
 			else
-				md = checkfield(md,'fieldname','geometry.surface'  ,'NaN',1,'size',[md.mesh.numberofvertices 1]);
-				md = checkfield(md,'fieldname','geometry.base'      ,'NaN',1,'size',[md.mesh.numberofvertices 1]);
-				md = checkfield(md,'fieldname','geometry.thickness','NaN',1,'size',[md.mesh.numberofvertices 1],'>',0);
-				if any((self.thickness-self.surface+self.base)>10^-9),
+				md = checkfield(md,'fieldname','geometry.surface'  ,'NaN',1,'Inf',1,'size',[md.mesh.numberofvertices 1]);
+				md = checkfield(md,'fieldname','geometry.base'      ,'NaN',1,'Inf',1,'size',[md.mesh.numberofvertices 1]);
+				md = checkfield(md,'fieldname','geometry.thickness','NaN',1,'Inf',1,'size',[md.mesh.numberofvertices 1],'>',0);
+				if any(abs(self.thickness-self.surface+self.base)>10^-9),
 					md = checkmessage(md,['equality thickness=surface-base violated']);
 				end 
 				if solution==TransientSolutionEnum() & md.transient.isgroundingline,
-					md = checkfield(md,'fieldname','geometry.bed','NaN',1,'size',[md.mesh.numberofvertices 1]);
+					md = checkfield(md,'fieldname','geometry.bed','NaN',1,'Inf',1,'size',[md.mesh.numberofvertices 1]);
 				end
 			end
 		end % }}}
@@ -93,5 +82,14 @@
 			WriteData(fid,'data',self.bed,'format','DoubleMat','mattype',1,'enum',BedEnum());
 			WriteData(fid,'object',self,'fieldname','hydrostatic_ratio','format','DoubleMat','mattype',1);
 		end % }}}
+		function savemodeljs(self,fid,modelname) % {{{
+		
+			writejs1Darray(fid,[modelname '.geometry.surface'],self.surface);
+			writejs1Darray(fid,[modelname '.geometry.thickness'],self.thickness);
+			writejs1Darray(fid,[modelname '.geometry.base'],self.base);
+			writejs1Darray(fid,[modelname '.geometry.bed'],self.bed);
+			writejs1Darray(fid,[modelname '.geometry.hydrostatic_ratio'],self.hydrostatic_ratio);
+
+		end % }}}
 	end
 end

Modified: issm/trunk/src/m/classes/geometry.py
===================================================================
--- issm/trunk/src/m/classes/geometry.py	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/classes/geometry.py	2016-04-13 04:32:01 UTC (rev 20500)
@@ -45,13 +45,16 @@
 	#}}}
 	def checkconsistency(self,md,solution,analyses):    # {{{
 
-		md = checkfield(md,'fieldname','geometry.surface'  ,'NaN',1,'size',[md.mesh.numberofvertices])
-		md = checkfield(md,'fieldname','geometry.base'      ,'NaN',1,'size',[md.mesh.numberofvertices])
-		md = checkfield(md,'fieldname','geometry.thickness','NaN',1,'size',[md.mesh.numberofvertices],'>',0,'timeseries',1)
-		if any((self.thickness-self.surface+self.base)>10**-9):
-			md.checkmessage("equality thickness=surface-base violated")
-		if solution==TransientSolutionEnum() and md.transient.isgroundingline:
-			md = checkfield(md,'fieldname','geometry.bed','NaN',1,'size',[md.mesh.numberofvertices])
+		if (solution==TransientSolutionEnum() and md.transient.isgia) or (solution==GiaSolutionEnum()):
+			md = checkfield(md,'fieldname','geometry.thickness','NaN',1,'Inf',1,'>=',0,'timeseries',1)
+		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==TransientSolutionEnum() and md.transient.isgroundingline:
+				md = checkfield(md,'fieldname','geometry.bed','NaN',1,'Inf',1,'size',[md.mesh.numberofvertices])
 
 		return md
 	# }}}

Modified: issm/trunk/src/m/classes/gia.m
===================================================================
--- issm/trunk/src/m/classes/gia.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/classes/gia.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -10,21 +10,6 @@
 		cross_section_shape           = 0;
 	end
 	methods
-		function createxml(self,fid) % {{{
-			fprintf(fid, '<!-- gia -->\n');            
-
-			% gia solution parameters
-			fprintf(fid,'%s\n%s\n%s\n','<frame key="1" label="gia parameters">','<section name="gia" />');                    
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="mantle_viscosity" type="',class(self.mantle_viscosity),'" default="',convert2str(self.mantle_viscosity),'">','     <section name="gia" />','     <help> mantle viscosity[Pa s] </help>','  </parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="lithosphere_thickness" type="',class(self.lithosphere_thickness),'" default="',convert2str(self.lithosphere_thickness),'">','     <section name="gia" />','     <help> lithosphere thickness (km) </help>','  </parameter>');
-			%cross_section_shape drop-down (1 o r 2)
-			fprintf(fid,'%s\n%s\n%s\n%s\n','  <parameter key ="cross_section_shape" type="alternative" optional="false">','     <section name="gia" />','     <help> 1: square-edged (default). 2: elliptical.  See iedge in GiaDeflectionCore </help>');
-			fprintf(fid,'%s\n','       <option value="1" type="string" default="true"> </option>');
-			fprintf(fid,'%s\n%s\n','       <option value="2" type="string" default="false"> </option>','</parameter>');
-
-			fprintf(fid,'%s\n%s\n','</frame>');    
-
-		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');
@@ -43,8 +28,8 @@
 		function md = checkconsistency(self,md,solution,analyses) % {{{
 
 			if ~ismember(GiaAnalysisEnum(),analyses), return; end
-			md = checkfield(md,'fieldname','gia.mantle_viscosity','NaN',1,'size',[md.mesh.numberofvertices 1],'>',0);
-			md = checkfield(md,'fieldname','gia.lithosphere_thickness','NaN',1,'size',[md.mesh.numberofvertices 1],'>',0);
+			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 gia, that thickness forcings 
@@ -76,5 +61,12 @@
 			WriteData(fid,'object',self,'fieldname','lithosphere_thickness','format','DoubleMat','mattype',1,'scale',10^3); %from km to m
 			WriteData(fid,'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 % }}}
 	end
 end

Modified: issm/trunk/src/m/classes/gia.py
===================================================================
--- issm/trunk/src/m/classes/gia.py	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/classes/gia.py	2016-04-13 04:32:01 UTC (rev 20500)
@@ -47,8 +47,8 @@
 		if (GiaAnalysisEnum() not in  analyses):
 			return md 
 		
-		md = checkfield(md,'fieldname','gia.mantle_viscosity','NaN',1,'size',[md.mesh.numberofvertices,1],'>',0)
-		md = checkfield(md,'fieldname','gia.lithosphere_thickness','NaN',1,'size',[md.mesh.numberofvertices,1],'>',0)
+		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 gia, that thickness forcings 

Modified: issm/trunk/src/m/classes/groundingline.m
===================================================================
--- issm/trunk/src/m/classes/groundingline.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/classes/groundingline.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -8,21 +8,6 @@
 		migration    = '';
 	end
 	methods
-		function createxml(self,fid) % {{{
-			fprintf(fid, '\n\n');
-			fprintf(fid, '%s\n', '<!-- groundingline -->');
-
-			% Convergence criteria          
-			fprintf(fid,'%s\n%s\n%s\n','<frame key="1" label="Grounding line migration parameters">','<section name="groundingline" />');  
-
-			% migration (SoftMigration, AggressiveMigration, or None)drop-down
-			fprintf(fid,'%s\n%s\n%s\n%s\n','<parameter key ="migration" type="alternative" optional="false">','     <section name="groundingline" />','     <help> type of grounding line migration: "SoftMigration","AggressiveMigration" or "None" </help>');
-			fprintf(fid,'%s\n','       <option value="SoftMigration" type="string" default="true"> </option>');
-			fprintf(fid,'%s\n','       <option value="AggressiveMigration" type="string" default="false"> </option>');
-			fprintf(fid, '%s\n%s\n','       <option value="None" type="string" default="false"></option>','</parameter>');
-
-			fprintf(fid,'%s\n%s\n','</frame>');
-		end % }}}
 		function self = groundingline(varargin) % {{{
 			switch nargin
 				case 0
@@ -45,11 +30,12 @@
 				if isnan(md.geometry.bed),
 					md = checkmessage(md,['requesting grounding line migration, but bathymetry is absent!']);
 				end
-				pos=find(md.mask.groundedice_levelset>0.);
+				pos=find(md.mask.groundedice_levelset>0. & md.mask.ice_levelset<=0);
 				if any(abs(md.geometry.base(pos)-md.geometry.bed(pos))>10^-10),
 					md = checkmessage(md,['base not equal to bed on grounded ice!']);
 				end
-				if any(md.geometry.bed - md.geometry.base > 10^-9),
+				pos=find(md.mask.groundedice_levelset<=0. & md.mask.ice_levelset<=0);
+				if any(md.geometry.bed(pos) - md.geometry.base(pos) > 10^-9),
 					md = checkmessage(md,['bed superior to base on floating ice!']);
 				end
 			end
@@ -63,5 +49,10 @@
 		function marshall(self,md,fid) % {{{
 			WriteData(fid,'data',StringToEnum(self.migration),'enum',GroundinglineMigrationEnum(),'format','Integer');
 		end % }}}
+		function savemodeljs(self,fid,modelname) % {{{
+		
+			writejsstring(fid,[modelname '.groundingline.migration'],self.migration);
+
+		end % }}}
 	end
 end

Modified: issm/trunk/src/m/classes/hydrologydc.m
===================================================================
--- issm/trunk/src/m/classes/hydrologydc.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/classes/hydrologydc.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -113,16 +113,16 @@
 			if self.transfer_flag==1,
 				md = checkfield(md,'fieldname','hydrology.leakage_factor','>',0,'numel',1);
 			end
-			md = checkfield(md,'fieldname','hydrology.basal_moulin_input','NaN',1,'timeseries',1);
+			md = checkfield(md,'fieldname','hydrology.basal_moulin_input','NaN',1,'Inf',1,'timeseries',1);
 
-			md = checkfield(md,'fieldname','hydrology.spcsediment_head','timeseries',1);
+			md = checkfield(md,'fieldname','hydrology.spcsediment_head','Inf',1,'timeseries',1);
 			md = checkfield(md,'fieldname','hydrology.sediment_compressibility','>',0,'numel',1);
 			md = checkfield(md,'fieldname','hydrology.sediment_porosity','>',0,'numel',1);
 			md = checkfield(md,'fieldname','hydrology.sediment_thickness','>',0,'numel',1);
 			md = checkfield(md,'fieldname','hydrology.sediment_transmitivity','>=',0,'size',[md.mesh.numberofvertices 1]);
 
 			if self.isefficientlayer==1,
-				md = checkfield(md,'fieldname','hydrology.spcepl_head','timeseries',1);
+				md = checkfield(md,'fieldname','hydrology.spcepl_head','Inf',1,'timeseries',1);
 				md = checkfield(md,'fieldname','hydrology.mask_eplactive_node','size',[md.mesh.numberofvertices 1],'values',[0 1]);
 				md = checkfield(md,'fieldname','hydrology.epl_compressibility','>',0,'numel',1);
 				md = checkfield(md,'fieldname','hydrology.epl_porosity','>',0,'numel',1);

Modified: issm/trunk/src/m/classes/hydrologydc.py
===================================================================
--- issm/trunk/src/m/classes/hydrologydc.py	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/classes/hydrologydc.py	2016-04-13 04:32:01 UTC (rev 20500)
@@ -162,14 +162,14 @@
 		if self.transfer_flag==1:
 			md = checkfield(md,'fieldname','hydrology.leakage_factor','>',0.,'numel',[1])
 
-		md = checkfield(md,'fieldname','hydrology.basal_moulin_input','NaN',1,'timeseries',1)
-		md = checkfield(md,'fieldname','hydrology.spcsediment_head','timeseries',1)
+		md = checkfield(md,'fieldname','hydrology.basal_moulin_input','NaN',1,'Inf',1,'timeseries',1)
+		md = checkfield(md,'fieldname','hydrology.spcsediment_head','Inf',1,'timeseries',1)
 		md = checkfield(md,'fieldname','hydrology.sediment_compressibility','>',0.,'numel',[1])
 		md = checkfield(md,'fieldname','hydrology.sediment_porosity','>',0.,'numel',[1])
 		md = checkfield(md,'fieldname','hydrology.sediment_thickness','>',0.,'numel',[1])
 		md = checkfield(md,'fieldname','hydrology.sediment_transmitivity','>=',0,'size',[md.mesh.numberofvertices,1])
 		if self.isefficientlayer==1:
-			md = checkfield(md,'fieldname','hydrology.spcepl_head','timeseries',1)
+			md = checkfield(md,'fieldname','hydrology.spcepl_head','Inf',1,'timeseries',1)
 			md = checkfield(md,'fieldname','hydrology.mask_eplactive_node','size',[md.mesh.numberofvertices,1],'values',[0,1])
 			md = checkfield(md,'fieldname','hydrology.epl_compressibility','>',0.,'numel',[1])
 			md = checkfield(md,'fieldname','hydrology.epl_porosity','>',0.,'numel',[1])

Modified: issm/trunk/src/m/classes/hydrologyshreve.m
===================================================================
--- issm/trunk/src/m/classes/hydrologyshreve.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/classes/hydrologyshreve.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -9,17 +9,6 @@
 		stabilization  = 0;
 	end
 	methods
-		function createxml(self,fid) % {{{
-			fprintf(fid, '\n\n');
-			fprintf(fid, '%s\n', '<!-- Hydrology -->');
-
-			% Convergence criteria            
-			fprintf(fid,'%s\n%s\n%s\n','<frame key="1" label="Hydrologyshreve solution parameters">','<section name="hydrologyshreve" />');                    
-
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',    '<parameter key ="spcwatercolumn" type="',      class(self.spcwatercolumn),'" default="',        convert2str(self.spcwatercolumn),'">',	'     <section name="hydrologyshreve" />','     <help> water thickness constraints (NaN means no constraint) [m] </help>','</parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',    '<parameter key ="stabilization" type="',         class(self.stabilization),'" default="',           convert2str(self.stabilization),'">',	'     <section name="hydrologyshreve" />','     <help> artificial diffusivity (default is 1). can be more than 1 to increase diffusivity. </help>','</parameter>');
-			fprintf(fid,'%s\n%s\n','</frame>');
-		end % }}}
 		function self = extrude(self,md) % {{{
 		end % }}}
 		function self = hydrologyshreve(varargin) % {{{
@@ -44,7 +33,7 @@
 				return;
 			end
 
-			md = checkfield(md,'fieldname','hydrology.spcwatercolumn','timeseries',1);
+			md = checkfield(md,'fieldname','hydrology.spcwatercolumn','Inf',1,'timeseries',1);
 			md = checkfield(md,'fieldname','hydrology.stabilization','>=',0);
 		end % }}}
 		function disp(self) % {{{
@@ -58,6 +47,12 @@
 			WriteData(fid,'object',self,'fieldname','spcwatercolumn','format','DoubleMat','mattype',1,'timeserieslength',md.mesh.numberofvertices+1);
 			WriteData(fid,'object',self,'fieldname','stabilization','format','Double');
 		end % }}}
+		function savemodeljs(self,fid,modelname) % {{{
+		
+			writejs1Darray(fid,[modelname '.hydrology.spcwatercolumn'],self.spcwatercolumn);
+			writejsdouble(fid,[modelname '.hydrology.stabilization'],self.stabilization);
+
+		end % }}}
 	end
 end
 

Modified: issm/trunk/src/m/classes/hydrologyshreve.py
===================================================================
--- issm/trunk/src/m/classes/hydrologyshreve.py	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/classes/hydrologyshreve.py	2016-04-13 04:32:01 UTC (rev 20500)
@@ -42,7 +42,7 @@
 		if HydrologyShreveAnalysisEnum() not in analyses:
 			return md
 
-		md = checkfield(md,'fieldname','hydrology.spcwatercolumn','timeseries',1)
+		md = checkfield(md,'fieldname','hydrology.spcwatercolumn','Inf',1,'timeseries',1)
 		md = checkfield(md,'fieldname','hydrology.stabilization','>=',0)
 
 		return md

Modified: issm/trunk/src/m/classes/independent.py
===================================================================
--- issm/trunk/src/m/classes/independent.py	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/classes/independent.py	2016-04-13 04:32:01 UTC (rev 20500)
@@ -1,7 +1,7 @@
 import numpy
 from pairoptions import pairoptions
 from fielddisplay import fielddisplay
-import MatlabFuncs as m
+from MatlabFuncs import *
 from EnumDefinitions import *
 
 class independent(object):

Modified: issm/trunk/src/m/classes/initialization.m
===================================================================
--- issm/trunk/src/m/classes/initialization.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/classes/initialization.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -18,23 +18,6 @@
 		watercolumn   = NaN;
 	end
 	methods
-		function createxml(self,fid) % {{{
-			fprintf(fid, '\n\n');
-			fprintf(fid, '%s\n', '<!-- initialization -->');
-			fprintf(fid,'%s\n%s\n%s\n','<frame key="1" label="Initial field values">','<section name="initialization" />');                    
-
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="vx" type="',class(self.vx),'" default="',self.vx,'">','     <section name="initialization" />','     <help> x component of velocity [m/yr] </help>','</parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="vy" type="',class(self.vy),'" default="',self.vy,'">','     <section name="initialization" />','     <help> y component of velocity [m/yr] </help>','</parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="vz" type="',class(self.vz),'" default="',self.vz,'">','     <section name="initialization" />','     <help> z component of velocity [m/yr] </help>','</parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="vel" type="',class(self.vel),'" default="',self.vel,'">','     <section name="initialization" />','     <help> velocity norm [m/yr] </help>','</parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="pressure" type="',class(self.pressure),'" default="',self.pressure,'">','     <section name="initialization" />','     <help> pressure field [Pa] </help>','</parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="temperature" type="',class(self.temperature),'" default="',self.temperature,'">','     <section name="initialization" />','     <help> fraction of water in the ice </help>','</parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="waterfraction" type="',class(self.waterfraction),'" default="',self.waterfraction,'">','     <section name="initialization" />','     <help> ice thickness [m] </help>','</parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="sediment_head" type="',class(self.sediment_head),'" default="',self.sediment_head,'">','     <section name="initialization" />','     <help> sediment water head of subglacial system [m] </help>','</parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="epl_head" type="',class(self.epl_head),'" default="',self.epl_head,'">','     <section name="initialization" />','     <help> epl water head of subglacial system [m] </help>','</parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n','<parameter key ="watercolumn" type="',class(self.watercolumn),'" default="',self.watercolumn,'">','     <section name="initialization" />','     <help> thickness of subglacial water [m] </help>','</parameter>');
-			fprintf(fid,'%s\n%s\n','</frame>');
-		end % }}}
 		function self = extrude(self,md) % {{{
 			self.vx=project3d(md,'vector',self.vx,'type','node');
 			self.vy=project3d(md,'vector',self.vy,'type','node');
@@ -62,32 +45,32 @@
 
 		end % }}}
 		function md = checkconsistency(self,md,solution,analyses) % {{{
-			if ismember(StressbalanceAnalysisEnum(),analyses)
+			if ismember(StressbalanceAnalysisEnum(),analyses) & ~(solution==TransientSolutionEnum() & md.transient.isstressbalance == 0),
 				if ~(isnan(md.initialization.vx) | isnan(md.initialization.vy)),
-					md = checkfield(md,'fieldname','initialization.vx','NaN',1,'size',[md.mesh.numberofvertices 1]);
-					md = checkfield(md,'fieldname','initialization.vy','NaN',1,'size',[md.mesh.numberofvertices 1]);
+					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
 			end
-			if ismember(MasstransportAnalysisEnum(),analyses),
-				md = checkfield(md,'fieldname','initialization.vx','NaN',1,'size',[md.mesh.numberofvertices 1]);
-				md = checkfield(md,'fieldname','initialization.vy','NaN',1,'size',[md.mesh.numberofvertices 1]);
+			if ismember(MasstransportAnalysisEnum(),analyses) & ~(solution==TransientSolutionEnum() & md.transient.ismasstransport == 0),
+				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(BalancethicknessAnalysisEnum(),analyses) & solution==BalancethicknessSolutionEnum,
-				md = checkfield(md,'fieldname','initialization.vx','NaN',1,'size',[md.mesh.numberofvertices 1]);
-				md = checkfield(md,'fieldname','initialization.vy','NaN',1,'size',[md.mesh.numberofvertices 1]);
+				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]);
 				%Triangle with zero velocity
 				if any(sum(abs(md.initialization.vx(md.mesh.elements)),2)==0 & sum(abs(md.initialization.vy(md.mesh.elements)),2)==0)
 					md = checkmessage(md,'at least one triangle has all its vertices with a zero velocity');
 				end
 			end
-			if ismember(ThermalAnalysisEnum(),analyses),
-				md = checkfield(md,'fieldname','initialization.vx','NaN',1,'size',[md.mesh.numberofvertices 1]);
-				md = checkfield(md,'fieldname','initialization.vy','NaN',1,'size',[md.mesh.numberofvertices 1]);
+			if ismember(ThermalAnalysisEnum(),analyses) & ~(solution==TransientSolutionEnum() & md.transient.isthermal == 0),
+				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]);
 				if dimension(md.mesh)==3
-					md = checkfield(md,'fieldname','initialization.vz','NaN',1,'size',[md.mesh.numberofvertices 1]);
+					md = checkfield(md,'fieldname','initialization.vz','NaN',1,'Inf',1,'size',[md.mesh.numberofvertices 1]);
 				end
-				md = checkfield(md,'fieldname','initialization.pressure','NaN',1,'size',[md.mesh.numberofvertices 1]);
-				md = checkfield(md,'fieldname','initialization.temperature','NaN',1,'size',[md.mesh.numberofvertices 1]);
+				md = checkfield(md,'fieldname','initialization.pressure','NaN',1,'Inf',1,'size',[md.mesh.numberofvertices 1]);
+				md = checkfield(md,'fieldname','initialization.temperature','NaN',1,'Inf',1,'size',[md.mesh.numberofvertices 1]);
 			end
 			if (ismember(EnthalpyAnalysisEnum(),analyses) & md.thermal.isenthalpy)
 				md = checkfield(md,'fieldname','initialization.waterfraction','>=',0,'size',[md.mesh.numberofvertices 1]);
@@ -95,19 +78,19 @@
 			end
 			if ismember(HydrologyShreveAnalysisEnum(),analyses),
 				if isa(md.hydrology,'hydrologyshreve'),
-					md = checkfield(md,'fieldname','initialization.watercolumn','NaN',1,'size',[md.mesh.numberofvertices 1]);
+					md = checkfield(md,'fieldname','initialization.watercolumn','NaN',1,'Inf',1,'size',[md.mesh.numberofvertices 1]);
 				end
 			end
 			if ismember(HydrologyDCInefficientAnalysisEnum(),analyses),
 				if isa(md.hydrology,'hydrologydc'),
-					md = checkfield(md,'fieldname','initialization.sediment_head','NaN',1,'size',[md.mesh.numberofvertices 1]);
+					md = checkfield(md,'fieldname','initialization.sediment_head','NaN',1,'Inf',1,'size',[md.mesh.numberofvertices 1]);
 				end
 			end
 			if ismember(HydrologyDCEfficientAnalysisEnum(),analyses),
 				if isa(md.hydrology,'hydrologydc'),
 					if md.hydrology.isefficientlayer==1,
-						md = checkfield(md,'fieldname','initialization.epl_head','NaN',1,'size',[md.mesh.numberofvertices 1]);
-						md = checkfield(md,'fieldname','initialization.epl_thickness','NaN',1,'size',[md.mesh.numberofvertices 1]);
+						md = checkfield(md,'fieldname','initialization.epl_head','NaN',1,'Inf',1,'size',[md.mesh.numberofvertices 1]);
+						md = checkfield(md,'fieldname','initialization.epl_thickness','NaN',1,'Inf',1,'size',[md.mesh.numberofvertices 1]);
 					end
 				end
 			end
@@ -151,5 +134,20 @@
 				WriteData(fid,'data',enthalpy,'format','DoubleMat','mattype',1,'enum',EnthalpyEnum());
 			end
 		end % }}}
+		function savemodeljs(self,fid,modelname) % {{{
+		
+			writejs1Darray(fid,[modelname '.initialization.vx'],self.vx);
+			writejs1Darray(fid,[modelname '.initialization.vy'],self.vy);
+			writejs1Darray(fid,[modelname '.initialization.vz'],self.vz);
+			writejs1Darray(fid,[modelname '.initialization.vel'],self.vel);
+			writejs1Darray(fid,[modelname '.initialization.pressure'],self.pressure);
+			writejs1Darray(fid,[modelname '.initialization.temperature'],self.temperature);
+			writejs1Darray(fid,[modelname '.initialization.waterfraction'],self.waterfraction);
+			writejs1Darray(fid,[modelname '.initialization.sediment_head'],self.sediment_head);
+			writejs1Darray(fid,[modelname '.initialization.epl_head'],self.epl_head);
+			writejs1Darray(fid,[modelname '.initialization.epl_thickness'],self.epl_thickness);
+			writejs1Darray(fid,[modelname '.initialization.watercolumn'],self.watercolumn);
+
+		end % }}}
 	end
 end

Modified: issm/trunk/src/m/classes/initialization.py
===================================================================
--- issm/trunk/src/m/classes/initialization.py	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/classes/initialization.py	2016-04-13 04:32:01 UTC (rev 20500)
@@ -70,39 +70,39 @@
 	def checkconsistency(self,md,solution,analyses):    # {{{
 		if StressbalanceAnalysisEnum() in analyses:
 			if not numpy.any(numpy.logical_or(numpy.isnan(md.initialization.vx),numpy.isnan(md.initialization.vy))):
-				md = checkfield(md,'fieldname','initialization.vx','NaN',1,'size',[md.mesh.numberofvertices])
-				md = checkfield(md,'fieldname','initialization.vy','NaN',1,'size',[md.mesh.numberofvertices])
+				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 MasstransportAnalysisEnum() in analyses:
-			md = checkfield(md,'fieldname','initialization.vx','NaN',1,'size',[md.mesh.numberofvertices])
-			md = checkfield(md,'fieldname','initialization.vy','NaN',1,'size',[md.mesh.numberofvertices])
+			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 BalancethicknessAnalysisEnum() in analyses:
-			md = checkfield(md,'fieldname','initialization.vx','NaN',1,'size',[md.mesh.numberofvertices])
-			md = checkfield(md,'fieldname','initialization.vy','NaN',1,'size',[md.mesh.numberofvertices])
+			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])
 			#Triangle with zero velocity
 			if numpy.any(numpy.logical_and(numpy.sum(numpy.abs(md.initialization.vx[md.mesh.elements-1]),axis=1)==0,\
 			                               numpy.sum(numpy.abs(md.initialization.vy[md.mesh.elements-1]),axis=1)==0)):
 				md.checkmessage("at least one triangle has all its vertices with a zero velocity")
 		if ThermalAnalysisEnum() in analyses:
-			md = checkfield(md,'fieldname','initialization.vx','NaN',1,'size',[md.mesh.numberofvertices])
-			md = checkfield(md,'fieldname','initialization.vy','NaN',1,'size',[md.mesh.numberofvertices])
-			md = checkfield(md,'fieldname','initialization.temperature','NaN',1,'size',[md.mesh.numberofvertices])
+			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])
+			md = checkfield(md,'fieldname','initialization.temperature','NaN',1,'Inf',1,'size',[md.mesh.numberofvertices])
 			if md.mesh.dimension()==3:
-				md = checkfield(md,'fieldname','initialization.vz','NaN',1,'size',[md.mesh.numberofvertices])
-			md = checkfield(md,'fieldname','initialization.pressure','NaN',1,'size',[md.mesh.numberofvertices])
+				md = checkfield(md,'fieldname','initialization.vz','NaN',1,'Inf',1,'size',[md.mesh.numberofvertices])
+			md = checkfield(md,'fieldname','initialization.pressure','NaN',1,'Inf',1,'size',[md.mesh.numberofvertices])
 			if (EnthalpyAnalysisEnum() in analyses and md.thermal.isenthalpy):
 				md = checkfield(md,'fieldname','initialization.waterfraction','>=',0,'size',[md.mesh.numberofvertices])
 				md = checkfield(md,'fieldname','initialization.watercolumn'  ,'>=',0,'size',[md.mesh.numberofvertices])
 		if HydrologyShreveAnalysisEnum() in analyses:
 			if hasattr(md.hydrology,'hydrologyshreve'):
-				md = checkfield(md,'fieldname','initialization.watercolumn','NaN',1,'size',[md.mesh.numberofvertices])
+				md = checkfield(md,'fieldname','initialization.watercolumn','NaN',1,'Inf',1,'size',[md.mesh.numberofvertices])
 		if HydrologyDCInefficientAnalysisEnum() in analyses:
 			if hasattr(md.hydrology,'hydrologydc'):
-				md = checkfield(md,'fieldname','initialization.sediment_head','NaN',1,'size',[md.mesh.numberofvertices,1])
+				md = checkfield(md,'fieldname','initialization.sediment_head','NaN',1,'Inf',1,'size',[md.mesh.numberofvertices,1])
 		if HydrologyDCEfficientAnalysisEnum() in analyses:
 			if hasattr(md.hydrology,'hydrologydc'):
 				if md.hydrology.isefficientlayer==1:
-					md = checkfield(md,'fieldname','initialization.epl_head','NaN',1,'size',[md.mesh.numberofvertices,1])
-					md = checkfield(md,'fieldname','initialization.epl_thickness','NaN',1,'size',[md.mesh.numberofvertices,1])
+					md = checkfield(md,'fieldname','initialization.epl_head','NaN',1,'Inf',1,'size',[md.mesh.numberofvertices,1])
+					md = checkfield(md,'fieldname','initialization.epl_thickness','NaN',1,'Inf',1,'size',[md.mesh.numberofvertices,1])
 
 		return md
 	# }}}

Modified: issm/trunk/src/m/classes/inversion.m
===================================================================
--- issm/trunk/src/m/classes/inversion.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/classes/inversion.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -25,55 +25,6 @@
 		surface_obs                 = NaN
 	end
 	methods
-		function createxml(self,fid) % {{{
-			fprintf(fid, '<!-- inversion -->\n');            
-
-			% inversion parameters
-			fprintf(fid,'%s\n%s\n%s\n','<frame key="1" label="inversion parameters">','<section name="inversion" />');                    
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="iscontrol" type="',class(self.iscontrol),'" default="',convert2str(self.iscontrol),'">','     <section name="inversion" />','     <help> is inversion activated? </help>','  </parameter>');
-
-			% incompleteadjoing drop-down (0 or 1)
-			fprintf(fid,'%s\n%s\n%s\n%s\n','  <parameter key ="incomplete_adjoint" type="alternative" optional="false">','     <section name="inversion" />','     <help> 1: linear viscosity, 0: non-linear viscosity </help>');
-			fprintf(fid,'%s\n','       <option value="0" type="string" default="true"> </option>');
-			fprintf(fid,'%s\n%s\n','       <option value="1" type="string" default="false"> </option>','</parameter>');
-
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="control_parameters" type="',class(self.control_parameters),'" default="',convert2str(self.control_parameters),'">','     <section name="inversion" />','     <help> ex: {''FrictionCoefficient''}, or {''MaterialsRheologyBbar''} </help>','  </parameter>');
-
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="nsteps" type="',class(self.nsteps),'" default="',convert2str(self.nsteps),'">','     <section name="inversion" />','     <help> number of optimization searches </help>','  </parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="cost_functions" type="',class(self.cost_functions),'" default="',convert2str(self.cost_functions),'">','     <section name="inversion" />','     <help> indicate the type of response for each optimization step  </help>','  </parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="cost_functions_coefficients" type="',class(self.cost_functions_coefficients),'" default="',convert2str(self.cost_functions_coefficients),'">','     <section name="inversion" />','     <help> cost_functions_coefficients applied to the misfit of each vertex and for each control_parameter </help>','  </parameter>');
-
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="cost_function_threshold" type="',class(self.cost_function_threshold),'" default="',convert2str(self.cost_function_threshold),'">','     <section name="inversion" />','     <help> misfit convergence criterion. Default is 1%, NaN if not applied </help>','  </parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="maxiter_per_step" type="',class(self.maxiter_per_step),'" default="',convert2str(self.maxiter_per_step),'">','     <section name="inversion" />','     <help> maximum iterations during each optimization step  </help>','  </parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="gradient_scaling" type="',class(self.gradient_scaling),'" default="',convert2str(self.gradient_scaling),'">','     <section name="inversion" />','     <help> scaling factor on gradient direction during optimization, for each optimization step </help>','  </parameter>');
-
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="step_threshold" type="',class(self.step_threshold),'" default="',convert2str(self.step_threshold),'">','     <section name="inversion" />','     <help> decrease threshold for misfit, default is 30% </help>','  </parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="min_parameters" type="',class(self.min_parameters),'" default="',convert2str(self.min_parameters),'">','     <section name="inversion" />','     <help> absolute minimum acceptable value of the inversed parameter on each vertex </help>','  </parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="max_parameters" type="',class(self.max_parameters),'" default="',convert2str(self.max_parameters),'">','     <section name="inversion" />','     <help> absolute maximum acceptable value of the inversed parameter on each vertex </help>','  </parameter>');
-
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="vx_obs" type="',class(self.vx_obs),'" default="',convert2str(self.vx_obs),'">','     <section name="inversion" />','     <help> observed velocity x component [m/yr] </help>','  </parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="vy_obs" type="',class(self.vy_obs),'" default="',convert2str(self.vy_obs),'">','     <section name="inversion" />','     <help> observed velocity y component [m/yr]  </help>','  </parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="vel_obs" type="',class(self.vel_obs),'" default="',convert2str(self.vel_obs),'">','     <section name="inversion" />','     <help> observed velocity magnitude [m/yr] </help>','  </parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="thickness_obs" type="',class(self.thickness_obs),'" default="',convert2str(self.thickness_obs),'">','     <section name="inversion" />','     <help> observed thickness [m]) </help>','  </parameter>');
-
-			fprintf(fid,'%s\n%s\n','</frame>');    
-
-			fprintf(fid,'%s\n%s\n%s\n','<frame key="2" label="Available cost functions">','<section name="inversion" />');                    
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="SurfaceAbsVelMisfit" type="','string','" default="','101','">','     <section name="inversion" />','     <help>  </help>','  </parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="SurfaceRelVelMisfit" type="','string','" default="','102','">','     <section name="inversion" />','     <help>   </help>','  </parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="SurfaceLogVelMisfit" type="','string','" default="','103','">','     <section name="inversion" />','     <help>  </help>','  </parameter>');
-
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="SurfaceLogVxVyMisfit" type="','string','" default="','104','">','     <section name="inversion" />','     <help>  </help>','  </parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="SurfaceAverageVelMisfit" type="','string','" default="','105','">','     <section name="inversion" />','     <help>   </help>','  </parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="ThicknessAbsMisfit" type="','string','" default="','106','">','     <section name="inversion" />','     <help>  </help>','  </parameter>');
-
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="DragCoefficientAbsGradient" type="','string','" default="','107','">','     <section name="inversion" />','     <help>  </help>','  </parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="RheologyBbarAbsGradient" type="','string','" default="','108','">','     <section name="inversion" />','     <help>  </help>','  </parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="ThicknessAbsGradient" type="','string','" default="','109','">','     <section name="inversion" />','     <help> </help>','  </parameter>');
-
-			fprintf(fid,'%s\n%s\n','</frame>');    
-
-		end % }}}       
 		function self = inversion(varargin) % {{{
 			switch nargin
 				case 0
@@ -158,12 +109,12 @@
 			end
 
 			if solution==BalancethicknessSolutionEnum()
-				md = checkfield(md,'fieldname','inversion.thickness_obs','size',[md.mesh.numberofvertices 1],'NaN',1);
+				md = checkfield(md,'fieldname','inversion.thickness_obs','size',[md.mesh.numberofvertices 1],'NaN',1,'Inf',1);
 			elseif solution==BalancethicknessSoftSolutionEnum()
-				md = checkfield(md,'fieldname','inversion.thickness_obs','size',[md.mesh.numberofvertices 1],'NaN',1);
+				md = checkfield(md,'fieldname','inversion.thickness_obs','size',[md.mesh.numberofvertices 1],'NaN',1,'Inf',1);
 			else
-				md = checkfield(md,'fieldname','inversion.vx_obs','size',[md.mesh.numberofvertices 1],'NaN',1);
-				md = checkfield(md,'fieldname','inversion.vy_obs','size',[md.mesh.numberofvertices 1],'NaN',1);
+				md = checkfield(md,'fieldname','inversion.vx_obs','size',[md.mesh.numberofvertices 1],'NaN',1,'Inf',1);
+				md = checkfield(md,'fieldname','inversion.vy_obs','size',[md.mesh.numberofvertices 1],'NaN',1,'Inf',1);
 			end
 		end % }}}
 		function disp(self) % {{{
@@ -239,5 +190,23 @@
 			WriteData(fid,'data',data,'enum',InversionCostFunctionsEnum(),'format','DoubleMat','mattype',3);
 			WriteData(fid,'data',num_cost_functions,'enum',InversionNumCostFunctionsEnum(),'format','Integer');
 		end % }}}
+		function savemodeljs(self,fid,modelname) % {{{
+		
+			writejsdouble(fid,[modelname '.inversion.iscontrol'],self.iscontrol);
+			writejsdouble(fid,[modelname '.inversion.incomplete_adjoint'],self.incomplete_adjoint);
+			writejscellstring(fid,[modelname '.inversion.control_parameters'],self.control_parameters);
+			writejsdouble(fid,[modelname '.inversion.nsteps'],self.nsteps);
+			writejs1Darray(fid,[modelname '.inversion.maxiter_per_step'],self.maxiter_per_step);
+			writejs2Darray(fid,[modelname '.inversion.cost_functions'],self.cost_functions);
+			writejs2Darray(fid,[modelname '.inversion.cost_functions_coefficients'],self.cost_functions_coefficients);
+			writejs1Darray(fid,[modelname '.inversion.min_parameters'],self.min_parameters);
+			writejs1Darray(fid,[modelname '.inversion.max_parameters'],self.max_parameters);
+			writejs1Darray(fid,[modelname '.inversion.vx_obs'],self.vx_obs);
+			writejs1Darray(fid,[modelname '.inversion.vy_obs'],self.vy_obs);
+			writejs1Darray(fid,[modelname '.inversion.vz_obs'],self.vz_obs);
+			writejs1Darray(fid,[modelname '.inversion.vel_obs'],self.vel_obs);
+			writejs1Darray(fid,[modelname '.inversion.thickness_obs'],self.thickness_obs);
+			writejs1Darray(fid,[modelname '.inversion.surface_obs'],self.surface_obs);
+		end % }}}
 	end
 end

Modified: issm/trunk/src/m/classes/inversion.py
===================================================================
--- issm/trunk/src/m/classes/inversion.py	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/classes/inversion.py	2016-04-13 04:32:01 UTC (rev 20500)
@@ -150,10 +150,10 @@
 				md.checkmessage("'inversion can only be performed for SSA, HO or FS ice flow models");
 
 		if solution==BalancethicknessSolutionEnum():
-			md = checkfield(md,'fieldname','inversion.thickness_obs','size',[md.mesh.numberofvertices],'NaN',1)
+			md = checkfield(md,'fieldname','inversion.thickness_obs','size',[md.mesh.numberofvertices],'NaN',1,'Inf',1)
 		else:
-			md = checkfield(md,'fieldname','inversion.vx_obs','size',[md.mesh.numberofvertices],'NaN',1)
-			md = checkfield(md,'fieldname','inversion.vy_obs','size',[md.mesh.numberofvertices],'NaN',1)
+			md = checkfield(md,'fieldname','inversion.vx_obs','size',[md.mesh.numberofvertices],'NaN',1,'Inf',1)
+			md = checkfield(md,'fieldname','inversion.vy_obs','size',[md.mesh.numberofvertices],'NaN',1,'Inf',1)
 
 		return md
 	# }}}

Modified: issm/trunk/src/m/classes/inversionvalidation.m
===================================================================
--- issm/trunk/src/m/classes/inversionvalidation.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/classes/inversionvalidation.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -66,20 +66,20 @@
 			md = checkfield(md,'fieldname','inversion.iscontrol','values',[0 1]);
 			md = checkfield(md,'fieldname','inversion.incomplete_adjoint','values',[0 1]);
 			md = checkfield(md,'fieldname','inversion.control_parameters','cell',1,'values',supportedcontrols());
-			md = checkfield(md,'fieldname','inversion.control_scaling_factors','size',[1 num_controls],'>',0,'NaN',1);
+			md = checkfield(md,'fieldname','inversion.control_scaling_factors','size',[1 num_controls],'>',0,'NaN',1,'Inf',1);
 			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]);
 
 			if solution==BalancethicknessSolutionEnum()
-				md = checkfield(md,'fieldname','inversion.thickness_obs','size',[md.mesh.numberofvertices 1],'NaN',1);
+				md = checkfield(md,'fieldname','inversion.thickness_obs','size',[md.mesh.numberofvertices 1],'NaN',1,'Inf',1);
 			elseif solution==BalancethicknessSoftSolutionEnum()
-				md = checkfield(md,'fieldname','inversion.thickness_obs','size',[md.mesh.numberofvertices 1],'NaN',1);
+				md = checkfield(md,'fieldname','inversion.thickness_obs','size',[md.mesh.numberofvertices 1],'NaN',1,'Inf',1);
 			else
-				md = checkfield(md,'fieldname','inversion.vx_obs','size',[md.mesh.numberofvertices 1],'NaN',1);
+				md = checkfield(md,'fieldname','inversion.vx_obs','size',[md.mesh.numberofvertices 1],'NaN',1,'Inf',1);
 				if ~strcmp(domaintype(md.mesh),'2Dvertical'),
-					md = checkfield(md,'fieldname','inversion.vy_obs','size',[md.mesh.numberofvertices 1],'NaN',1);
+					md = checkfield(md,'fieldname','inversion.vy_obs','size',[md.mesh.numberofvertices 1],'NaN',1,'Inf',1);
 				end
 			end
 		end % }}}

Modified: issm/trunk/src/m/classes/linearbasalforcings.m
===================================================================
--- issm/trunk/src/m/classes/linearbasalforcings.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/classes/linearbasalforcings.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -12,13 +12,6 @@
 		geothermalflux            = NaN;
 	end
 	methods
-     function createxml(self,fid) % {{{
-            fprintf(fid, '\n\n');
-            fprintf(fid, '%s\n', '<!-- basalforcings -->');
-			 fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',    '<parameter key ="melting_rate" type="',            class(self.melting_rate),'" default="',              num2str(self.melting_rate),'">',              '     <section name="basalforcings" />','     <help> basal melting rate (positive if melting) [m/yr] </help>','</parameter>');
-             fprintf(fid,'%s%s%s%s%s\n%s\n%s\n',        '<parameter key ="geothermalflux" type="',          class(self.geothermalflux),'" default="',            num2str(self.geothermalflux),'">',            '     <section name="basalforcings" />','     <help> geothermal heat flux [W/m^2] </help>','</parameter>');
-             
-        end % }}}
 		function self = linearbasalforcings(varargin) % {{{
 			switch nargin
 				case 0
@@ -48,23 +41,23 @@
 		function md = checkconsistency(self,md,solution,analyses) % {{{
 
 			if ismember(MasstransportAnalysisEnum(),analyses) & ~(solution==TransientSolutionEnum() & md.transient.ismasstransport==0),
-				md = checkfield(md,'fieldname','basalforcings.groundedice_melting_rate','NaN',1,'timeseries',1);
+				md = checkfield(md,'fieldname','basalforcings.groundedice_melting_rate','NaN',1,'Inf',1,'timeseries',1);
 				md = checkfield(md,'fieldname','basalforcings.deepwater_melting_rate','>=',0,'numel',1);
 				md = checkfield(md,'fieldname','basalforcings.deepwater_elevation','<','basalforcings.upperwater_elevation','numel',1);
 				md = checkfield(md,'fieldname','basalforcings.upperwater_elevation','<',0,'numel',1);
 			end
 			if ismember(BalancethicknessAnalysisEnum(),analyses),
-				md = checkfield(md,'fieldname','basalforcings.groundedice_melting_rate','NaN',1,'size',[md.mesh.numberofvertices 1]);
+				md = checkfield(md,'fieldname','basalforcings.groundedice_melting_rate','NaN',1,'Inf',1,'size',[md.mesh.numberofvertices 1]);
 				md = checkfield(md,'fieldname','basalforcings.deepwater_melting_rate','>=',0,'numel',1);
 				md = checkfield(md,'fieldname','basalforcings.deepwater_elevation','<','basalforcings.upperwater_elevation','numel',1);
 				md = checkfield(md,'fieldname','basalforcings.upperwater_elevation','<',0,'numel',1);
 			end
 			if ismember(ThermalAnalysisEnum(),analyses) & ~(solution==TransientSolutionEnum() & md.transient.isthermal==0),
-				md = checkfield(md,'fieldname','basalforcings.groundedice_melting_rate','NaN',1,'timeseries',1);
+				md = checkfield(md,'fieldname','basalforcings.groundedice_melting_rate','NaN',1,'Inf',1,'timeseries',1);
 				md = checkfield(md,'fieldname','basalforcings.deepwater_melting_rate','>=',0,'numel',1);
 				md = checkfield(md,'fieldname','basalforcings.deepwater_elevation','<','basalforcings.upperwater_elevation','numel',1);
 				md = checkfield(md,'fieldname','basalforcings.upperwater_elevation','<',0,'numel',1);
-				md = checkfield(md,'fieldname','basalforcings.geothermalflux','NaN',1,'timeseries',1,'>=',0);
+				md = checkfield(md,'fieldname','basalforcings.geothermalflux','NaN',1,'Inf',1,'timeseries',1,'>=',0);
 			end
 		end % }}}
 		function disp(self) % {{{

Modified: issm/trunk/src/m/classes/linearbasalforcings.py
===================================================================
--- issm/trunk/src/m/classes/linearbasalforcings.py	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/classes/linearbasalforcings.py	2016-04-13 04:32:01 UTC (rev 20500)
@@ -68,23 +68,23 @@
 	def checkconsistency(self,md,solution,analyses):    # {{{
 
 		if MasstransportAnalysisEnum() in analyses and not (solution==TransientSolutionEnum() and not md.transient.ismasstransport):
-			md = checkfield(md,'fieldname','basalforcings.groundedice_melting_rate','NaN',1,'timeseries',1)
+			md = checkfield(md,'fieldname','basalforcings.groundedice_melting_rate','NaN',1,'Inf',1,'timeseries',1)
 			md = checkfield(md,'fieldname','basalforcings.deepwater_melting_rate','>=',0);
 			md = checkfield(md,'fieldname','basalforcings.deepwater_elevation','<',md.basalforcings.upperwater_elevation);
 			md = checkfield(md,'fieldname','basalforcings.upperwater_elevation','<',0);
 
 		if BalancethicknessAnalysisEnum() in analyses:
-			md = checkfield(md,'fieldname','basalforcings.groundedice_melting_rate','NaN',1,'size',[md.mesh.numberofvertices])
+			md = checkfield(md,'fieldname','basalforcings.groundedice_melting_rate','NaN',1,'Inf',1,'size',[md.mesh.numberofvertices])
 			md = checkfield(md,'fieldname','basalforcings.deepwater_melting_rate','>=',0);
 			md = checkfield(md,'fieldname','basalforcings.deepwater_elevation','<',md.basalforcings.upperwater_elevation);
 			md = checkfield(md,'fieldname','basalforcings.upperwater_elevation','<',0);
 
 		if ThermalAnalysisEnum() in analyses and not (solution==TransientSolutionEnum() and not md.transient.isthermal):
-			md = checkfield(md,'fieldname','basalforcings.groundedice_melting_rate','NaN',1,'timeseries',1)
+			md = checkfield(md,'fieldname','basalforcings.groundedice_melting_rate','NaN',1,'Inf',1,'timeseries',1)
 			md = checkfield(md,'fieldname','basalforcings.deepwater_melting_rate','>=',0);
 			md = checkfield(md,'fieldname','basalforcings.deepwater_elevation','<',md.basalforcings.upperwater_elevation);
 			md = checkfield(md,'fieldname','basalforcings.upperwater_elevation','<',0);
-			md = checkfield(md,'fieldname','basalforcings.geothermalflux','NaN',1,'timeseries',1,'>=',0)
+			md = checkfield(md,'fieldname','basalforcings.geothermalflux','NaN',1,'Inf',1,'timeseries',1,'>=',0)
 
 		return md
 	# }}}

Modified: issm/trunk/src/m/classes/m1qn3inversion.m
===================================================================
--- issm/trunk/src/m/classes/m1qn3inversion.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/classes/m1qn3inversion.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -83,7 +83,7 @@
 			md = checkfield(md,'fieldname','inversion.iscontrol','values',[0 1]);
 			md = checkfield(md,'fieldname','inversion.incomplete_adjoint','values',[0 1]);
 			md = checkfield(md,'fieldname','inversion.control_parameters','cell',1,'values',supportedcontrols());
-			md = checkfield(md,'fieldname','inversion.control_scaling_factors','size',[1 num_controls],'>',0,'NaN',1);
+			md = checkfield(md,'fieldname','inversion.control_scaling_factors','size',[1 num_controls],'>',0,'NaN',1,'Inf',1);
 			md = checkfield(md,'fieldname','inversion.maxsteps','numel',1,'>=',0);
 			md = checkfield(md,'fieldname','inversion.maxiter','numel',1,'>=',0);
 			md = checkfield(md,'fieldname','inversion.dxmin','numel',1,'>',0);
@@ -94,14 +94,14 @@
 			md = checkfield(md,'fieldname','inversion.max_parameters','size',[md.mesh.numberofvertices num_controls]);
 
 			if solution==BalancethicknessSolutionEnum()
-				md = checkfield(md,'fieldname','inversion.thickness_obs','size',[md.mesh.numberofvertices 1],'NaN',1);
-				md = checkfield(md,'fieldname','inversion.surface_obs','size',[md.mesh.numberofvertices 1],'NaN',1);
+				md = checkfield(md,'fieldname','inversion.thickness_obs','size',[md.mesh.numberofvertices 1],'NaN',1,'Inf',1);
+				md = checkfield(md,'fieldname','inversion.surface_obs','size',[md.mesh.numberofvertices 1],'NaN',1,'Inf',1);
 			elseif solution==BalancethicknessSoftSolutionEnum()
-				md = checkfield(md,'fieldname','inversion.thickness_obs','size',[md.mesh.numberofvertices 1],'NaN',1);
+				md = checkfield(md,'fieldname','inversion.thickness_obs','size',[md.mesh.numberofvertices 1],'NaN',1,'Inf',1);
 			else
-				md = checkfield(md,'fieldname','inversion.vx_obs','size',[md.mesh.numberofvertices 1],'NaN',1);
+				md = checkfield(md,'fieldname','inversion.vx_obs','size',[md.mesh.numberofvertices 1],'NaN',1,'Inf',1);
 				if ~strcmp(domaintype(md.mesh),'2Dvertical'),
-					md = checkfield(md,'fieldname','inversion.vy_obs','size',[md.mesh.numberofvertices 1],'NaN',1);
+					md = checkfield(md,'fieldname','inversion.vy_obs','size',[md.mesh.numberofvertices 1],'NaN',1,'Inf',1);
 				end
 			end
 		end % }}}
@@ -177,5 +177,27 @@
 			WriteData(fid,'data',data,'enum',InversionCostFunctionsEnum(),'format','DoubleMat','mattype',3);
 			WriteData(fid,'data',num_cost_functions,'enum',InversionNumCostFunctionsEnum(),'format','Integer');
 		end % }}}
+		function savemodeljs(self,fid,modelname) % {{{
+		
+			writejsdouble(fid,[modelname '.inversion.iscontrol'],self.iscontrol);
+			writejsdouble(fid,[modelname '.inversion.incomplete_adjoint'],self.incomplete_adjoint);
+			writejscellstring(fid,[modelname '.inversion.control_parameters'],self.control_parameters);
+			writejsdouble(fid,[modelname '.inversion.control_scaling_factors'],self.control_scaling_factors);
+			writejsdouble(fid,[modelname '.inversion.maxsteps'],self.maxsteps);
+			writejsdouble(fid,[modelname '.inversion.maxiter'],self.maxiter);
+			writejsdouble(fid,[modelname '.inversion.dxmin'],self.dxmin);
+			writejsdouble(fid,[modelname '.inversion.gttol'],self.gttol);
+			writejs2Darray(fid,[modelname '.inversion.cost_functions'],self.cost_functions);
+			writejs2Darray(fid,[modelname '.inversion.cost_functions_coefficients'],self.cost_functions_coefficients);
+			writejs1Darray(fid,[modelname '.inversion.min_parameters'],self.min_parameters);
+			writejs1Darray(fid,[modelname '.inversion.max_parameters'],self.max_parameters);
+			writejs1Darray(fid,[modelname '.inversion.vx_obs'],self.vx_obs);
+			writejs1Darray(fid,[modelname '.inversion.vy_obs'],self.vy_obs);
+			writejs1Darray(fid,[modelname '.inversion.vz_obs'],self.vz_obs);
+			writejs1Darray(fid,[modelname '.inversion.vel_obs'],self.vel_obs);
+			writejs1Darray(fid,[modelname '.inversion.thickness_obs'],self.thickness_obs);
+			writejs1Darray(fid,[modelname '.inversion.surface_obs'],self.surface_obs);
+
+		end % }}}
 	end
 end

Modified: issm/trunk/src/m/classes/m1qn3inversion.py
===================================================================
--- issm/trunk/src/m/classes/m1qn3inversion.py	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/classes/m1qn3inversion.py	2016-04-13 04:32:01 UTC (rev 20500)
@@ -144,7 +144,7 @@
 		md = checkfield(md,'fieldname','inversion.iscontrol','values',[0,1])
 		md = checkfield(md,'fieldname','inversion.incomplete_adjoint','values',[0,1])
 		md = checkfield(md,'fieldname','inversion.control_parameters','cell',1,'values',supportedcontrols())
-		md = checkfield(md,'fieldname','inversion.control_scaling_factors','size',[num_controls],'>',0,'NaN',1)
+		md = checkfield(md,'fieldname','inversion.control_scaling_factors','size',[num_controls],'>',0,'NaN',1,'Inf',1)
 		md = checkfield(md,'fieldname','inversion.maxsteps','numel',[1],'>=',0)
 		md = checkfield(md,'fieldname','inversion.maxiter','numel',[1],'>=',0)
 		md = checkfield(md,'fieldname','inversion.dxmin','numel',[1],'>',0.)
@@ -155,10 +155,10 @@
 		md = checkfield(md,'fieldname','inversion.max_parameters','size',[md.mesh.numberofvertices,num_controls])
 
 		if solution==BalancethicknessSolutionEnum():
-			md = checkfield(md,'fieldname','inversion.thickness_obs','size',[md.mesh.numberofvertices],'NaN',1)
+			md = checkfield(md,'fieldname','inversion.thickness_obs','size',[md.mesh.numberofvertices],'NaN',1,'Inf',1)
 		else:
-			md = checkfield(md,'fieldname','inversion.vx_obs','size',[md.mesh.numberofvertices],'NaN',1)
-			md = checkfield(md,'fieldname','inversion.vy_obs','size',[md.mesh.numberofvertices],'NaN',1)
+			md = checkfield(md,'fieldname','inversion.vx_obs','size',[md.mesh.numberofvertices],'NaN',1,'Inf',1)
+			md = checkfield(md,'fieldname','inversion.vy_obs','size',[md.mesh.numberofvertices],'NaN',1,'Inf',1)
 
 		return md
 	# }}}

Modified: issm/trunk/src/m/classes/mask.m
===================================================================
--- issm/trunk/src/m/classes/mask.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/classes/mask.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -1,80 +1,72 @@
-%MASK class definition
-%
-%   Usage:
-%      mask=mask();
-
-classdef mask
-	properties (SetAccess=public) 
-		groundedice_levelset = NaN;
-		ice_levelset         = NaN;
-	end
-	methods (Static)
-		function self = loadobj(self) % {{{
-			% This function is directly called by matlab when a model object is
-			% loaded. Update old properties here
-
-			%2014 February 5th
-			if numel(self.ice_levelset)>1 & all(self.ice_levelset>=0),
-				disp('WARNING: md.mask.ice_levelset>=0, you probably need to change the sign of this levelset');
-			end
-
-		end% }}}
-	end
-	methods
-		function createxml(self,fid) % {{{
-			fprintf(fid, '\n\n');
-			fprintf(fid, '%s\n', '<!-- mask -->');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="groundedice_levelset" type="',class(self.groundedice_levelset),'" default="',self.groundedice_levelset,'">','     <section name="mask" />','     <help> is ice grounded ? grounded ice if > 0, grounding line position if = 0, floating ice if &lt; 0 </help>','</parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n','<parameter key ="ice_levelset" type="',class(self.ice_levelset),'" default="',self.ice_levelset,'">','     <section name="mask" />','     <help> presence of ice if > 0, icefront position if = 0, no ice if &lt; 0 </help>','</parameter>');
-		end % }}}
-		function self = extrude(self,md) % {{{
-			self.groundedice_levelset=project3d(md,'vector',self.groundedice_levelset,'type','node');
-			self.ice_levelset=project3d(md,'vector',self.ice_levelset,'type','node');
-		end % }}}
-		function self = mask(varargin) % {{{
-			switch nargin
-				case 0
-					self=setdefaultparameters(self);
-				otherwise
-					error('constructor not supported');
-			end
-		end % }}}
-		function self = setdefaultparameters(self) % {{{
-
-		end % }}}
-		function md = checkconsistency(self,md,solution,analyses) % {{{
-
-			md = checkfield(md,'fieldname','mask.groundedice_levelset','size',[md.mesh.numberofvertices 1]);
-			md = checkfield(md,'fieldname','mask.ice_levelset'        ,'size',[md.mesh.numberofvertices 1]);
-			isice=(md.mask.ice_levelset<=0);
-			if sum(isice)==0,
-				warning('no ice present in the domain');
-			end
-			if max(md.mask.ice_levelset)<0,
-				warning('no ice front provided');
-			end
-			icefront=sum(md.mask.ice_levelset(md.mesh.elements)==0,2);
-			if (max(icefront)==3 & strcmp(elementtype(md.mesh),'Tria')) | (max(icefront==6) & strcmp(elementtype(md.mesh),'Penta')),
-				error('At least one element has all nodes on ice front, change md.mask.ice_levelset to fix it')
-			end
-		end % }}}
-		function disp(self) % {{{
-			disp(sprintf('   masks:'));
-
-			fielddisplay(self,'groundedice_levelset','is ice grounded ? grounded ice if > 0, grounding line position if = 0, floating ice if < 0');
-			fielddisplay(self,'ice_levelset','presence of ice if < 0, icefront position if = 0, no ice if > 0');
-		end % }}}
-		function marshall(self,md,fid) % {{{
-			WriteData(fid,'object',self,'fieldname','groundedice_levelset','format','DoubleMat','mattype',1);
-			WriteData(fid,'object',self,'fieldname','ice_levelset','format','DoubleMat','mattype',1);
-
-			% get mask of vertices of elements with ice
-			isice=md.mask.ice_levelset<=0.;
-			vlist = zeros(md.mesh.numberofvertices,1);
-			pos=find(sum(isice(md.mesh.elements),2)>0);
-			vlist(md.mesh.elements(pos,:))=1;
-			WriteData(fid,'data',vlist,'enum',IceMaskNodeActivationEnum(),'format','DoubleMat','mattype',1);
-
-		end % }}}
-	end
-end
+%MASK class definition
+%
+%   Usage:
+%      mask=mask();
+
+classdef mask
+	properties (SetAccess=public) 
+		groundedice_levelset = NaN;
+		ice_levelset         = NaN;
+	end
+	methods (Static)
+		function self = loadobj(self) % {{{
+			% This function is directly called by matlab when a model object is
+			% loaded. Update old properties here
+
+			%2014 February 5th
+			if numel(self.ice_levelset)>1 & all(self.ice_levelset>=0),
+				disp('WARNING: md.mask.ice_levelset>=0, you probably need to change the sign of this levelset');
+			end
+
+		end% }}}
+	end
+	methods
+		function self = extrude(self,md) % {{{
+			self.groundedice_levelset=project3d(md,'vector',self.groundedice_levelset,'type','node');
+			self.ice_levelset=project3d(md,'vector',self.ice_levelset,'type','node');
+		end % }}}
+		function self = mask(varargin) % {{{
+			switch nargin
+				case 0
+					self=setdefaultparameters(self);
+				otherwise
+					error('constructor not supported');
+			end
+		end % }}}
+		function self = setdefaultparameters(self) % {{{
+
+		end % }}}
+		function md = checkconsistency(self,md,solution,analyses) % {{{
+
+			md = checkfield(md,'fieldname','mask.groundedice_levelset','size',[md.mesh.numberofvertices 1]);
+			md = checkfield(md,'fieldname','mask.ice_levelset','forcing',1);
+			isice=(md.mask.ice_levelset<=0);
+			if sum(isice)==0,
+				warning('no ice present in the domain');
+			end
+			if max(md.mask.ice_levelset)<0,
+				disp('WARNING: no ice front provided');
+			end
+			icefront=sum(md.mask.ice_levelset(md.mesh.elements)==0,2);
+			if (max(icefront)==3 & strcmp(elementtype(md.mesh),'Tria')) | (max(icefront==6) & strcmp(elementtype(md.mesh),'Penta')),
+				error('At least one element has all nodes on ice front, change md.mask.ice_levelset to fix it')
+			end
+		end % }}}
+		function disp(self) % {{{
+			disp(sprintf('   masks:'));
+
+			fielddisplay(self,'groundedice_levelset','is ice grounded ? grounded ice if > 0, grounding line position if = 0, floating ice if < 0');
+			fielddisplay(self,'ice_levelset','presence of ice if < 0, icefront position if = 0, no ice if > 0');
+		end % }}}
+		function marshall(self,md,fid) % {{{
+			WriteData(fid,'object',self,'fieldname','groundedice_levelset','format','DoubleMat','mattype',1);
+			WriteData(fid,'object',self,'fieldname','ice_levelset','format','DoubleMat','mattype',1,'NaN',1);
+		end % }}}
+		function savemodeljs(self,fid,modelname) % {{{
+		
+			writejs1Darray(fid,[modelname '.mask.groundedice_levelset'],self.groundedice_levelset);
+			writejs1Darray(fid,[modelname '.mask.ice_levelset'],self.ice_levelset);
+
+		end % }}}
+	end
+end

Modified: issm/trunk/src/m/classes/mask.py
===================================================================
--- issm/trunk/src/m/classes/mask.py	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/classes/mask.py	2016-04-13 04:32:01 UTC (rev 20500)
@@ -4,6 +4,7 @@
 from EnumDefinitions import *
 from checkfield import checkfield
 from WriteData import WriteData
+import MatlabFuncs as m
 
 class mask(object):
 	"""
@@ -52,11 +53,4 @@
 	def marshall(self,md,fid):    # {{{
 		WriteData(fid,'object',self,'fieldname','groundedice_levelset','format','DoubleMat','mattype',1)
 		WriteData(fid,'object',self,'fieldname','ice_levelset','format','DoubleMat','mattype',1)
-
-		# get mask of vertices of elements with ice
-		isice=numpy.array(md.mask.ice_levelset<0.,int)
-		vlist = numpy.zeros((md.mesh.numberofvertices,1), dtype=int)
-		pos=numpy.nonzero(numpy.sum(isice[md.mesh.elements-1],axis=1))[0]
-		vlist[md.mesh.elements[pos,:]-1]=1
-		WriteData(fid,'data',vlist,'enum',IceMaskNodeActivationEnum(),'format','DoubleMat','mattype',1);
 	# }}}

Modified: issm/trunk/src/m/classes/masscon.m
===================================================================
--- issm/trunk/src/m/classes/masscon.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/classes/masscon.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -42,7 +42,7 @@
 			
 			md = checkfield(md,'fieldname','self.definitionenum','field',self.definitionenum,'values',[Outputdefinition1Enum:Outputdefinition100Enum]);
 
-			md = checkfield(md,'fieldname','self.levelset','field',self.levelset,'timeseries',1,'NaN',1);
+			md = checkfield(md,'fieldname','self.levelset','field',self.levelset,'timeseries',1,'NaN',1,'Inf',1);
 
 		end % }}}
 		function md = disp(self) % {{{

Modified: issm/trunk/src/m/classes/massconaxpby.m
===================================================================
--- issm/trunk/src/m/classes/massconaxpby.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/classes/massconaxpby.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -52,8 +52,8 @@
 			
 			md = checkfield(md,'fieldname','self.definitionenum','field',self.definitionenum,'values',[Outputdefinition1Enum:Outputdefinition100Enum]);
 
-			md = checkfield(md,'fieldname','self.alpha','field',self.alpha,'NaN',1,'size',[1 1]);
-			md = checkfield(md,'fieldname','self.betaa','field',self.beta,'NaN',1,'size',[1 1]);
+			md = checkfield(md,'fieldname','self.alpha','field',self.alpha,'NaN',1,'Inf',1,'size',[1 1]);
+			md = checkfield(md,'fieldname','self.betaa','field',self.beta,'NaN',1,'Inf',1,'size',[1 1]);
 
 		end % }}}
 		function md = disp(self) % {{{

Modified: issm/trunk/src/m/classes/masstransport.m
===================================================================
--- issm/trunk/src/m/classes/masstransport.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/classes/masstransport.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -88,7 +88,7 @@
 			%Early return
 			if ~ismember(MasstransportAnalysisEnum(),analyses) |  (solution==TransientSolutionEnum() & md.transient.ismasstransport==0), return; end
 
-			md = checkfield(md,'fieldname','masstransport.spcthickness','timeseries',1);
+			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]);
@@ -131,5 +131,17 @@
 			end
 			WriteData(fid,'data',outputs,'enum',MasstransportRequestedOutputsEnum,'format','StringArray');
 		end % }}}
+		function savemodeljs(self,fid,modelname) % {{{
+		
+			writejs1Darray(fid,[modelname '.masstransport.spcthickness'],self.spcthickness);
+			writejsdouble(fid,[modelname '.masstransport.isfreesurface'],self.isfreesurface);
+			writejsdouble(fid,[modelname '.masstransport.min_thickness'],self.min_thickness);
+			writejsstring(fid,[modelname '.masstransport.hydrostatic_adjustment'],self.hydrostatic_adjustment);
+			writejsdouble(fid,[modelname '.masstransport.stabilization'],self.stabilization);
+			writejs2Darray(fid,[modelname '.masstransport.vertex_pairing'],self.vertex_pairing);
+			writejsdouble(fid,[modelname '.masstransport.penalty_factor'],self.penalty_factor);
+			writejscellstring(fid,[modelname '.masstransport.requested_outputs'],self.requested_outputs);
+
+		end % }}}
 	end
 end

Modified: issm/trunk/src/m/classes/masstransport.py
===================================================================
--- issm/trunk/src/m/classes/masstransport.py	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/classes/masstransport.py	2016-04-13 04:32:01 UTC (rev 20500)
@@ -71,7 +71,7 @@
 		if (MasstransportAnalysisEnum() not in analyses) or (solution==TransientSolutionEnum() and not md.transient.ismasstransport):
 			return md
 
-		md = checkfield(md,'fieldname','masstransport.spcthickness','timeseries',1)
+		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])

Modified: issm/trunk/src/m/classes/matdamageice.m
===================================================================
--- issm/trunk/src/m/classes/matdamageice.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/classes/matdamageice.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -27,42 +27,11 @@
 		mantle_shear_modulus       = 0.;
 		mantle_density             = 0.;
 
+		%slr
+		earth_density              = 0;
+
 	end
 	methods
-		function createxml(self,fid) % {{{
-			fprintf(fid, '\n\n');
-			fprintf(fid, '<!-- materials -->\n');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="rho_ice" type="',class(self.rho_ice),'" default="',convert2str(self.rho_ice),'">','     <section name="materials" />','     <help> ice density [kg/m^3] </help>','</parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="rho_water" type="',class(self.rho_water),'" default="',convert2str(self.rho_water),'">','     <section name="materials" />','     <help> ocean water density [kg/m^3] </help>','</parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="rho_freshwater" type="',class(self.rho_freshwater),'" default="',convert2str(self.rho_freshwater),'">','     <section name="materials" />','     <help> fresh water density [kg/m^3] </help>','</parameter>');
-
-
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="mu_water" type="',class(self.mu_water),'" default="',convert2str(self.mu_water),'">','     <section name="materials" />','     <help> water viscosity [N s/m^2] </help>','</parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="heatcapacity" type="',class(self.heatcapacity),'" default="',convert2str(self.heatcapacity),'">','     <section name="materials" />','     <help> heat capacity [J/kg/K] </help>','</parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="latentheat" type="',class(self.latentheat),'" default="',convert2str(self.latentheat),'">','     <section name="materials" />','     <help> latent heat of fusion [J/kg] </help>','</parameter>');
-
-
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="thermalconductivity" type="',class(self.thermalconductivity),'" default="',convert2str(self.thermalconductivity),'">','     <section name="materials" />','     <help> ice thermal conductivity [W/m/K] </help>','</parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="temperateiceconductivity" type="',class(self.temperateiceconductivity),'" default="',convert2str(self.temperateiceconductivity),'">','     <section name="materials" />','     <help> temperate ice thermal conductivity [W/m/K] </help>','</parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="meltingpoint" type="',class(self.meltingpoint),'" default="',convert2str(self.meltingpoint),'">','     <section name="materials" />','     <help> melting point of ice at 1atm in K </help>','</parameter>');
-
-
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="beta" type="',class(self.beta),'" default="',convert2str(self.beta),'">','     <section name="materials" />','     <help> rate of change of melting point with pressure [K/Pa] </help>','</parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="mixed_layer_capacity" type="',class(self.mixed_layer_capacity),'" default="',convert2str(self.mixed_layer_capacity),'">','     <section name="materials" />','     <help> mixed layer capacity [W/kg/K] </help>','</parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="thermal_exchange_velocity" type="',class(self.thermal_exchange_velocity),'" default="',convert2str(self.thermal_exchange_velocity),'">','     <section name="materials" />','     <help> thermal exchange velocity [m/s] </help>','</parameter>');
-
-
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="rheology_B" type="',class(self.rheology_B),'" default="',convert2str(self.rheology_B),'">','     <section name="materials" />','     <help> flow law parameter [Pa/s^(1/n)] </help>','</parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="rheology_n" type="',class(self.rheology_n),'" default="',convert2str(self.rheology_n),'">','     <section name="materials" />','     <help> Glens flow law exponent </help>','</parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="rheology_law" type="',class(self.rheology_law),'" default="',convert2str(self.rheology_law),'">','     <section name="materials" />','     <help> law for the temperature dependance of the rheology: "None", "Paterson",  "Arrhenius" or "LliboutryDuval" </help>','</parameter>');
-
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="lithosphere_shear_modulus" type="',class(self.lithosphere_shear_modulus),'" default="',convert2str(self.lithosphere_shear_modulus),'">','     <section name="materials" />','     <help> Lithosphere shear modulus [Pa] </help>','</parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="lithosphere_density" type="',class(self.lithosphere_density),'" default="',convert2str(self.lithosphere_density),'">','     <section name="materials" />','     <help> Lithosphere density [g/cm^-3] </help>','</parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="mantle_shear_modulus" type="',class(self.mantle_shear_modulus),'" default="',convert2str(self.mantle_shear_modulus),'">','     <section name="materials" />','     <help> Mantle shear modulus [Pa] </help>','</parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="mantle_density" type="',class(self.mantle_density),'" default="',convert2str(self.mantle_density),'">','     <section name="materials" />','     <help> Mantle density [g/cm^-3] </help>','</parameter>');
-
-
-		end % }}}
 		function self = 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');
@@ -133,6 +102,9 @@
 			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)
+
 		end % }}}
 		function md = checkconsistency(self,md,solution,analyses) % {{{
 			md = checkfield(md,'fieldname','materials.rho_ice','>',0);
@@ -149,7 +121,11 @@
 				md = checkfield(md,'fieldname','materials.mantle_shear_modulus','>',0,'numel',1);
 				md = checkfield(md,'fieldname','materials.mantle_density','>',0,'numel',1);
 			end
+			if ismember(SealevelriseAnalysisEnum(),analyses),
+				md = checkfield(md,'fieldname','materials.earth_density','>',0,'numel',1);
+			end
 
+
 		end % }}}
 		function disp(self) % {{{
 			disp(sprintf('   Materials:'));
@@ -173,6 +149,7 @@
 			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 % }}}
 		function marshall(self,md,fid) % {{{
 			WriteData(fid,'enum',MaterialsEnum(),'data',MatdamageiceEnum(),'format','Integer');
@@ -196,6 +173,8 @@
 			WriteData(fid,'object',self,'class','materials','fieldname','lithosphere_density','format','Double','scale',10^3);
 			WriteData(fid,'object',self,'class','materials','fieldname','mantle_shear_modulus','format','Double');
 			WriteData(fid,'object',self,'class','materials','fieldname','mantle_density','format','Double','scale',10^3);
+			WriteData(fid,'object',self,'class','materials','fieldname','earth_density','format','Double');
+
 		end % }}}
 	end
 end

Modified: issm/trunk/src/m/classes/matdamageice.py
===================================================================
--- issm/trunk/src/m/classes/matdamageice.py	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/classes/matdamageice.py	2016-04-13 04:32:01 UTC (rev 20500)
@@ -35,7 +35,11 @@
 		self.lithosphere_density        = 0.
 		self.mantle_shear_modulus       = 0.
 		self.mantle_density             = 0.
+		
+		#SLR
+		self.earth_density= 5512;  # average density of the Earth, (kg/m^3)
 
+
 		self.setdefaultparameters()
 		#}}}
 	def __repr__(self): # {{{
@@ -60,7 +64,9 @@
 		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]"))
 
+
 		return string
 		#}}}
 	def extrude(self,md): # {{{
@@ -114,7 +120,11 @@
 		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)
 
+
 		return self
 		#}}}
 	def checkconsistency(self,md,solution,analyses):    # {{{
@@ -129,6 +139,8 @@
 		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]);
+
 		return md
 	# }}}
 	def marshall(self,md,fid):    # {{{
@@ -153,4 +165,6 @@
 		WriteData(fid,'object',self,'class','materials','fieldname','lithosphere_density','format','Double','scale',10.**3.);
 		WriteData(fid,'object',self,'class','materials','fieldname','mantle_shear_modulus','format','Double');
 		WriteData(fid,'object',self,'class','materials','fieldname','mantle_density','format','Double','scale',10.**3.);
+		WriteData(fid,'object',self,'class','materials','fieldname','earth_density','format','Double');
+
 	# }}}

Modified: issm/trunk/src/m/classes/matice.m
===================================================================
--- issm/trunk/src/m/classes/matice.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/classes/matice.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -27,49 +27,11 @@
 		mantle_shear_modulus       = 0.;
 		mantle_density             = 0.;
 
+		%slr
+		earth_density              = 0;
+
 	end
 	methods
-		function createxml(self,fid) % {{{
-			fprintf(fid, '\n\n');
-			fprintf(fid, '<!-- materials -->\n');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="rho_ice" type="',class(self.rho_ice),'" default="',convert2str(self.rho_ice),'">','     <section name="materials" />','     <help> ice density [kg/m^3] </help>','</parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="rho_water" type="',class(self.rho_water),'" default="',convert2str(self.rho_water),'">','     <section name="materials" />','     <help> ocean water density [kg/m^3] </help>','</parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="rho_freshwater" type="',class(self.rho_freshwater),'" default="',convert2str(self.rho_freshwater),'">','     <section name="materials" />','     <help> fresh water density [kg/m^3] </help>','</parameter>');
-
-
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="mu_water" type="',class(self.mu_water),'" default="',convert2str(self.mu_water),'">','     <section name="materials" />','     <help> water viscosity [N s/m^2] </help>','</parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="heatcapacity" type="',class(self.heatcapacity),'" default="',convert2str(self.heatcapacity),'">','     <section name="materials" />','     <help> heat capacity [J/kg/K] </help>','</parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="latentheat" type="',class(self.latentheat),'" default="',convert2str(self.latentheat),'">','     <section name="materials" />','     <help> latent heat of fusion [J/kg] </help>','</parameter>');
-
-
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="thermalconductivity" type="',class(self.thermalconductivity),'" default="',convert2str(self.thermalconductivity),'">','     <section name="materials" />','     <help> ice thermal conductivity [W/m/K] </help>','</parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="temperateiceconductivity" type="',class(self.temperateiceconductivity),'" default="',convert2str(self.temperateiceconductivity),'">','     <section name="materials" />','     <help> temperate ice thermal conductivity [W/m/K] </help>','</parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="meltingpoint" type="',class(self.meltingpoint),'" default="',convert2str(self.meltingpoint),'">','     <section name="materials" />','     <help> melting point of ice at 1atm in K </help>','</parameter>');
-
-
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="beta" type="',class(self.beta),'" default="',convert2str(self.beta),'">','     <section name="materials" />','     <help> rate of change of melting point with pressure [K/Pa] </help>','</parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="mixed_layer_capacity" type="',class(self.mixed_layer_capacity),'" default="',convert2str(self.mixed_layer_capacity),'">','     <section name="materials" />','     <help> mixed layer capacity [W/kg/K] </help>','</parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="thermal_exchange_velocity" type="',class(self.thermal_exchange_velocity),'" default="',convert2str(self.thermal_exchange_velocity),'">','     <section name="materials" />','     <help> thermal exchange velocity [m/s] </help>','</parameter>');
-
-
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="rheology_B" type="',class(self.rheology_B),'" default="',convert2str(self.rheology_B),'">','     <section name="materials" />','     <help> flow law parameter [Pa/s^(1/n)] </help>','</parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="rheology_n" type="',class(self.rheology_n),'" default="',convert2str(self.rheology_n),'">','     <section name="materials" />','     <help> Glens flow law exponent </help>','</parameter>');
-
-			% rheology_law drop-down
-			fprintf(fid,'%s\n%s\n%s\n%s\n','<parameter key ="rheology_law" type="alternative" optional="false">','     <section name="materials" />','     <help> law for the temperature dependance of the rheology: "None", "Paterson",  "Arrhenius" or "LliboutryDuval" </help>');
-			fprintf(fid,'%s\n','       <option value="None" type="string" default="true"> </option>');
-			fprintf(fid,'%s\n','       <option value="Paterson" type="string" default="false"> </option>');
-			fprintf(fid,'%s\n','       <option value="Arrhenius" type="string" default="false"> </option>');
-			fprintf(fid,'%s\n%s\n','       <option value="LliboutryDuval" type="string" default="false"> </option>','</parameter>');
-
-
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="lithosphere_shear_modulus" type="',class(self.lithosphere_shear_modulus),'" default="',convert2str(self.lithosphere_shear_modulus),'">','     <section name="materials" />','     <help> Lithosphere shear modulus [Pa] </help>','</parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="lithosphere_density" type="',class(self.lithosphere_density),'" default="',convert2str(self.lithosphere_density),'">','     <section name="materials" />','     <help> Lithosphere density [g/cm^-3] </help>','</parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="mantle_shear_modulus" type="',class(self.mantle_shear_modulus),'" default="',convert2str(self.mantle_shear_modulus),'">','     <section name="materials" />','     <help> Mantle shear modulus [Pa] </help>','</parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="mantle_density" type="',class(self.mantle_density),'" default="',convert2str(self.mantle_density),'">','     <section name="materials" />','     <help> Mantle density [g/cm^-3] </help>','</parameter>');
-
-
-		end % }}}
 		function self = 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');
@@ -140,13 +102,16 @@
 			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)
+
 		end % }}}
 		function md = checkconsistency(self,md,solution,analyses) % {{{
 			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);
+			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' 'Cuffey' 'Paterson' 'Arrhenius' 'LliboutryDuval'});
 
@@ -156,6 +121,9 @@
 				md = checkfield(md,'fieldname','materials.mantle_shear_modulus','>',0,'numel',1);
 				md = checkfield(md,'fieldname','materials.mantle_density','>',0,'numel',1);
 			end
+			if ismember(SealevelriseAnalysisEnum(),analyses),
+				md = checkfield(md,'fieldname','materials.earth_density','>',0,'numel',1);
+			end
 
 		end % }}}
 		function disp(self) % {{{
@@ -180,6 +148,7 @@
 			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 % }}}
 		function marshall(self,md,fid) % {{{
 			WriteData(fid,'enum',MaterialsEnum(),'data',MaticeEnum(),'format','Integer');
@@ -203,6 +172,32 @@
 			WriteData(fid,'object',self,'class','materials','fieldname','lithosphere_density','format','Double','scale',10^3);
 			WriteData(fid,'object',self,'class','materials','fieldname','mantle_shear_modulus','format','Double');
 			WriteData(fid,'object',self,'class','materials','fieldname','mantle_density','format','Double','scale',10^3);
+			WriteData(fid,'object',self,'class','materials','fieldname','earth_density','format','Double');
 		end % }}}
+		function savemodeljs(self,fid,modelname) % {{{
+		
+			writejsdouble(fid,[modelname '.materials.rho_ice'],self.rho_ice);
+			writejsdouble(fid,[modelname '.materials.rho_water'],self.rho_water);
+			writejsdouble(fid,[modelname '.materials.rho_freshwater'],self.rho_freshwater);
+			writejsdouble(fid,[modelname '.materials.mu_water'],self.mu_water);
+			writejsdouble(fid,[modelname '.materials.heatcapacity'],self.heatcapacity);
+			writejsdouble(fid,[modelname '.materials.latentheat'],self.latentheat);
+			writejsdouble(fid,[modelname '.materials.thermalconductivity'],self.thermalconductivity);
+			writejsdouble(fid,[modelname '.materials.temperateiceconductivity'],self.temperateiceconductivity);
+			writejsdouble(fid,[modelname '.materials.meltingpoint'],self.meltingpoint);
+			writejsdouble(fid,[modelname '.materials.beta'],self.beta);
+			writejsdouble(fid,[modelname '.materials.mixed_layer_capacity'],self.mixed_layer_capacity);
+			writejsdouble(fid,[modelname '.materials.thermal_exchange_velocity'],self.thermal_exchange_velocity);
+			writejsdouble(fid,[modelname '.materials.mixed_layer_capacity'],self.mixed_layer_capacity);
+			writejs1Darray(fid,[modelname '.materials.rheology_B'],self.rheology_B);
+			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);
+
+		end % }}}
 	end
 end

Modified: issm/trunk/src/m/classes/matice.py
===================================================================
--- issm/trunk/src/m/classes/matice.py	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/classes/matice.py	2016-04-13 04:32:01 UTC (rev 20500)
@@ -34,8 +34,13 @@
 		self.lithosphere_shear_modulus  = 0.
 		self.lithosphere_density        = 0.
 		self.mantle_shear_modulus       = 0.
-		self.mantle_density             = 0.
+		self.mantle_density             = 0.  
+		
+		#SLR
+		self.earth_density= 5512;  
 
+
+
 		self.setdefaultparameters()
 		#}}}
 	def __repr__(self): # {{{
@@ -60,7 +65,9 @@
 		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]"))
 
+
 		return string
 		#}}}
 	def extrude(self,md): # {{{
@@ -114,7 +121,11 @@
 		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)
 
+
 		return self
 		#}}}
 	def checkconsistency(self,md,solution,analyses):    # {{{
@@ -122,13 +133,15 @@
 		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)
+		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])
 		md = checkfield(md,'fieldname','materials.rheology_law','values',['None','Cuffey','Paterson','Arrhenius','LliboutryDuval'])
 		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]);
+
 		return md
 	# }}}
 	def marshall(self,md,fid):    # {{{
@@ -154,4 +167,6 @@
 		WriteData(fid,'object',self,'class','materials','fieldname','lithosphere_density','format','Double','scale',10.**3.);
 		WriteData(fid,'object',self,'class','materials','fieldname','mantle_shear_modulus','format','Double');
 		WriteData(fid,'object',self,'class','materials','fieldname','mantle_density','format','Double','scale',10.**3.);
+		WriteData(fid,'object',self,'class','materials','fieldname','earth_density','format','Double');
+
 	# }}}

Modified: issm/trunk/src/m/classes/mesh2d.m
===================================================================
--- issm/trunk/src/m/classes/mesh2d.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/classes/mesh2d.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -80,9 +80,9 @@
 		end % }}}
 		function md = checkconsistency(self,md,solution,analyses) % {{{
 
-			md = checkfield(md,'fieldname','mesh.x','NaN',1,'size',[md.mesh.numberofvertices 1]);
-			md = checkfield(md,'fieldname','mesh.y','NaN',1,'size',[md.mesh.numberofvertices 1]);
-			md = checkfield(md,'fieldname','mesh.elements','NaN',1,'>',0,'values',1:md.mesh.numberofvertices);
+			md = checkfield(md,'fieldname','mesh.x','NaN',1,'Inf',1,'size',[md.mesh.numberofvertices 1]);
+			md = checkfield(md,'fieldname','mesh.y','NaN',1,'Inf',1,'size',[md.mesh.numberofvertices 1]);
+			md = checkfield(md,'fieldname','mesh.elements','NaN',1,'Inf',1,'>',0,'values',1:md.mesh.numberofvertices);
 			md = checkfield(md,'fieldname','mesh.elements','size',[md.mesh.numberofelements 3]);
 			if any(~ismember(1:md.mesh.numberofvertices,sort(unique(md.mesh.elements(:)))));
 				md = checkmessage(md,'orphan nodes have been found. Check the mesh outline');
@@ -90,6 +90,7 @@
 			md = checkfield(md,'fieldname','mesh.numberofelements','>',0);
 			md = checkfield(md,'fieldname','mesh.numberofvertices','>',0);
 			md = checkfield(md,'fieldname','mesh.average_vertex_connectivity','>=',9,'message','''mesh.average_vertex_connectivity'' should be at least 9 in 2d');
+			md = checkfield(md,'fieldname','mesh.segments','NaN',1,'Inf',1,'>',0,'size',[NaN 3]);
 
 			switch(solution),
 				case ThermalSolutionEnum(),
@@ -125,48 +126,6 @@
 			fielddisplay(self,'long','vertices longitude [degrees]');
 			fielddisplay(self,'epsg','EPSG code (ex: 3413 for UPS Greenland, 3031 for UPS Antarctica)');
 		end % }}}
-		function createxml(self,fid) % {{{
-			fprintf(fid, '<!-- 2D tria Mesh (horizontal) -->\n');
-
-			%elements and vertices
-			fprintf(fid,'%s\n%s\n%s\n','<frame key="1" label="Elements and vertices">','<section name="mesh" />');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n','  <parameter key ="numberofelements" type="',class(self.numberofelements),'" default="',convert2str(self.numberofelements),'">','     <section name="mesh" />','     <help> number of elements </help>','  </parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n','  <parameter key ="numberofvertices" type="',class(self.numberofvertices),'" default="',convert2str(self.numberofvertices),'">','     <section name="mesh" />','     <help> number of vertices </help>','  </parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n','  <parameter key ="elements" type="',class(self.elements),'" default="',convert2str(self.elements),'">','     <section name="mesh" />','     <help> vertex indices of the mesh elements </help>','  </parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="x" type="',class(self.x),'" default="',convert2str(self.x),'">','     <section name="mesh" />','     <help> vertices x coordinate [m] </help>','  </parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="y" type="',class(self.y),'" default="',convert2str(self.y),'">','     <section name="mesh" />','     <help> vertices y coordinate [m] </help>','  </parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="edges" type="',class(self.edges),'" default="',convert2str(self.edges),'">','     <section name="mesh" />','     <help> edges of the 2d mesh (vertex1 vertex2 element1 element2) </help>','  </parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="numberofedges" type="',class(self.numberofedges),'" default="',convert2str(self.numberofedges),'">','     <section name="mesh" />','     <help> number of edges of the 2d mesh </help>','  </parameter>');
-			fprintf(fid,'%s\n%s\n','</frame>');
-
-			% properties
-			fprintf(fid,'%s\n%s\n%s\n','<frame key="2" label="Properties">','<section name="mesh" />');             
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="vertexonboundary" type="',class(self.vertexonboundary),'" default="',convert2str(self.vertexonboundary),'">','     <section name="mesh" />','     <help> vertices on the boundary of the domain flag list </help>','  </parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="segments" type="',class(self.segments),'" default="',convert2str(self.segments),'">','     <section name="mesh" />','     <help> edges on domain boundary (vertex1 vertex2 element) </help>','  </parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="segmentmarkers" type="',class(self.segmentmarkers),'" default="',convert2str(self.segmentmarkers),'">','     <section name="mesh" />','     <help> number associated to each segment </help>','  </parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="vertexconnectivity" type="',class(self.vertexconnectivity),'" default="',convert2str(self.vertexconnectivity),'">','     <section name="mesh" />','     <help> list of vertices connected to vertex_i </help>','  </parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="elementconnectivity" type="',class(self.elementconnectivity),'" default="',convert2str(self.elementconnectivity),'">','     <section name="mesh" />','     <help> list of vertices connected to element_i </help>','  </parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="average_vertex_connectivity" type="',class(self.average_vertex_connectivity),'" default="',convert2str(self.average_vertex_connectivity),'">','     <section name="mesh" />','     <help> average number of vertices connected to one vertex </help>','  </parameter>');
-			fprintf(fid,'%s\n%s\n','</frame>');
-
-			%extracted model
-			fprintf(fid,'%s\n%s\n%s\n','<frame key="3" label="Extracted Model">','<section name="mesh" />'); 
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="extractedvertices" type="',class(self.extractedvertices),'" default="',convert2str(self.extractedvertices),'">','     <section name="mesh" />','     <help> vertices extracted from the model </help>','  </parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="extractedelements" type="',class(self.extractedelements),'" default="',convert2str(self.extractedelements),'">','     <section name="mesh" />','     <help> elements extracted from the model </help>','  </parameter>');
-			fprintf(fid,'%s\n%s\n','</frame>');
-
-			%projection
-			fprintf(fid,'%s\n%s\n%s\n','<frame key="4" label="Projection">','<section name="mesh" />'); 
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="lat" type="',class(self.lat),'" default="',convert2str(self.lat),'">','     <section name="mesh" />','     <help> vertices latitude [degrees] </help>','  </parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="long" type="',class(self.long),'" default="',convert2str(self.long),'">','     <section name="mesh" />','     <help> verticies longitude [degrees] </help>','  </parameter>');
-			% choice (epsg) 'n' or 's'
-			fprintf(fid,'%s\n%s\n%s\n','  <parameter key ="epsg" type="alternative" optional="false">','     <section name="mesh" />','     <help> Indicate epsg ''n'' or ''s'' </help>');
-			fprintf(fid,'%s\n','       <option value="n" type="string" default="true"> </option>');
-			fprintf(fid,'%s\n','       <option value="s" type="string" default="false"> </option>');
-			fprintf(fid,'%s\n','  </parameter>');
-			fprintf(fid,'%s\n%s\n','</frame>');
-
-		end % }}}
 		function marshall(self,md,fid) % {{{
 			WriteData(fid,'enum',DomainTypeEnum(),'data',StringToEnum(['Domain' domaintype(self)]),'format','Integer');
 			WriteData(fid,'enum',DomainDimensionEnum(),'data',dimension(self),'format','Integer');
@@ -179,6 +138,7 @@
 			WriteData(fid,'object',self,'class','mesh','fieldname','numberofvertices','format','Integer');
 			WriteData(fid,'object',self,'class','mesh','fieldname','average_vertex_connectivity','format','Integer');
 			WriteData(fid,'object',self,'class','mesh','fieldname','vertexonboundary','format','DoubleMat','mattype',1);
+			WriteData(fid,'object',self,'class','mesh','fieldname','segments','format','DoubleMat','mattype',3);
 		end % }}}
 		function t = domaintype(self) % {{{
 			t = '2Dhorizontal';
@@ -189,5 +149,27 @@
 		function s = elementtype(self) % {{{
 			s = 'Tria';
 		end % }}}
+		function savemodeljs(self,fid,modelname) % {{{
+		
+			writejs1Darray(fid,[modelname '.mesh.x'],self.x);
+			writejs1Darray(fid,[modelname '.mesh.y'],self.y);
+			writejs2Darray(fid,[modelname '.mesh.elements'],self.elements);
+			writejsdouble(fid,[modelname '.mesh.numberofelements'],self.numberofelements);
+			writejsdouble(fid,[modelname '.mesh.numberofvertices'],self.numberofvertices);
+			writejsdouble(fid,[modelname '.mesh.numberofedges'],self.numberofedges);
+			writejs1Darray(fid,[modelname '.mesh.lat'],self.lat);
+			writejs1Darray(fid,[modelname '.mesh.long'],self.long);
+			writejsdouble(fid,[modelname '.mesh.epsg'],self.epsg);
+			writejs1Darray(fid,[modelname '.mesh.vertexonboundary'],self.vertexonboundary);
+			writejs2Darray(fid,[modelname '.mesh.edges'],self.edges);
+			writejs2Darray(fid,[modelname '.mesh.segments'],self.segments);
+			writejs2Darray(fid,[modelname '.mesh.segmentmarkers'],self.segmentmarkers);
+			writejs2Darray(fid,[modelname '.mesh.vertexconnectivity'],self.vertexconnectivity);
+			writejs2Darray(fid,[modelname '.mesh.elementconnectivity'],self.elementconnectivity);
+			writejsdouble(fid,[modelname '.mesh.average_vertex_connectivity'],self.average_vertex_connectivity);
+			writejs1Darray(fid,[modelname '.mesh.extractedvertices'],self.extractedvertices);
+			writejs1Darray(fid,[modelname '.mesh.extractedelements'],self.extractedelements);
+
+		end % }}}
 	end
 end

Modified: issm/trunk/src/m/classes/mesh2d.py
===================================================================
--- issm/trunk/src/m/classes/mesh2d.py	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/classes/mesh2d.py	2016-04-13 04:32:01 UTC (rev 20500)
@@ -83,9 +83,9 @@
 	#}}}
 	def checkconsistency(self,md,solution,analyses):    # {{{
 
-		md = checkfield(md,'fieldname','mesh.x','NaN',1,'size',[md.mesh.numberofvertices])
-		md = checkfield(md,'fieldname','mesh.y','NaN',1,'size',[md.mesh.numberofvertices])
-		md = checkfield(md,'fieldname','mesh.elements','NaN',1,'>',0,'values',numpy.arange(1,md.mesh.numberofvertices+1))
+		md = checkfield(md,'fieldname','mesh.x','NaN',1,'Inf',1,'size',[md.mesh.numberofvertices])
+		md = checkfield(md,'fieldname','mesh.y','NaN',1,'Inf',1,'size',[md.mesh.numberofvertices])
+		md = checkfield(md,'fieldname','mesh.elements','NaN',1,'Inf',1,'>',0,'values',numpy.arange(1,md.mesh.numberofvertices+1))
 		md = checkfield(md,'fieldname','mesh.elements','size',[md.mesh.numberofelements,3])
 		if numpy.any(numpy.logical_not(m.ismember(numpy.arange(1,md.mesh.numberofvertices+1),md.mesh.elements))):
 			md.checkmessage("orphan nodes have been found. Check the mesh outline")

Modified: issm/trunk/src/m/classes/mesh2dvertical.m
===================================================================
--- issm/trunk/src/m/classes/mesh2dvertical.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/classes/mesh2dvertical.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -50,39 +50,6 @@
 		end% }}}
 	end
 	methods
-		function createxml(self,fid) % {{{
-			fprintf(fid, '<!-- 2d Mesh (Vertical) -->\n');
-
-			%elements and vertices
-			fprintf(fid,'%s\n%s\n%s\n','       <frame key="1" label="Elements and vertices">','       <section name="mesh" />');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n','          <parameter key ="numberofelements" type="',class(self.numberofelements),'" default="',convert2str(self.numberofelements),'">','              <help> number of elements </help>','          </parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n','          <parameter key ="numberofvertices" type="',class(self.numberofvertices),'" default="',convert2str(self.numberofvertices),'">','              <help> number of vertices </help>','          </parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n','          <parameter key ="elements" type="',class(self.elements),'" default="',convert2str(self.elements),'">','              <help> vertex indices of the mesh elements </help>','          </parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="x" type="',class(self.x),'" default="',convert2str(self.x),'">','     <section name="mesh" />','     <help> vertices x coordinate [m] </help>','  </parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="y" type="',class(self.y),'" default="',convert2str(self.y),'">','     <section name="mesh" />','     <help> vertices y coordinate [m] </help>','  </parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="edges" type="',class(self.edges),'" default="',convert2str(self.edges),'">','     <section name="mesh" />','     <help> edges of the 2d mesh (vertex1 vertex2 element1 element2) </help>','  </parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="numberofedges" type="',class(self.numberofedges),'" default="',convert2str(self.numberofedges),'">','     <section name="mesh" />','     <help> number of edges of the 2d mesh </help>','  </parameter>');
-			fprintf(fid,'%s\n%s\n','       </frame>');
-
-			% properties
-			fprintf(fid,'%s\n%s\n%s\n','<frame key="2" label="Properties">','<section name="mesh" />');             
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="vertexonboundary" type="',class(self.vertexonboundary),'" default="',convert2str(self.vertexonboundary),'">','     <section name="mesh" />','     <help> vertices on the boundary of the domain flag list </help>','  </parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="vertexonbase" type="',class(self.vertexonbase),'" default="',convert2str(self.vertexonbase),'">','     <section name="mesh" />','     <help> vertices on the bed of the domain flag list </help>','  </parameter>');            
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="segments" type="',class(self.segments),'" default="',convert2str(self.segments),'">','     <section name="mesh" />','     <help> edges on domain boundary (vertex1 vertex2 element) </help>','  </parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="segmentmarkers" type="',class(self.segmentmarkers),'" default="',convert2str(self.segmentmarkers),'">','     <section name="mesh" />','     <help> number associated to each segment </help>','  </parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="vertexconnectivity" type="',class(self.vertexconnectivity),'" default="',convert2str(self.vertexconnectivity),'">','     <section name="mesh" />','     <help> list of vertices connected to vertex_i </help>','  </parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="elementconnectivity" type="',class(self.elementconnectivity),'" default="',convert2str(self.elementconnectivity),'">','     <section name="mesh" />','     <help> list of vertices connected to element_i </help>','  </parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="average_vertex_connectivity" type="',class(self.average_vertex_connectivity),'" default="',convert2str(self.average_vertex_connectivity),'">','     <section name="mesh" />','     <help> average number of vertices connected to one vertex </help>','  </parameter>');
-			fprintf(fid,'%s\n%s\n','</frame>');
-
-			%projection
-			fprintf(fid,'%s\n%s\n%s\n','<frame key="3" label="Projection">','<section name="mesh" />'); 
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="lat" type="',class(self.lat),'" default="',convert2str(self.lat),'">','     <section name="mesh" />','     <help> vertices latitude [degrees] </help>','  </parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="long" type="',class(self.long),'" default="',convert2str(self.long),'">','     <section name="mesh" />','     <help> verticies longitude [degrees] </help>','  </parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n','  <parameter key ="epsg" type="',class(self.epsg),'" default="',convert2str(self.epsg),'">','     <section name="mesh" />','     <help> Indicate epsg ''n'' or ''s'' </help>','  </parameter>');
-			fprintf(fid,'%s\n%s\n','</frame>');
-
-		end % }}}
 		function self = mesh2dvertical(varargin) % {{{
 			switch nargin
 				case 0
@@ -112,9 +79,9 @@
 		end % }}}
 		function md = checkconsistency(self,md,solution,analyses) % {{{
 
-			md = checkfield(md,'fieldname','mesh.x','NaN',1,'size',[md.mesh.numberofvertices 1]);
-			md = checkfield(md,'fieldname','mesh.y','NaN',1,'size',[md.mesh.numberofvertices 1]);
-			md = checkfield(md,'fieldname','mesh.elements','NaN',1,'>',0,'values',1:md.mesh.numberofvertices);
+			md = checkfield(md,'fieldname','mesh.x','NaN',1,'Inf',1,'size',[md.mesh.numberofvertices 1]);
+			md = checkfield(md,'fieldname','mesh.y','NaN',1,'Inf',1,'size',[md.mesh.numberofvertices 1]);
+			md = checkfield(md,'fieldname','mesh.elements','NaN',1,'Inf',1,'>',0,'values',1:md.mesh.numberofvertices);
 			md = checkfield(md,'fieldname','mesh.elements','size',[md.mesh.numberofelements 3]);
 			if any(~ismember(1:md.mesh.numberofvertices,sort(unique(md.mesh.elements(:)))));
 				md = checkmessage(md,'orphan nodes have been found. Check the mesh outline');

Modified: issm/trunk/src/m/classes/mesh3dprisms.m
===================================================================
--- issm/trunk/src/m/classes/mesh3dprisms.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/classes/mesh3dprisms.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -61,59 +61,6 @@
 		end% }}}
 	end
 	methods
-		function createxml(self,fid) % {{{
-			fprintf(fid, '<!-- 3D prism Mesh -->\n');
-
-			% Elements and verticies of the original 2d mesh
-			fprintf(fid,'%s\n%s\n%s\n','       <frame key="1" label="Elements and vertices of the orginal 2d mesh">','       <section name="mesh3dprisms" />');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n','          <parameter key ="numberofelements2d" type="',class(self.numberofelements2d),'" default="',convert2str(self.numberofelements2d),'">','              <help> number of elements </help>','          </parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n','          <parameter key ="numberofvertices2d" type="',class(self.numberofvertices2d),'" default="',convert2str(self.numberofvertices2d),'">','              <help> number of vertices </help>','          </parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n','          <parameter key ="elements2d" type="',class(self.elements2d),'" default="',convert2str(self.elements2d),'">','              <help> vertex indices of the mesh elements </help>','          </parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="x2d" type="',class(self.x2d),'" default="',convert2str(self.x2d),'">','     <section name="mesh3dprisms" />','     <help> vertices x coordinate [m] </help>','  </parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="y2d" type="',class(self.y2d),'" default="',convert2str(self.y2d),'">','     <section name="mesh3dprisms" />','     <help> vertices y coordinate [m] </help>','  </parameter>');
-			fprintf(fid,'%s\n%s\n','       </frame>');
-
-			% Elements and vertices of the extruded 3d mesh
-			fprintf(fid,'%s\n%s\n%s\n','       <frame key="2" label="Elements and vertices of the orginal 3d mesh">','       <section name="mesh3dprisms" />');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n','          <parameter key ="numberofelements" type="',class(self.numberofelements),'" default="',convert2str(self.numberofelements),'">','              <help> number of elements </help>','          </parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n','          <parameter key ="numberofvertices" type="',class(self.numberofvertices),'" default="',convert2str(self.numberofvertices),'">','              <help> number of vertices </help>','          </parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n','          <parameter key ="elements" type="',class(self.elements),'" default="',convert2str(self.elements),'">','              <help> vertex indices of the mesh elements </help>','          </parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="x" type="',class(self.x),'" default="',convert2str(self.x),'">','     <section name="mesh3dprisms" />','     <help> vertices x coordinate [m] </help>','  </parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="y" type="',class(self.y),'" default="',convert2str(self.y),'">','     <section name="mesh3dprisms" />','     <help> vertices y coordinate [m] </help>','  </parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="z" type="',class(self.y),'" default="',convert2str(self.y),'">','     <section name="mesh3dprisms" />','     <help> vertices z coordinate [m] </help>','  </parameter>');
-			fprintf(fid,'%s\n%s\n','       </frame>');
-
-			% properties
-			fprintf(fid,'%s\n%s\n%s\n','<frame key="3" label="Properties">','<section name="mesh3dprisms" />');             
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="numberoflayers" type="',class(self.numberoflayers),'" default="',convert2str(self.numberoflayers),'">','     <section name="mesh3dprisms" />','     <help> number of extrusion layers </help>','  </parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="vertexonbase" type="',class(self.vertexonbase),'" default="',convert2str(self.vertexonbase),'">','     <section name="mesh3dprisms" />','     <help> lower vertices flags list </help>','  </parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="elementontbase" type="',class(self.elementontbase),'" default="',convert2str(self.elementontbase),'">','     <section name="mesh3dprisms" />','     <help> lower elements flags list </help>','  </parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="vertexonsurface" type="',class(self.vertexonsurface),'" default="',convert2str(self.vertexonsurface),'">','     <section name="mesh3dprisms" />','     <help> upper vertices flags list </help>','  </parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="elementontsurface" type="',class(self.elementontsurface),'" default="',convert2str(self.elementontsurface),'">','     <section name="mesh3dprisms" />','     <help> upper elements flags list </help>','  </parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="uppervertex" type="',class(self.uppervertex),'" default="',convert2str(self.uppervertex),'">','     <section name="mesh3dprisms" />','     <help> upper vertex list (NaN for vertex on the upper surface) </help>','  </parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="upperelements" type="',class(self.upperelements),'" default="',convert2str(self.upperelements),'">','     <section name="mesh3dprisms" />','     <help> upper element list (NaN for element on the upper layer) </help>','  </parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="lowervertex" type="',class(self.lowervertex),'" default="',convert2str(self.lowervertex),'">','     <section name="mesh3dprisms" />','     <help> lower vertex list (NaN for vertex on the lower surface) </help>','  </parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="lowerelements" type="',class(self.lowerelements),'" default="',convert2str(self.lowerelements),'">','     <section name="mesh3dprisms" />','     <help> element list (NaN for element on the lower layer) </help>','  </parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="vertexonboundary" type="',class(self.vertexonboundary),'" default="',convert2str(self.vertexonboundary),'">','     <section name="mesh3dprisms" />','     <help> vertices on the boundary of the domain flag list </help>','  </parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="vertexconnectivity" type="',class(self.vertexconnectivity),'" default="',convert2str(self.vertexconnectivity),'">','     <section name="mesh3dprisms" />','     <help> list of vertices connected to vertex_i </help>','  </parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="elementconnectivity" type="',class(self.elementconnectivity),'" default="',convert2str(self.elementconnectivity),'">','     <section name="mesh3dprisms" />','     <help> average number of vertices connected to one vertex </help>','  </parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="average_vertex_connectivity" type="',class(self.average_vertex_connectivity),'" default="',convert2str(self.average_vertex_connectivity),'">','     <section name="mesh3dprisms" />','     <help> average number of vertices connected to one vertex </help>','  </parameter>');
-			fprintf(fid,'%s\n%s\n','</frame>');
-
-			% Extracted model
-			fprintf(fid,'%s\n%s\n%s\n','<frame key="4" label="Extracted Model">','<section name="mesh3dprisms" />'); 
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="extractedvertices" type="',class(self.extractedvertices),'" default="',convert2str(self.extractedvertices),'">','     <section name="mesh3dprisms" />','     <help> vertices extracted from the model </help>','  </parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="extractedelements" type="',class(self.extractedelements),'" default="',convert2str(self.extractedelements),'">','     <section name="mesh3dprisms" />','     <help> elements extracted from the model </help>','  </parameter>');
-			fprintf(fid,'%s\n%s\n','</frame>');
-
-			% Projection
-			fprintf(fid,'%s\n%s\n%s\n','<frame key="5" label="Projection">','<section name="mesh3dprisms" />'); 
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="lat" type="',class(self.lat),'" default="',convert2str(self.lat),'">','     <section name="mesh3dprisms" />','     <help> vertices latitude [degrees] </help>','  </parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="long" type="',class(self.long),'" default="',convert2str(self.long),'">','     <section name="mesh3dprisms" />','     <help> verticies longitude [degrees] </help>','  </parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n','  <parameter key ="epsg" type="',class(self.epsg),'" default="',convert2str(self.epsg),'">','     <section name="mesh3dprisms" />','     <help> Indicate epsg ''n'' or ''s'' </help>','  </parameter>');
-			fprintf(fid,'%s\n%s\n','</frame>');
-
-		end % }}}cd
 		function self = mesh3dprisms(varargin) % {{{
 			switch nargin
 				case 0
@@ -143,10 +90,10 @@
 		end % }}}
 		function md = checkconsistency(self,md,solution,analyses) % {{{
 
-			md = checkfield(md,'fieldname','mesh.x','NaN',1,'size',[md.mesh.numberofvertices 1]);
-			md = checkfield(md,'fieldname','mesh.y','NaN',1,'size',[md.mesh.numberofvertices 1]);
-			md = checkfield(md,'fieldname','mesh.z','NaN',1,'size',[md.mesh.numberofvertices 1]);
-			md = checkfield(md,'fieldname','mesh.elements','NaN',1,'>',0,'values',1:md.mesh.numberofvertices);
+			md = checkfield(md,'fieldname','mesh.x','NaN',1,'Inf',1,'size',[md.mesh.numberofvertices 1]);
+			md = checkfield(md,'fieldname','mesh.y','NaN',1,'Inf',1,'size',[md.mesh.numberofvertices 1]);
+			md = checkfield(md,'fieldname','mesh.z','NaN',1,'Inf',1,'size',[md.mesh.numberofvertices 1]);
+			md = checkfield(md,'fieldname','mesh.elements','NaN',1,'Inf',1,'>',0,'values',1:md.mesh.numberofvertices);
 			md = checkfield(md,'fieldname','mesh.elements','size',[md.mesh.numberofelements 6]);
 			if any(~ismember(1:md.mesh.numberofvertices,sort(unique(md.mesh.elements(:)))));
 				md = checkmessage(md,'orphan nodes have been found. Check the mesh outline');

Modified: issm/trunk/src/m/classes/mesh3dprisms.py
===================================================================
--- issm/trunk/src/m/classes/mesh3dprisms.py	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/classes/mesh3dprisms.py	2016-04-13 04:32:01 UTC (rev 20500)
@@ -105,10 +105,10 @@
 	#}}}
 	def checkconsistency(self,md,solution,analyses):    # {{{
 
-		md = checkfield(md,'fieldname','mesh.x','NaN',1,'size',[md.mesh.numberofvertices])
-		md = checkfield(md,'fieldname','mesh.y','NaN',1,'size',[md.mesh.numberofvertices])
-		md = checkfield(md,'fieldname','mesh.z','NaN',1,'size',[md.mesh.numberofvertices])
-		md = checkfield(md,'fieldname','mesh.elements','NaN',1,'>',0,'values',numpy.arange(1,md.mesh.numberofvertices+1))
+		md = checkfield(md,'fieldname','mesh.x','NaN',1,'Inf',1,'size',[md.mesh.numberofvertices])
+		md = checkfield(md,'fieldname','mesh.y','NaN',1,'Inf',1,'size',[md.mesh.numberofvertices])
+		md = checkfield(md,'fieldname','mesh.z','NaN',1,'Inf',1,'size',[md.mesh.numberofvertices])
+		md = checkfield(md,'fieldname','mesh.elements','NaN',1,'Inf',1,'>',0,'values',numpy.arange(1,md.mesh.numberofvertices+1))
 		md = checkfield(md,'fieldname','mesh.elements','size',[md.mesh.numberofelements,6])
 		if numpy.any(numpy.logical_not(m.ismember(numpy.arange(1,md.mesh.numberofvertices+1),md.mesh.elements))):
 			md.checkmessage("orphan nodes have been found. Check the mesh3dprisms outline")

Modified: issm/trunk/src/m/classes/mesh3dsurface.m
===================================================================
--- issm/trunk/src/m/classes/mesh3dsurface.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/classes/mesh3dsurface.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -80,13 +80,13 @@
 		end % }}}
 		function md = checkconsistency(obj,md,solution,analyses) % {{{
 
-			md = checkfield(md,'fieldname','mesh.x','NaN',1,'size',[md.mesh.numberofvertices 1]);
-			md = checkfield(md,'fieldname','mesh.y','NaN',1,'size',[md.mesh.numberofvertices 1]);
-			md = checkfield(md,'fieldname','mesh.z','NaN',1,'size',[md.mesh.numberofvertices 1]);
-			md = checkfield(md,'fieldname','mesh.lat','NaN',1,'size',[md.mesh.numberofvertices 1]);
-			md = checkfield(md,'fieldname','mesh.long','NaN',1,'size',[md.mesh.numberofvertices 1]);
-			md = checkfield(md,'fieldname','mesh.r','NaN',1,'size',[md.mesh.numberofvertices 1]);
-			md = checkfield(md,'fieldname','mesh.elements','NaN',1,'>',0,'values',1:md.mesh.numberofvertices);
+			md = checkfield(md,'fieldname','mesh.x','NaN',1,'Inf',1,'size',[md.mesh.numberofvertices 1]);
+			md = checkfield(md,'fieldname','mesh.y','NaN',1,'Inf',1,'size',[md.mesh.numberofvertices 1]);
+			md = checkfield(md,'fieldname','mesh.z','NaN',1,'Inf',1,'size',[md.mesh.numberofvertices 1]);
+			md = checkfield(md,'fieldname','mesh.lat','NaN',1,'Inf',1,'size',[md.mesh.numberofvertices 1]);
+			md = checkfield(md,'fieldname','mesh.long','NaN',1,'Inf',1,'size',[md.mesh.numberofvertices 1]);
+			md = checkfield(md,'fieldname','mesh.r','NaN',1,'Inf',1,'size',[md.mesh.numberofvertices 1]);
+			md = checkfield(md,'fieldname','mesh.elements','NaN',1,'Inf',1,'>',0,'values',1:md.mesh.numberofvertices);
 			md = checkfield(md,'fieldname','mesh.elements','size',[md.mesh.numberofelements 3]);
 			if any(~ismember(1:md.mesh.numberofvertices,sort(unique(md.mesh.elements(:)))));
 				md = checkmessage(md,'orphan nodes have been found. Check the mesh outline');
@@ -129,48 +129,6 @@
 			fielddisplay(obj,'extractedvertices','vertices extracted from the model');
 			fielddisplay(obj,'extractedelements','elements extracted from the model'); 
 		end % }}}
-		function createxml(obj,fid) % {{{
-			fprintf(fid, '<!-- #D surface Mesh -->\n');
-
-			%elements and vertices
-			fprintf(fid,'%s\n%s\n%s\n','<frame key="1" label="Elements and vertices">','<section name="mesh" />');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n','  <parameter key ="numberofelements" type="',class(obj.numberofelements),'" default="',convert2str(obj.numberofelements),'">','     <section name="mesh" />','     <help> number of elements </help>','  </parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n','  <parameter key ="numberofvertices" type="',class(obj.numberofvertices),'" default="',convert2str(obj.numberofvertices),'">','     <section name="mesh" />','     <help> number of vertices </help>','  </parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n','  <parameter key ="elements" type="',class(obj.elements),'" default="',convert2str(obj.elements),'">','     <section name="mesh" />','     <help> vertex indices of the mesh elements </help>','  </parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="x" type="',class(obj.x),'" default="',convert2str(obj.x),'">','     <section name="mesh" />','     <help> vertices x coordinate [m] </help>','  </parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="y" type="',class(obj.y),'" default="',convert2str(obj.y),'">','     <section name="mesh" />','     <help> vertices y coordinate [m] </help>','  </parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="edges" type="',class(obj.edges),'" default="',convert2str(obj.edges),'">','     <section name="mesh" />','     <help> edges of the 2d mesh (vertex1 vertex2 element1 element2) </help>','  </parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="numberofedges" type="',class(obj.numberofedges),'" default="',convert2str(obj.numberofedges),'">','     <section name="mesh" />','     <help> number of edges of the 2d mesh </help>','  </parameter>');
-			fprintf(fid,'%s\n%s\n','</frame>');
-
-			% properties
-			fprintf(fid,'%s\n%s\n%s\n','<frame key="2" label="Properties">','<section name="mesh" />');             
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="vertexonboundary" type="',class(obj.vertexonboundary),'" default="',convert2str(obj.vertexonboundary),'">','     <section name="mesh" />','     <help> vertices on the boundary of the domain flag list </help>','  </parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="segments" type="',class(obj.segments),'" default="',convert2str(obj.segments),'">','     <section name="mesh" />','     <help> edges on domain boundary (vertex1 vertex2 element) </help>','  </parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="segmentmarkers" type="',class(obj.segmentmarkers),'" default="',convert2str(obj.segmentmarkers),'">','     <section name="mesh" />','     <help> number associated to each segment </help>','  </parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="vertexconnectivity" type="',class(obj.vertexconnectivity),'" default="',convert2str(obj.vertexconnectivity),'">','     <section name="mesh" />','     <help> list of vertices connected to vertex_i </help>','  </parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="elementconnectivity" type="',class(obj.elementconnectivity),'" default="',convert2str(obj.elementconnectivity),'">','     <section name="mesh" />','     <help> list of vertices connected to element_i </help>','  </parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="average_vertex_connectivity" type="',class(obj.average_vertex_connectivity),'" default="',convert2str(obj.average_vertex_connectivity),'">','     <section name="mesh" />','     <help> average number of vertices connected to one vertex </help>','  </parameter>');
-			fprintf(fid,'%s\n%s\n','</frame>');
-
-			%extracted model
-			fprintf(fid,'%s\n%s\n%s\n','<frame key="3" label="Extracted Model">','<section name="mesh" />'); 
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="extractedvertices" type="',class(obj.extractedvertices),'" default="',convert2str(obj.extractedvertices),'">','     <section name="mesh" />','     <help> vertices extracted from the model </help>','  </parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="extractedelements" type="',class(obj.extractedelements),'" default="',convert2str(obj.extractedelements),'">','     <section name="mesh" />','     <help> elements extracted from the model </help>','  </parameter>');
-			fprintf(fid,'%s\n%s\n','</frame>');
-
-			%projection
-			fprintf(fid,'%s\n%s\n%s\n','<frame key="4" label="Projection">','<section name="mesh" />'); 
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="lat" type="',class(obj.lat),'" default="',convert2str(obj.lat),'">','     <section name="mesh" />','     <help> vertices latitude [degrees] </help>','  </parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="long" type="',class(obj.long),'" default="',convert2str(obj.long),'">','     <section name="mesh" />','     <help> verticies longitude [degrees] </help>','  </parameter>');
-			% choice (epsg) 'n' or 's'
-			fprintf(fid,'%s\n%s\n%s\n','  <parameter key ="epsg" type="alternative" optional="false">','     <section name="mesh" />','     <help> Indicate epsg ''n'' or ''s'' </help>');
-			fprintf(fid,'%s\n','       <option value="n" type="string" default="true"> </option>');
-			fprintf(fid,'%s\n','       <option value="s" type="string" default="false"> </option>');
-			fprintf(fid,'%s\n','  </parameter>');
-			fprintf(fid,'%s\n%s\n','</frame>');
-
-		end % }}}
 		function marshall(obj,md,fid) % {{{
 			WriteData(fid,'enum',DomainTypeEnum(),'data',StringToEnum(['Domain' domaintype(obj)]),'format','Integer');
 			WriteData(fid,'enum',DomainDimensionEnum(),'data',dimension(obj),'format','Integer');
@@ -178,8 +136,8 @@
 			WriteData(fid,'object',obj,'class','mesh','fieldname','x','format','DoubleMat','mattype',1);
 			WriteData(fid,'object',obj,'class','mesh','fieldname','y','format','DoubleMat','mattype',1);
 			WriteData(fid,'object',obj,'class','mesh','fieldname','z','format','DoubleMat','mattype',1);
-			WriteData(fid,'object',obj,'class','mesh','fieldname','lat','format','DoubleMat','mattype',1);
-			WriteData(fid,'object',obj,'class','mesh','fieldname','long','format','DoubleMat','mattype',1);
+			WriteData(fid,'enum',MeshLatEnum(),'data',obj.lat,'format','DoubleMat','mattype',1);
+			WriteData(fid,'enum',MeshLongEnum(),'data',obj.long,'format','DoubleMat','mattype',1);
 			WriteData(fid,'object',obj,'class','mesh','fieldname','r','format','DoubleMat','mattype',1);
 			WriteData(fid,'enum',MeshZEnum(),'data',zeros(obj.numberofvertices,1),'format','DoubleMat','mattype',1);
 			WriteData(fid,'object',obj,'class','mesh','fieldname','elements','format','DoubleMat','mattype',2);
@@ -207,5 +165,29 @@
 			y        = self.y;
 			z        = self.z;
 		end % }}}
+		function savemodeljs(self,fid,modelname) % {{{
+		
+			fprintf(fid,'%s.mesh=new mesh3dsurface();\n',modelname);
+			writejs1Darray(fid,[modelname '.mesh.x'],self.x);
+			writejs1Darray(fid,[modelname '.mesh.y'],self.y);
+			writejs1Darray(fid,[modelname '.mesh.z'],self.z);
+			writejs2Darray(fid,[modelname '.mesh.elements'],self.elements);
+			writejsdouble(fid,[modelname '.mesh.numberofelements'],self.numberofelements);
+			writejsdouble(fid,[modelname '.mesh.numberofvertices'],self.numberofvertices);
+			writejsdouble(fid,[modelname '.mesh.numberofedges'],self.numberofedges);
+			writejs1Darray(fid,[modelname '.mesh.lat'],self.lat);
+			writejs1Darray(fid,[modelname '.mesh.long'],self.long);
+			writejs1Darray(fid,[modelname '.mesh.r'],self.r);
+			writejs1Darray(fid,[modelname '.mesh.vertexonboundary'],self.vertexonboundary);
+			writejs2Darray(fid,[modelname '.mesh.edges'],self.edges);
+			writejs2Darray(fid,[modelname '.mesh.segments'],self.segments);
+			writejs2Darray(fid,[modelname '.mesh.segmentmarkers'],self.segmentmarkers);
+			writejs2Darray(fid,[modelname '.mesh.vertexconnectivity'],self.vertexconnectivity);
+			writejs2Darray(fid,[modelname '.mesh.elementconnectivity'],self.elementconnectivity);
+			writejsdouble(fid,[modelname '.mesh.average_vertex_connectivity'],self.average_vertex_connectivity);
+			writejs1Darray(fid,[modelname '.mesh.extractedvertices'],self.extractedvertices);
+			writejs1Darray(fid,[modelname '.mesh.extractedelements'],self.extractedelements);
+
+		end % }}}
 	end
 end

Modified: issm/trunk/src/m/classes/mesh3dtetras.m
===================================================================
--- issm/trunk/src/m/classes/mesh3dtetras.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/classes/mesh3dtetras.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -61,59 +61,6 @@
 		end% }}}
 	end
 	methods
-		function createxml(self,fid) % {{{
-			fprintf(fid, '<!-- 3D Tetra Mesh -->\n');
-
-			% Elements and verticies of the original 2d mesh
-			fprintf(fid,'%s\n%s\n%s\n','       <frame key="1" label="Elements and vertices of the orginal 2d mesh">','       <section name="mesh3dprisms" />');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n','          <parameter key ="numberofelements2d" type="',class(self.numberofelements2d),'" default="',convert2str(self.numberofelements2d),'">','              <help> number of elements </help>','          </parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n','          <parameter key ="numberofvertices2d" type="',class(self.numberofvertices2d),'" default="',convert2str(self.numberofvertices2d),'">','              <help> number of vertices </help>','          </parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n','          <parameter key ="elements2d" type="',class(self.elements2d),'" default="',convert2str(self.elements2d),'">','              <help> vertex indices of the mesh elements </help>','          </parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="x2d" type="',class(self.x2d),'" default="',convert2str(self.x2d),'">','     <section name="mesh3dprisms" />','     <help> vertices x coordinate [m] </help>','  </parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="y2d" type="',class(self.y2d),'" default="',convert2str(self.y2d),'">','     <section name="mesh3dprisms" />','     <help> vertices y coordinate [m] </help>','  </parameter>');
-			fprintf(fid,'%s\n%s\n','       </frame>');
-
-			% Elements and vertices of the extruded 3d mesh
-			fprintf(fid,'%s\n%s\n%s\n','       <frame key="2" label="Elements and vertices of the orginal 3d mesh">','       <section name="mesh3dprisms" />');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n','          <parameter key ="numberofelements" type="',class(self.numberofelements),'" default="',convert2str(self.numberofelements),'">','              <help> number of elements </help>','          </parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n','          <parameter key ="numberofvertices" type="',class(self.numberofvertices),'" default="',convert2str(self.numberofvertices),'">','              <help> number of vertices </help>','          </parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n','          <parameter key ="elements" type="',class(self.elements),'" default="',convert2str(self.elements),'">','              <help> vertex indices of the mesh elements </help>','          </parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="x" type="',class(self.x),'" default="',convert2str(self.x),'">','     <section name="mesh3dprisms" />','     <help> vertices x coordinate [m] </help>','  </parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="y" type="',class(self.y),'" default="',convert2str(self.y),'">','     <section name="mesh3dprisms" />','     <help> vertices y coordinate [m] </help>','  </parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="z" type="',class(self.y),'" default="',convert2str(self.y),'">','     <section name="mesh3dprisms" />','     <help> vertices z coordinate [m] </help>','  </parameter>');
-			fprintf(fid,'%s\n%s\n','       </frame>');
-
-			% properties
-			fprintf(fid,'%s\n%s\n%s\n','<frame key="3" label="Properties">','<section name="mesh3dprisms" />');             
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="numberoflayers" type="',class(self.numberoflayers),'" default="',convert2str(self.numberoflayers),'">','     <section name="mesh3dprisms" />','     <help> number of extrusion layers </help>','  </parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="vertexonbase" type="',class(self.vertexonbase),'" default="',convert2str(self.vertexonbase),'">','     <section name="mesh3dprisms" />','     <help> lower vertices flags list </help>','  </parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="elementontbase" type="',class(self.elementontbase),'" default="',convert2str(self.elementontbase),'">','     <section name="mesh3dprisms" />','     <help> lower elements flags list </help>','  </parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="vertexonsurface" type="',class(self.vertexonsurface),'" default="',convert2str(self.vertexonsurface),'">','     <section name="mesh3dprisms" />','     <help> upper vertices flags list </help>','  </parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="elementontsurface" type="',class(self.elementontsurface),'" default="',convert2str(self.elementontsurface),'">','     <section name="mesh3dprisms" />','     <help> upper elements flags list </help>','  </parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="uppervertex" type="',class(self.uppervertex),'" default="',convert2str(self.uppervertex),'">','     <section name="mesh3dprisms" />','     <help> upper vertex list (NaN for vertex on the upper surface) </help>','  </parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="upperelements" type="',class(self.upperelements),'" default="',convert2str(self.upperelements),'">','     <section name="mesh3dprisms" />','     <help> upper element list (NaN for element on the upper layer) </help>','  </parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="lowervertex" type="',class(self.lowervertex),'" default="',convert2str(self.lowervertex),'">','     <section name="mesh3dprisms" />','     <help> lower vertex list (NaN for vertex on the lower surface) </help>','  </parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="lowerelements" type="',class(self.lowerelements),'" default="',convert2str(self.lowerelements),'">','     <section name="mesh3dprisms" />','     <help> element list (NaN for element on the lower layer) </help>','  </parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="vertexonboundary" type="',class(self.vertexonboundary),'" default="',convert2str(self.vertexonboundary),'">','     <section name="mesh3dprisms" />','     <help> vertices on the boundary of the domain flag list </help>','  </parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="vertexconnectivity" type="',class(self.vertexconnectivity),'" default="',convert2str(self.vertexconnectivity),'">','     <section name="mesh3dprisms" />','     <help> list of vertices connected to vertex_i </help>','  </parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="elementconnectivity" type="',class(self.elementconnectivity),'" default="',convert2str(self.elementconnectivity),'">','     <section name="mesh3dprisms" />','     <help> average number of vertices connected to one vertex </help>','  </parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="average_vertex_connectivity" type="',class(self.average_vertex_connectivity),'" default="',convert2str(self.average_vertex_connectivity),'">','     <section name="mesh3dprisms" />','     <help> average number of vertices connected to one vertex </help>','  </parameter>');
-			fprintf(fid,'%s\n%s\n','</frame>');
-
-			% Extracted model
-			fprintf(fid,'%s\n%s\n%s\n','<frame key="4" label="Extracted Model">','<section name="mesh3dprisms" />'); 
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="extractedvertices" type="',class(self.extractedvertices),'" default="',convert2str(self.extractedvertices),'">','     <section name="mesh3dprisms" />','     <help> vertices extracted from the model </help>','  </parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="extractedelements" type="',class(self.extractedelements),'" default="',convert2str(self.extractedelements),'">','     <section name="mesh3dprisms" />','     <help> elements extracted from the model </help>','  </parameter>');
-			fprintf(fid,'%s\n%s\n','</frame>');
-
-			% Projection
-			fprintf(fid,'%s\n%s\n%s\n','<frame key="5" label="Projection">','<section name="mesh3dprisms" />'); 
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="lat" type="',class(self.lat),'" default="',convert2str(self.lat),'">','     <section name="mesh3dprisms" />','     <help> vertices latitude [degrees] </help>','  </parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="long" type="',class(self.long),'" default="',convert2str(self.long),'">','     <section name="mesh3dprisms" />','     <help> verticies longitude [degrees] </help>','  </parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n','  <parameter key ="epsg" type="',class(self.epsg),'" default="',convert2str(self.epsg),'">','     <section name="mesh3dprisms" />','     <help> Indicate epsg ''n'' or ''s'' </help>','  </parameter>');
-			fprintf(fid,'%s\n%s\n','</frame>');
-
-		end % }}}cd
 		function self = mesh3dtetras(varargin) % {{{
 			switch nargin
 				case 0
@@ -143,10 +90,10 @@
 		end % }}}
 		function md = checkconsistency(self,md,solution,analyses) % {{{
 
-			md = checkfield(md,'fieldname','mesh.x','NaN',1,'size',[md.mesh.numberofvertices 1]);
-			md = checkfield(md,'fieldname','mesh.y','NaN',1,'size',[md.mesh.numberofvertices 1]);
-			md = checkfield(md,'fieldname','mesh.z','NaN',1,'size',[md.mesh.numberofvertices 1]);
-			md = checkfield(md,'fieldname','mesh.elements','NaN',1,'>',0,'values',1:md.mesh.numberofvertices);
+			md = checkfield(md,'fieldname','mesh.x','NaN',1,'Inf',1,'size',[md.mesh.numberofvertices 1]);
+			md = checkfield(md,'fieldname','mesh.y','NaN',1,'Inf',1,'size',[md.mesh.numberofvertices 1]);
+			md = checkfield(md,'fieldname','mesh.z','NaN',1,'Inf',1,'size',[md.mesh.numberofvertices 1]);
+			md = checkfield(md,'fieldname','mesh.elements','NaN',1,'Inf',1,'>',0,'values',1:md.mesh.numberofvertices);
 			md = checkfield(md,'fieldname','mesh.elements','size',[md.mesh.numberofelements 4]);
 			if any(~ismember(1:md.mesh.numberofvertices,sort(unique(md.mesh.elements(:)))));
 				md = checkmessage(md,'orphan nodes have been found. Check the mesh outline');

Modified: issm/trunk/src/m/classes/miscellaneous.m
===================================================================
--- issm/trunk/src/m/classes/miscellaneous.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/classes/miscellaneous.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -10,17 +10,6 @@
 		dummy = struct();
 	end
 	methods
-        function createxml(self,fid) % {{{
-            fprintf(fid, '<!-- miscellaneous -->\n');            
-                    
-            % miscellaneous solution parameters
-            fprintf(fid,'%s\n%s\n%s\n','<frame key="1" label="miscellaneous parameters">','<section name="miscellaneous" />');                    
-                fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="notes" type="',class(self.notes),'" default="',convert2str(self.notes),'">','     <section name="miscellaneous" />','     <help> notes in a cell of strings </help>','  </parameter>');
-                fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="name" type="',class(self.name),'" default="',convert2str(self.name),'">','     <section name="miscellaneous" />','     <help> model name </help>','  </parameter>');
-                fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="dummy" type="',class(self.dummy),'" default="',convert2str(self.dummy),'">','     <section name="miscellaneous" />','     <help> empty field to store some data </help>','  </parameter>');
-            fprintf(fid,'%s\n%s\n','</frame>');    
-        
-        end % }}}        
 		function self = miscellaneous(varargin) % {{{
 			switch nargin
 				case 0
@@ -48,5 +37,14 @@
 		function marshall(self,md,fid) % {{{
 			WriteData(fid,'object',self,'fieldname','name','format','String');
 		end % }}}
+		function savemodeljs(self,fid,modelname) % {{{
+		
+			writejsstring(fid,[modelname '.miscellaneous.notes'],self.notes);
+			writejsstring(fid,[modelname '.miscellaneous.name'],self.name);
+			if strcmpi(class(self.dummy),'double'),
+				writejs1Darray(fid,[modelname '.miscellaneous.dummy'],self.dummy);
+			end
+
+		end % }}}
 	end
 end

Modified: issm/trunk/src/m/classes/misfit.m
===================================================================
--- issm/trunk/src/m/classes/misfit.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/classes/misfit.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -63,9 +63,9 @@
 			if ~ischar(self.timeinterpolation),
 				error('misfit error message: ''timeinterpolation'' field should be a string!');
 			end
-			md = checkfield(md,'fieldname','self.observation','field',self.observation,'timeseries',1,'NaN',1);
+			md = checkfield(md,'fieldname','self.observation','field',self.observation,'timeseries',1,'NaN',1,'Inf',1);
 			md = checkfield(md,'fieldname','self.timeinterpolation','field',self.timeinterpolation,'values',{'nearestneighbor'});
-			md = checkfield(md,'fieldname','self.weights','field',self.weights,'timeseries',1,'NaN',1);
+			md = checkfield(md,'fieldname','self.weights','field',self.weights,'timeseries',1,'NaN',1,'Inf',1);
 
 		end % }}}
 		function md = disp(self) % {{{

Modified: issm/trunk/src/m/classes/model.m
===================================================================
--- issm/trunk/src/m/classes/model.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/classes/model.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -12,7 +12,7 @@
 
 		geometry         = 0;
 		constants        = 0;
-		surfaceforcings  = 0;
+		smb              = 0;
 		basalforcings    = 0;
 		materials        = 0;
 		damage           = 0;
@@ -21,6 +21,7 @@
 		timestepping     = 0;
 		initialization   = 0;
 		rifts            = 0;
+		slr              = 0;
 
 		debug            = 0;
 		verbose          = 0;
@@ -36,6 +37,7 @@
 		thermal          = 0;
 		steadystate      = 0;
 		transient        = 0;
+		levelset			  = 0;
 		calving          = 0;
 		gia              = 0;
 
@@ -104,13 +106,6 @@
 			if ~isa(md.outputdefinition,'outputdefinition'),
 				md.outputdefinition=outputdefinition();
 			end
-			%2014 January 9th
-			if isa(md.surfaceforcings,'surfaceforcings'),
-				disp('Recovering old surfaceforcings class');
-				mass_balance=md.surfaceforcings.mass_balance;
-				md.surfaceforcings=SMB();
-				md.surfaceforcings.mass_balance=mass_balance;
-			end
 			%2014 March 26th
 			if isa(md.mesh,'mesh'),
 				disp('Recovering old mesh class');
@@ -128,6 +123,11 @@
 			if isa(md.calving,'double');
 				md.calving=calving();
 			end
+			%2016 February 3
+			if isa(md.slr,'double');
+				md.slr=slr();
+			end
+
 		end% }}}
 	end
 	methods
@@ -188,6 +188,11 @@
 			elseif isa(md.friction,'frictionweertman'),
 				md.friction.C=project2d(md,md.friction.C,1);
 				md.friction.m=project2d(md,md.friction.m,1);
+			elseif isa(md.friction,'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');
 	    end
 
 			%observations
@@ -197,8 +202,10 @@
 			if ~isnan(md.inversion.cost_functions_coefficients), md.inversion.cost_functions_coefficients=project2d(md,md.inversion.cost_functions_coefficients,md.mesh.numberoflayers); end;
 			if numel(md.inversion.min_parameters)>1, md.inversion.min_parameters=project2d(md,md.inversion.min_parameters,md.mesh.numberoflayers); end;
 			if numel(md.inversion.max_parameters)>1, md.inversion.max_parameters=project2d(md,md.inversion.max_parameters,md.mesh.numberoflayers); end;
-			if ~isnan(md.surfaceforcings.mass_balance),
-				md.surfaceforcings.mass_balance=project2d(md,md.surfaceforcings.mass_balance,md.mesh.numberoflayers); 
+			if isa(md.smb,'SMBforcing') & ~isnan(md.smb.mass_balance),
+				md.smb.mass_balance=project2d(md,md.smb.mass_balance,md.mesh.numberoflayers); 
+			elseif isa(md.smb,'SMBhenning') & ~isnan(md.smb.smbref),
+				md.smb.smbref=project2d(md,md.smb.smbref,md.mesh.numberoflayers);
 			end;
 			if ~isnan(md.balancethickness.thickening_rate), md.balancethickness.thickening_rate=project2d(md,md.balancethickness.thickening_rate,md.mesh.numberoflayers); end;
 
@@ -302,7 +309,7 @@
 			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);
+			md.mesh.segments=contourenvelope(md.mesh);
 
 		end % }}}
 		function md2 = extract(md,area) % {{{
@@ -507,16 +514,16 @@
 			end
 
 			%recreate segments
-			if isa(md1.mesh,'mesh2d'),
+			if isa(md1.mesh,'mesh2d') | isa(md1.mesh','mesh3dsurface'),
 				md2.mesh.vertexconnectivity=NodeConnectivity(md2.mesh.elements,md2.mesh.numberofvertices);
 				md2.mesh.elementconnectivity=ElementConnectivity(md2.mesh.elements,md2.mesh.vertexconnectivity);
-				md2.mesh.segments=contourenvelope(md2);
+				md2.mesh.segments=contourenvelope(md2.mesh);
 				md2.mesh.vertexonboundary=zeros(numberofvertices2,1); md2.mesh.vertexonboundary(md2.mesh.segments(:,1:2))=1;
 			else
 				%First do the connectivity for the contourenvelope in 2d
 				md2.mesh.vertexconnectivity=NodeConnectivity(md2.mesh.elements2d,md2.mesh.numberofvertices2d);
 				md2.mesh.elementconnectivity=ElementConnectivity(md2.mesh.elements2d,md2.mesh.vertexconnectivity);
-				segments=contourenvelope(md2);
+				segments=contourenvelope(md2.mesh);
 				md2.mesh.vertexonboundary=zeros(numberofvertices2/md2.mesh.numberoflayers,1); md2.mesh.vertexonboundary(segments(:,1:2))=1;
 				md2.mesh.vertexonboundary=repmat(md2.mesh.vertexonboundary,md2.mesh.numberoflayers,1);
 				%Then do it for 3d as usual
@@ -739,13 +746,14 @@
 			md.geometry=extrude(md.geometry,md);
 			md.friction  = extrude(md.friction,md);
 			md.inversion = extrude(md.inversion,md);
-			md.surfaceforcings = extrude(md.surfaceforcings,md);
+			md.smb = extrude(md.smb,md);
 			md.initialization = extrude(md.initialization,md);
 
 			md.flowequation=md.flowequation.extrude(md);
 			md.stressbalance=extrude(md.stressbalance,md);
 			md.thermal=md.thermal.extrude(md);
 			md.masstransport=md.masstransport.extrude(md);
+			md.levelset=extrude(md.levelset,md);
 			md.calving=extrude(md.calving,md);
 			md.hydrology = extrude(md.hydrology,md);
 
@@ -789,7 +797,7 @@
 			if isfield(structmd,'melting'), md.basalforcings.floatingice_melting_rate=structmd.melting; end
 			if isfield(structmd,'melting_rate'), md.basalforcings.floatingice_melting_rate=structmd.melting_rate; end
 			if isfield(structmd,'melting_rate'), md.basalforcings.groundedice_melting_rate=structmd.melting_rate; end
-			if isfield(structmd,'accumulation'), md.surfaceforcings.mass_balance=structmd.accumulation; end
+			if isfield(structmd,'accumulation'), md.smb.mass_balance=structmd.accumulation; end
 			if isfield(structmd,'numberofgrids'), md.mesh.numberofvertices=structmd.numberofgrids; end
 			if isfield(structmd,'numberofgrids2d'), md.mesh.numberofvertices2d=structmd.numberofgrids2d; end
 			if isfield(structmd,'uppergrids'), md.mesh.uppervertex=structmd.uppergrids; end
@@ -801,7 +809,7 @@
 			if isfield(structmd,'petscoptions') & ~isempty(structmd.petscoptions), md.toolkits=structmd.petscoptions; end
 			if isfield(structmd,'g'), md.constants.g=structmd.g; end
 			if isfield(structmd,'yts'), md.constants.yts=structmd.yts; end
-			if isfield(structmd,'surface_mass_balance'), md.surfaceforcings.mass_balance=structmd.surface_mass_balance; end
+			if isfield(structmd,'surface_mass_balance'), md.smb.mass_balance=structmd.surface_mass_balance; end
 			if isfield(structmd,'basal_melting_rate'), md.basalforcings.floatingice_melting_rate=structmd.basal_melting_rate; end
 			if isfield(structmd,'geothermalflux'), md.basalforcings.geothermalflux=structmd.geothermalflux; end
 			if isfield(structmd,'drag'), md.friction.coefficient=structmd.drag; end
@@ -1012,11 +1020,11 @@
 			end
 
 			%New fields
-			if ~isfield(structmd,'upperelements');
+			if ~isfield(structmd,'upperelements') & isa(md.mesh,'mesh3dprisms')
 				md.mesh.upperelements=transpose(1:md.mesh.numberofelements)+md.mesh.numberofelements2d;
 				md.mesh.upperelements(end-md.mesh.numberofelements2d+1:end)=NaN;
 			end
-			if ~isfield(structmd,'lowerelements');
+			if ~isfield(structmd,'lowerelements') & isa(md.mesh,'mesh3dprisms')
 				md.mesh.lowerelements=transpose(1:md.mesh.numberofelements)-md.mesh.numberofelements2d;
 				md.mesh.lowerelements(1:md.mesh.numberofelements2d)=NaN;
 			end
@@ -1037,6 +1045,19 @@
 				disp('Recovering old diagnostic class');
 				md.stressbalance=stressbalance(structmd.diagnostic);
 			end
+			%2014 January 9th
+			if isfield(structmd,'surfaceforcings'),
+				disp('Recovering old surfaceforcings class');
+				mass_balance=structmd.surfaceforcings.mass_balance;
+				md.smb=SMB();
+				md.smb.mass_balance=mass_balance;
+			end
+			%2015 September 10
+			if isfield(structmd,'surfaceforcings') & isa(md.smb,'SMB'),
+				disp('Recovering old SMB class');
+				md.smb=SMBforcing(structmd.surfaceforcings);
+			end
+
 		end% }}}
 		function md = setdefaultparameters(md) % {{{
 
@@ -1046,10 +1067,11 @@
 			md.constants        = constants();
 			md.geometry         = geometry();
 			md.initialization   = initialization();
-			md.surfaceforcings  = SMB();
+			md.smb              = SMBforcing();
 			md.basalforcings    = basalforcings();
 			md.friction         = friction();
 			md.rifts            = rifts();
+			md.slr              = slr();
 			md.timestepping     = timestepping();
 			md.groundingline    = groundingline();
 			md.materials        = matice();
@@ -1067,6 +1089,7 @@
 			md.thermal          = thermal();
 			md.steadystate      = steadystate();
 			md.transient        = transient();
+			md.levelset			  = levelset();
 			md.calving          = calving();
 			md.gia              = gia();
 			md.autodiff         = autodiff();
@@ -1215,7 +1238,7 @@
 			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','surfaceforcings' ,['[1x1 ' class(self.surfaceforcings) ']'],'surface forcings'));
+			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'));
@@ -1224,6 +1247,7 @@
 			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','slr'             ,['[1x1 ' class(self.slr) ']'],'slr forcings'));
 			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'));
@@ -1237,6 +1261,7 @@
 			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','gia'             ,['[1x1 ' class(self.gia) ']'],'parameters for gia solution'));
 			disp(sprintf('%19s: %-22s -- %s','autodiff'        ,['[1x1 ' class(self.autodiff) ']'],'automatic differentiation parameters'));
@@ -1338,5 +1363,41 @@
 		eval(['delete ' name]);
 
 		end % }}}
+		function savemodeljs(md,modelname,websiteroot) % {{{
+
+			%the goal of this routine is to save the model as a javascript array that can be included in any html 
+			%file: 
+
+			%disp: 
+			disp(['saving model ''' modelname ''' in file ' websiteroot '/js/' modelname '.js']);
+
+			%open file for writing and declare the model:
+			fid=fopen([websiteroot '/js/' modelname '.js'],'w');
+			fprintf(fid,'var %s=new model();\n',modelname);
+
+			%now go through all the classes and fwrite all the corresponding fields: 
+			
+			fields=properties('model');
+			for i=1:length(fields),
+				field=fields{i};
+
+				%Some properties do not need to be saved
+				if ismember(field,{'results','cluster' }),
+					continue;
+				end
+
+				%Check that current field is an object
+				if ~isobject(md.(field))
+					error(['field ''' char(field) ''' is not an object']);
+				end
+
+				%savemodeljs for current object
+				%disp(['javascript saving ' field '...']);
+				savemodeljs(md.(field),fid,modelname);
+			end
+
+			%done, close file:
+			fclose(fid);
+		end
 	end
  end

Modified: issm/trunk/src/m/classes/model.py
===================================================================
--- issm/trunk/src/m/classes/model.py	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/classes/model.py	2016-04-13 04:32:01 UTC (rev 20500)
@@ -7,13 +7,15 @@
 from mask import mask
 from geometry import geometry
 from constants import constants
-from SMB import SMB
+from SMBforcing import SMBforcing
 from SMBpdd import SMBpdd
+from SMBd18opdd import SMBd18opdd
 from SMBgradients import SMBgradients
 from SMBcomponents import SMBcomponents
 from SMBmeltcomponents import SMBmeltcomponents
 from basalforcings import basalforcings
 from matice import matice
+from levelset import levelset 
 from calving import calving
 from calvinglevermann import calvinglevermann
 #from calvingpi import calvingpi
@@ -23,11 +25,14 @@
 from timestepping import timestepping
 from initialization import initialization
 from rifts import rifts
+from slr import slr
 from debug import debug
 from verbose import verbose
 from settings import settings
 from toolkits import toolkits
 from generic import generic
+from pfe import pfe
+from vilje import vilje
 from balancethickness import balancethickness
 from stressbalance import stressbalance
 from groundingline import groundingline
@@ -73,7 +78,7 @@
 		self.mask             = mask()
 		self.geometry         = geometry()
 		self.constants        = constants()
-		self.surfaceforcings  = SMB()
+		self.smb              = SMBforcing()
 		self.basalforcings    = basalforcings()
 		self.materials        = matice()
 		self.damage           = damage()
@@ -82,6 +87,7 @@
 		self.timestepping     = timestepping()
 		self.initialization   = initialization()
 		self.rifts            = rifts()
+		self.slr              = slr()
 
 		self.debug            = debug()
 		self.verbose          = verbose()
@@ -97,6 +103,7 @@
 		self.thermal          = thermal()
 		self.steadystate      = steadystate()
 		self.transient        = transient()
+		self.levelset         = levelset()
 		self.calving          = calving()
 		self.gia              = gia()
 
@@ -117,7 +124,7 @@
 		        'mask',\
 		        'geometry',\
 		        'constants',\
-		        'surfaceforcings',\
+		        'smb',\
 		        'basalforcings',\
 		        'materials',\
 		        'damage',\
@@ -126,6 +133,7 @@
 		        'timestepping',\
 		        'initialization',\
 		        'rifts',\
+		        'slr',\
 		        'debug',\
 		        'verbose',\
 		        'settings',\
@@ -139,6 +147,7 @@
 		        'thermal',\
 		        'steadystate',\
 		        'transient',\
+		        'levelset',\
 		        'calving',\
 						'gia',\
 		        'autodiff',\
@@ -157,7 +166,7 @@
 		string="%s\n%s" % (string,"%19s: %-22s -- %s" % ("mask","[%s,%s]" % ("1x1",obj.mask.__class__.__name__),"defines grounded and floating elements"))
 		string="%s\n%s" % (string,"%19s: %-22s -- %s" % ("geometry","[%s,%s]" % ("1x1",obj.geometry.__class__.__name__),"surface elevation, bedrock topography, ice thickness,..."))
 		string="%s\n%s" % (string,"%19s: %-22s -- %s" % ("constants","[%s,%s]" % ("1x1",obj.constants.__class__.__name__),"physical constants"))
-		string="%s\n%s" % (string,"%19s: %-22s -- %s" % ("surfaceforcings","[%s,%s]" % ("1x1",obj.surfaceforcings.__class__.__name__),"surface forcings"))
+		string="%s\n%s" % (string,"%19s: %-22s -- %s" % ("smb","[%s,%s]" % ("1x1",obj.smb.__class__.__name__),"surface mass balance"))
 		string="%s\n%s" % (string,"%19s: %-22s -- %s" % ("basalforcings","[%s,%s]" % ("1x1",obj.basalforcings.__class__.__name__),"bed forcings"))
 		string="%s\n%s" % (string,"%19s: %-22s -- %s" % ("materials","[%s,%s]" % ("1x1",obj.materials.__class__.__name__),"material properties"))
 		string="%s\n%s" % (string,"%19s: %-22s -- %s" % ("damage","[%s,%s]" % ("1x1",obj.damage.__class__.__name__),"damage propagation laws"))
@@ -166,6 +175,7 @@
 		string="%s\n%s" % (string,"%19s: %-22s -- %s" % ("timestepping","[%s,%s]" % ("1x1",obj.timestepping.__class__.__name__),"time stepping for transient models"))
 		string="%s\n%s" % (string,"%19s: %-22s -- %s" % ("initialization","[%s,%s]" % ("1x1",obj.initialization.__class__.__name__),"initial guess/state"))
 		string="%s\n%s" % (string,"%19s: %-22s -- %s" % ("rifts","[%s,%s]" % ("1x1",obj.rifts.__class__.__name__),"rifts properties"))
+		string="%s\n%s" % (string,"%19s: %-22s -- %s" % ("slr","[%s,%s]" % ("1x1",obj.slr.__class__.__name__),"slr forcings"))
 		string="%s\n%s" % (string,"%19s: %-22s -- %s" % ("debug","[%s,%s]" % ("1x1",obj.debug.__class__.__name__),"debugging tools (valgrind, gprof)"))
 		string="%s\n%s" % (string,"%19s: %-22s -- %s" % ("verbose","[%s,%s]" % ("1x1",obj.verbose.__class__.__name__),"verbosity level in solve"))
 		string="%s\n%s" % (string,"%19s: %-22s -- %s" % ("settings","[%s,%s]" % ("1x1",obj.settings.__class__.__name__),"settings properties"))
@@ -179,6 +189,7 @@
 		string="%s\n%s" % (string,"%19s: %-22s -- %s" % ("thermal","[%s,%s]" % ("1x1",obj.thermal.__class__.__name__),"parameters for thermal solution"))
 		string="%s\n%s" % (string,"%19s: %-22s -- %s" % ("steadystate","[%s,%s]" % ("1x1",obj.steadystate.__class__.__name__),"parameters for steadystate solution"))
 		string="%s\n%s" % (string,"%19s: %-22s -- %s" % ("transient","[%s,%s]" % ("1x1",obj.transient.__class__.__name__),"parameters for transient solution"))
+		string="%s\n%s" % (string,"%19s: %-22s -- %s" % ("levelset","[%s,%s]" % ("1x1",obj.levelset.__class__.__name__),"parameters for moving boundaries (level-set method)"))
 		string="%s\n%s" % (string,"%19s: %-22s -- %s" % ("calving","[%s,%s]" % ("1x1",obj.calving.__class__.__name__),"parameters for calving"))
 		string="%s\n%s" % (string,"%19s: %-22s -- %s" % ("autodiff","[%s,%s]" % ("1x1",obj.autodiff.__class__.__name__),"automatic differentiation parameters"))
 		string="%s\n%s" % (string,"%19s: %-22s -- %s" % ("flaim","[%s,%s]" % ("1x1",obj.flaim.__class__.__name__),"flaim parameters"))
@@ -606,7 +617,7 @@
 		md.geometry.extrude(md)
 		md.friction.extrude(md)
 		md.inversion.extrude(md)
-		md.surfaceforcings.extrude(md)
+		md.smb.extrude(md)
 		md.initialization.extrude(md)
 		md.flowequation.extrude(md)
 
@@ -616,6 +627,7 @@
 
 		# Calving variables
 		md.hydrology.extrude(md)
+		md.levelset.extrude(md)
 		md.calving.extrude(md)
 
 		#connectivity
@@ -667,10 +679,12 @@
 		if not numpy.isnan(md.inversion.vy_obs).all(): md.inversion.vy_obs=project2d(md,md.inversion.vy_obs,md.mesh.numberoflayers) 
 		if not numpy.isnan(md.inversion.vel_obs).all(): md.inversion.vel_obs=project2d(md,md.inversion.vel_obs,md.mesh.numberoflayers) 
 		if not numpy.isnan(md.inversion.cost_functions_coefficients).all(): md.inversion.cost_functions_coefficients=project2d(md,md.inversion.cost_functions_coefficients,md.mesh.numberoflayers) 
-		if md.inversion.min_parameters.size>1: md.inversion.min_parameters=project2d(md,md.inversion.min_parameters,md.mesh.numberoflayers) 
-		if md.inversion.max_parameters.size>1: md.inversion.max_parameters=project2d(md,md.inversion.max_parameters,md.mesh.numberoflayers) 
-		if not numpy.isnan(md.surfaceforcings.mass_balance).all():
-			md.surfaceforcings.mass_balance=project2d(md,md.surfaceforcings.mass_balance,md.mesh.numberoflayers) 
+                if isinstance(md.inversion.min_parameters,numpy.ndarray):
+                    if md.inversion.min_parameters.size>1: md.inversion.min_parameters=project2d(md,md.inversion.min_parameters,md.mesh.numberoflayers) 
+                if isinstance(md.inversion.max_parameters,numpy.ndarray):
+		    if md.inversion.max_parameters.size>1: md.inversion.max_parameters=project2d(md,md.inversion.max_parameters,md.mesh.numberoflayers) 
+		if not numpy.isnan(md.smb.mass_balance).all():
+			md.smb.mass_balance=project2d(md,md.smb.mass_balance,md.mesh.numberoflayers) 
 		
 		if not numpy.isnan(md.balancethickness.thickening_rate).all(): md.balancethickness.thickening_rate=project2d(md,md.balancethickness.thickening_rate,md.mesh.numberoflayers) 
 
@@ -700,11 +714,11 @@
 
                 # Hydrologydc variables
                 if hasattr(md.hydrology,'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.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)
 
 		#boundary conditions
@@ -741,13 +755,16 @@
 		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)
-		md.geometry.bed=project2d(md,md.geometry.bed,1)
+                if isinstance(md.geometry.bed,numpy.ndarray):
+                    md.geometry.bed=project2d(md,md.geometry.bed,1)
 		md.mask.groundedice_levelset=project2d(md,md.mask.groundedice_levelset,1)
 		md.mask.ice_levelset=project2d(md,md.mask.ice_levelset,1)
 
 		#lat long
-		if md.mesh.lat.size==md.mesh.numberofvertices:  md.mesh.lat=project2d(md,md.mesh.lat,1) 
-		if md.mesh.long.size==md.mesh.numberofvertices: md.mesh.long=project2d(md,md.mesh.long,1) 
+                if isinstance(md.mesh.lat,numpy.ndarray):
+                    if md.mesh.lat.size==md.mesh.numberofvertices:  md.mesh.lat=project2d(md,md.mesh.lat,1) 
+                if isinstance(md.mesh.long,numpy.ndarray):
+		    if md.mesh.long.size==md.mesh.numberofvertices: md.mesh.long=project2d(md,md.mesh.long,1) 
 
 		#Initialize with the 2d mesh
 		mesh=mesh2d()

Modified: issm/trunk/src/m/classes/oldclasses/surfaceforcings.m
===================================================================
--- issm/trunk/src/m/classes/oldclasses/surfaceforcings.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/classes/oldclasses/surfaceforcings.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -1,9 +1,9 @@
 %SURFACEFORCING Class definition
 %
 %   Usage:
-%      surfaceforcings=surfaceforcings();
+%      smb=smb();
 
-classdef surfaceforcings
+classdef smb
 	properties (SetAccess=public) 
 		precipitation             = NaN;
 		mass_balance              = NaN;

Modified: issm/trunk/src/m/classes/organizer.m
===================================================================
--- issm/trunk/src/m/classes/organizer.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/classes/organizer.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -4,7 +4,6 @@
 %      repository: directory where all models will be saved
 %      prefix:     prefix for saved model names
 %      steps:      requested steps
-%      trunkprefix:prefix of previous run with a different prefix. Used to branch.
 %
 %   Usage:
 %      org = organizer(varargin)
@@ -20,14 +19,8 @@
     properties (SetAccess=public) 
 		repository    ='./';
 		prefix        ='model.';
-		trunkprefix   ='';
 		steps         =[];
 		requestedsteps=[0];
-		upload_server='';
-		upload_path='';
-		upload_login='';
-		upload_port=0;
-		download=0;
 		%}}}
 	end
 	methods
@@ -51,26 +44,11 @@
 			%Get steps
 			org.requestedsteps=getfieldvalue(options,'steps',0);
 
-			%Get trunk prefix (only if provided by user)
-			if exist(options,'trunkprefix'),
-				trunkprefix=getfieldvalue(options,'trunkprefix','');
-				if ~ischar(trunkprefix),                                 error('trunkprefix is not a string'); end
-				if ~strcmp(regexprep(trunkprefix,'\s+',''),trunkprefix), error('trunkprefix should not have any white space'); end
-				org.trunkprefix=trunkprefix;
-			end
-
-			%Get upload information, if provided
-			org.upload_server=getfieldvalue(options,'upload_server','');
-			org.upload_path=getfieldvalue(options,'upload_path','');
-			org.upload_login=getfieldvalue(options,'upload_login','');
-			org.upload_port=getfieldvalue(options,'upload_port',0);
-			org.download=getfieldvalue(options,'download',0);
-
 		end
 		%}}}
 		function disp(org) % {{{
 			disp(sprintf('   Repository: ''%s''',org.repository));
-			disp(sprintf('   Prefix:     ''%s''',org.prefix));
+			disp(sprintf('   Prefix:     ''%s''\n',org.prefix));
 			if isempty(org.steps)
 				disp('   no step');
 			else
@@ -78,14 +56,6 @@
 					disp(sprintf('   step #%2i: ''%s''',org.steps(i).id,org.steps(i).string));
 				end
 			end
-			if isempty(org.upload_server),
-				disp('   no upload info');
-			else
-				disp(sprintf('   upload_server:     ''%s''',org.upload_server));
-				disp(sprintf('   upload_login:     ''%s''',org.upload_login));
-				disp(sprintf('   upload_path:     ''%s''',org.upload_path));
-				disp(sprintf('   upload_port:     ''%i''',org.upload_port));
-			end
 		end
 		%}}}
 		function md=load(org,string),% {{{
@@ -122,19 +92,8 @@
 				return;
 			end
 
-			%If we are here, the model has not been found. Try trunk prefix if provided
-			if ~isempty(org.trunkprefix),
-				path2=[org.repository '/' org.trunkprefix string];
-				if ~exist(path2,'file'),
-					error(['Could find neither ' path ', nor ' path2]);
-				else
-					disp(['--> Branching ' org.prefix ' from trunk ' org.trunkprefix]);
-					md=loadmodel(path2);
-					return;
-				end
-			else
-				error(['Could not find ' path ]);
-			end
+			%If we are here, the data has not been found. 
+			error(['Could not find ' path ]);
 		end%}}}
 		function loaddata(org,string),% {{{
 
@@ -148,23 +107,19 @@
 				return;
 			end
 
-			%If we are here, the data has not been found. Try trunk prefix if provided
-			if ~isempty(org.trunkprefix),
-				path2=[org.repository '/' org.trunkprefix string];
-				if ~exist(path2,'file'),
-					error(['Could find neither ' path ', nor ' path2]);
-				else
-					disp(['--> Branching ' org.prefix ' from trunk ' org.trunkprefix]);
-					evalin('caller',['load -mat ' path2]);
-					return;
-				end
-			else
-				error(['Could not find ' path ]);
-			end
+			%If we are here, the data has not been found. 
+			error(['Could not find ' path ]);
 		end%}}}
-		function bool=perform(org,string) % {{{
+		function bool=perform(org,varargin) % {{{
 
 			bool=false;
+			
+			%group,string are the variable arguments length: 
+			if nargin==2,
+				string=varargin{1};
+			elseif nargin==3,
+				string=sprintf('%s.%s',varargin{1},varargin{2});
+			end
 
 			%Some checks
 			if ~ischar(string),                            error('Step provided should be a string'); end
@@ -191,26 +146,6 @@
 				disp(sprintf('\n   step #%i : %s\n',org.steps(org.currentstep).id,org.steps(org.currentstep).string));
 				bool=true;
 			end
-
-			%But if download is requested, we are downloading and skipping the step: 
-			if ismember(org.currentstep,org.requestedsteps) & org.download,
-				%load the model if it exists, and download
-				name=[org.repository '/' org.prefix org.steps(org.currentstep).string ];
-				if exist(name,'file'),
-					md=loadmodel(name); 
-					if isa(md,'model'),
-						if ~isempty(md.settings.upload_filename),
-							disp(sprintf('   downloading model'));
-							md=download(md);
-							save(name,'md','-v7.3');
-						end
-					end
-				end
-
-				%reset bool to false, so we stick with only downloading
-				bool=false;
-			end
-
 		end%}}}
 		function savemodel(org,md) % {{{
 
@@ -222,7 +157,7 @@
 			disp(['saving model as: ' name]);
 
 			%check that md is a model
-			if ~isa(md,'model'), warning('second argument is not a model'); end
+			if ~isa(md,'model') & ~isa(md,'sealevelmodel'), warning('second argument is not a model'); end
 			if (org.currentstep>length(org.steps)), error(['organizer error message: element with id ' num2str(org.currentstep) ' not found']); end
 
 			%save model

Modified: issm/trunk/src/m/classes/organizer.py
===================================================================
--- issm/trunk/src/m/classes/organizer.py	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/classes/organizer.py	2016-04-13 04:32:01 UTC (rev 20500)
@@ -97,12 +97,16 @@
 		#Get model path
 		if not isinstance(string,(str,unicode)):
 			raise TypeError("argument provided is not a string")
-		path=os.path.join(self.repository,self.prefix+'.step#'+string+'.python')
+		path1=os.path.join(self.repository,self.prefix+'.step#'+string+'.python')
+		path2=os.path.join(self.repository,string)
 
 		#figure out if the model is there, otherwise, we have to use the default path supplied by user.
-		if whichdb(path):
-			md=loadmodel(path)
+		if whichdb(path1):
+			md=loadmodel(path1)
 			return md
+                elif whichdb(path2):
+                        md=loadmodel(path2)
+                        return md
 
 		#If we are here, the model has not been found. Try trunk prefix if provided
 		if self.trunkprefix:
@@ -114,7 +118,7 @@
 				md=loadmodel(path2)
 				return md
 		else:
-			raise IOError("Could not find '%s'" % path)
+			raise IOError("Could not find '%s'" % path1)
 	#}}}
 	def perform(self,string):    # {{{
 
@@ -160,6 +164,8 @@
 
 		if (name=='default'):
 			name=os.path.join(self.repository,self.prefix+'.step#'+self.steps[self._currentstep-1]['string']+'.python')
+                else:
+                    name=os.path.join(self.repository,name)
 		print "saving model as: '%s'" % name
 
 		#check that md is a model

Modified: issm/trunk/src/m/classes/outputdefinition.m
===================================================================
--- issm/trunk/src/m/classes/outputdefinition.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/classes/outputdefinition.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -8,15 +8,6 @@
 		definitions                 = {};
 	end
 	methods
-	   function createxml(self,fid) % {{{
-            fprintf(fid, '<!-- outputdefinition -->\n');            
-                    
-            % outputdefinition solution parameters
-            fprintf(fid,'%s\n%s\n%s\n','<frame key="1" label="outputdefinition">','<section name="outputdefinition" />');                    
-                fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="definitions" type="',class(self.definitions),'" default="',convert2str(self.definitions),'">','     <section name="outputdefinition" />','     <help> list of potential outputs that can be requested, but which need additional data to be defined </help>','  </parameter>');
-            fprintf(fid,'%s\n%s\n','</frame>');    
-        
-        end % }}}
 		function self = outputdefinition(varargin) % {{{
 			switch nargin
 				case 0
@@ -57,5 +48,13 @@
 		
 		WriteData(fid,'data',enums,'enum',OutputdefinitionListEnum(),'format','DoubleMat','mattype',1);
 		end % }}}
+		function savemodeljs(self,fid,modelname) % {{{
+
+			fprintf(fid,'%s.outputdefinition.definitions=[];\n',modelname);
+			if ~isempty(self.definitions),
+				error('outputdefinition savemodeljs error message: not supported yet!');
+			end
+
+		end % }}}
 	end
 end

Modified: issm/trunk/src/m/classes/pairoptions.m
===================================================================
--- issm/trunk/src/m/classes/pairoptions.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/classes/pairoptions.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -218,6 +218,47 @@
 				error(['error message: field ' field ' has not been provided by user (and no default value has been specified)'])
 			end
 		end % }}}
+		function values = getfieldvalues(self,field,varargin), % {{{
+		%GETOPTION - get the value of an option (if the option is repeated, return multiple values)
+		%
+		%   Usage:
+		%      values=getfieldvalues(self,field,varargin)
+		%
+		%   Find all option values from a field. Default options
+		%   can be given in input if the field does not exist
+		%
+		%   Examples:
+		%      values=getfieldvalue(options,'caxis');
+		%      values=getfieldvalue(options,'caxis',{[0 2],[3 4]});
+
+			%some argument checking: 
+			if nargin~=2 && nargin~=3,
+				help getfieldvalues
+				error('getfieldvalues error message: bad usage');
+			end
+
+			if ~ischar(field),
+				error('getfieldvalues error message: field should be a string');
+			end
+
+			%Recover options
+			pos=find(strcmpi(self.list(:,1),field));
+			if ~isempty(pos),
+				values={};
+				for i=1:length(pos),
+					values{i}=self.list{pos(i),2};
+					self.list{pos(i),3}=true;  % option used
+				end
+				return;
+			end
+
+			%The option has not been found, output default if provided
+			if nargin==3,
+				values=varargin{1};
+			else
+				error(['error message: field ' field ' has not been provided by user (and no default value has been specified)'])
+			end
+		end % }}}
 		function self = removefield(self,field,warn)% {{{
 		%REMOVEFIELD - delete a field in an option list
 		%

Modified: issm/trunk/src/m/classes/private.m
===================================================================
--- issm/trunk/src/m/classes/private.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/classes/private.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -34,5 +34,13 @@
 			fielddisplay(self,'solution','type of solution launched');
 
 		end % }}}
+		function savemodeljs(self,fid,modelname) % {{{
+		
+			writejsdouble(fid,[modelname '.priv.isconsistent'],self.isconsistent);
+			writejsstring(fid,[modelname '.priv.runtimename'],self.runtimename);
+			writejsstring(fid,[modelname '.priv.solution'],self.solution);
+			%no bamg 
+
+		end % }}}
 	end
 end

Modified: issm/trunk/src/m/classes/qmu.m
===================================================================
--- issm/trunk/src/m/classes/qmu.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/classes/qmu.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -23,35 +23,6 @@
 		vertex_weight               = NaN;
 	end
 	methods
-		function createxml(self,fid) % {{{
-			fprintf(fid, '<!-- qmu -->\n');            
-
-			% qmu solution parameters
-			fprintf(fid,'%s\n%s\n%s\n','<frame key="1" label="qmu parameters">','<section name="qmu" />');                    
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="isdakota" type="',class(self.isdakota),'" default="',convert2str(self.isdakota),'">','     <section name="qmu" />','     <help> is qmu analysis activated? </help>','  </parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="variables" type="',class(self.variables),'" default="',convert2str(self.variables),'">','     <section name="qmu" />','     <help> (arrays of each variable class) </help>','  </parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="responses" type="',class(self.responses),'" default="',convert2str(self.responses),'">','     <section name="qmu" />','     <help> (arrays of each response class) </help>','  </parameter>');
-
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="numberofresponses" type="',class(self.numberofresponses),'" default="',convert2str(self.numberofresponses),'">','     <section name="qmu" />','     <help> number of responses </help>','  </parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="params" type="',class(self.params),'" default="',convert2str(self.params),'">','     <section name="qmu" />','     <help> (array of method-independent parameters)  </help>','  </parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="results" type="',class(self.results),'" default="',convert2str(self.results),'">','     <section name="qmu" />','     <help> (information from dakota files) </help>','  </parameter>');
-
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="partition" type="',class(self.partition),'" default="',convert2str(self.partition),'">','     <section name="qmu" />','     <help> user provided mesh partitioning, defaults to metis if not specified </help>','  </parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="numberofpartitions" type="',class(self.numberofpartitions),'" default="',convert2str(self.numberofpartitions),'">','     <section name="qmu" />','     <help> number of partitions for semi-discrete qmu  </help>','  </parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="variabledescriptors" type="',class(self.variabledescriptors),'" default="',convert2str(self.variabledescriptors),'">','     <section name="qmu" />','     <help>  </help>','  </parameter>');
-
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="responsedescriptors" type="',class(self.responsedescriptors),'" default="',convert2str(self.responsedescriptors),'">','     <section name="qmu" />','     <help> use an enthalpy formulation to include temperate ice (default is 0) </help>','  </parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="method" type="',class(self.method),'" default="',convert2str(self.method),'">','     <section name="qmu" />','     <help> array of dakota_method class </help>','  </parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="mass_flux_profile_directory" type="',class(self.mass_flux_profile_directory),'" default="',convert2str(self.mass_flux_profile_directory),'">','     <section name="qmu" />','     <help> directory for mass flux profiles </help>','  </parameter>');
-
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="mass_flux_profiles" type="',class(self.mass_flux_profiles),'" default="',convert2str(self.mass_flux_profiles),'">','     <section name="qmu" />','     <help>  </help>','  </parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="mass_flux_segments" type="',class(self.mass_flux_segments),'" default="',convert2str(self.mass_flux_segments),'">','     <section name="qmu" />','     <help>  </help>','  </parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="adjacency" type="',class(self.adjacency),'" default="',convert2str(self.adjacency),'">','     <section name="qmu" />','     <help> additional outputs requested </help>','  </parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="vertex_weight" type="',class(self.vertex_weight),'" default="',convert2str(self.vertex_weight),'">','     <section name="qmu" />','     <help> weight applied to each mesh vertex </help>','  </parameter>');
-
-			fprintf(fid,'%s\n%s\n','</frame>');    
-
-		end % }}}        
 		function self = extrude(self,md) % {{{
 			self.partition=project3d(md,'vector',self.partition','type','node');
 		end % }}}
@@ -71,8 +42,26 @@
 			%Early return
 			if ~md.qmu.isdakota, return; end
 
-			if md.qmu.params.evaluation_concurrency~=1,
-				md = checkmessage(md,['concurrency should be set to 1 when running dakota in library mode']);
+			version=IssmConfig('_DAKOTA_VERSION_'); version=str2num(version(1:3));
+
+			if version < 6,
+				if md.qmu.params.evaluation_concurrency~=1,
+					md = checkmessage(md,['concurrency should be set to 1 when running dakota in library mode']);
+				end
+			else
+				if ~strcmpi(self.params.evaluation_scheduling,'master'),
+					md = checkmessage(md,['evaluation_scheduling in qmu.params should be set to ''master''']);
+				end
+				if md.cluster.np<=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.cluser.np accordingly.']);
+				end
+					
+				if self.params.processors_per_evaluation<1,
+					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), 
+					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
 			end
 			if ~isempty(md.qmu.partition),
 				if numel(md.qmu.partition)~=md.mesh.numberofvertices,
@@ -190,5 +179,12 @@
 			end
 			WriteData(fid,'data',flag,'enum',QmuMassFluxSegmentsPresentEnum,'format','Boolean');
 		end % }}}
+		function savemodeljs(self,fid,modelname) % {{{
+		
+			if self.isdakota,
+				error('qmu savemodeljs error message: not supported yet!');
+			end
+
+		end % }}}
 	end
 end

Modified: issm/trunk/src/m/classes/radaroverlay.m
===================================================================
--- issm/trunk/src/m/classes/radaroverlay.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/classes/radaroverlay.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -8,6 +8,10 @@
 		pwr = NaN;
 		x   = NaN;
 		y   = NaN;
+		outerindex = NaN;
+		outerx = NaN;
+		outery = NaN;
+		outerheight = NaN;
 	end
 	methods
 		function self = radaroverlay(varargin) % {{{
@@ -27,7 +31,23 @@
 			fielddisplay(self,'pwr','radar power image (matrix)');
 			fielddisplay(self,'x','corresponding x coordinates [m]');
 			fielddisplay(self,'y','corresponding y coordinates [m]');
+			fielddisplay(self,'outerindex','outer triangulation corresponding to space between mesh and the bounding box');
+			fielddisplay(self,'outerx','outer x corresponding to space between mesh and the bounding box');
+			fielddisplay(self,'outery','outer y corresponding to space between mesh and the bounding box');
+			fielddisplay(self,'outerheight','outer height corresponding to space between mesh and the bounding box');
 
 		end % }}}
+		function savemodeljs(self,fid,modelname) % {{{
+		
+			if ~isnan(self.pwr),
+				writejs1Darray(fid,[modelname '.radaroverlay.xlim'],[min(self.x) max(self.x)]);
+				writejs1Darray(fid,[modelname '.radaroverlay.ylim'],[min(self.y) max(self.y)]);
+				writejs2Darray(fid,[modelname '.radaroverlay.outerindex'],self.outerindex);
+				writejs1Darray(fid,[modelname '.radaroverlay.outerx'],self.outerx);
+				writejs1Darray(fid,[modelname '.radaroverlay.outery'],self.outery);
+				writejs1Darray(fid,[modelname '.radaroverlay.outerheight'],self.outerheight)
+			end
+
+		end % }}}
 	end
 end

Modified: issm/trunk/src/m/classes/rifts.m
===================================================================
--- issm/trunk/src/m/classes/rifts.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/classes/rifts.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -9,13 +9,6 @@
 		riftproperties = NaN;
 	end
 	methods
-        function createxml(self,fid) % {{{
-            fprintf(fid, '\n\n');
-            fprintf(fid, '%s\n', '<!-- rifts -->');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',    '<parameter key ="riftstruct" type="',              class(self.riftstruct),'" default="',                  self.riftstruct,'">',              '     <section name="rifts" />','     <help> structure containing all rift information (vertices coordinates, segments, type of melange, ...) </help>','</parameter>');
-            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',    '<parameter key ="riftproperties" type="',            class(self.riftproperties),'" default="',                self.riftproperties,'">',   '     <section name="rifts" />','     <help> N/A </help>','</parameter>');
-    
-        end % }}}
 		function self = rifts(varargin) % {{{
 			switch nargin
 				case 0
@@ -90,5 +83,18 @@
 			WriteData(fid,'data',numrifts,'enum',RiftsNumriftsEnum(),'format','Integer');
 			WriteData(fid,'data',data,'enum',RiftsRiftstructEnum(),'format','DoubleMat','mattype',3);
 		end % }}}
+		function savemodeljs(self,fid,modelname) % {{{
+	
+			if isempty(self.riftstruct) | isnans(self.riftstruct),
+				numrifts=0;
+			else
+				numrifts=numel(self.riftstruct);
+			end
+			
+			if numrifts,
+				error('rifts savemodeljs error message: not supported yet!');
+			end
+	
+		end % }}}
 	end
 end

Modified: issm/trunk/src/m/classes/settings.m
===================================================================
--- issm/trunk/src/m/classes/settings.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/classes/settings.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -9,6 +9,7 @@
 		io_gather           = 0;
 		lowmem              = 0;
 		output_frequency    = 0;
+		recording_frequency   = 0;
 		waitonlock          = 0;
 		upload_server       = '';
 		upload_path         = '';
@@ -18,26 +19,6 @@
 
 	end
 	methods
-        function createxml(self,fid) % {{{
-            fprintf(fid, '\n\n');
-            fprintf(fid, '%s\n', '<!-- settings -->');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',    '<parameter key ="results_on_nodes" type="',      class(self.results_on_nodes),'" default="',        convert2str(self.results_on_nodes),'">',	'     <section name="settings" />','     <help> results are output for all the nodes of each element </help>','</parameter>');
-            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',    '<parameter key ="io_gather" type="',          class(self.io_gather),'" default="',           convert2str(self.io_gather),'">',     '     <section name="settings" />','     <help> I/O gathering strategy for result outputs (default 1) </help>','</parameter>');
-            
-            % lowmen drop-down (0 or 1)
-            fprintf(fid,'%s\n%s\n%s\n%s\n',	'<parameter key ="lowmem" type="alternative" optional="true">',	'     <section name="settings" />','     <help> is the memory limited ? (0 or 1) </help>');
-            fprintf(fid,'%s\n','       <option value="0" type="string" default="true"> </option>');
-            fprintf(fid,'%s\n%s\n','       <option value="1" type="string" default="false"> </option>','</parameter>');
-
-            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',    '<parameter key ="output_frequency" type="',          class(self.output_frequency),'" default="',           convert2str(self.output_frequency),'">',	'     <section name="settings" />','     <help> frequency at which results are saved in all solutions with multiple time_steps </help>','</parameter>');
-            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',    '<parameter key ="waitonlock" type="',  	class(self.waitonlock),'" default="',      convert2str(self.waitonlock),'">',     '     <section name="settings" />','     <help> maximum number of minutes to wait for batch results (NaN to deactivate) </help>','</parameter>');
-            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',    '<parameter key ="upload_server" type="',         class(self.upload_server),'" default="',          convert2str(self.upload_server),'">',	'     <section name="settings" />','     <help> server hostname where model should be uploaded </help>','</parameter>');
-            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',    '<parameter key ="upload_path" type="',             class(self.upload_path),'" default="',              convert2str(self.upload_path),'">',     '     <section name="settings" />','     <help> path on server where model should be uploaded </help>','</parameter>');
-            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',    '<parameter key ="upload_login" type="',        class(self.upload_login),'" default="',         convert2str(self.upload_login),'">',	'     <section name="settings" />','     <help> server login </help>','</parameter>');
-            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',    '<parameter key ="upload_port" type="',    	class(self.upload_port),'" default="',      convert2str(self.upload_port),'">',     '     <section name="settings" />','     <help> port login (default is 0) </help>','</parameter>');
-            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n',    	'<parameter key ="upload_filename" type="',         class(self.upload_filename),'" default="',          convert2str(self.upload_filename),'">',	'     <section name="settings" />','     <help> unique id generated when uploading the file to server </help>','</parameter>');
-             
-        end % }}}
 		function self = settings(varargin) % {{{
 			switch nargin
 				case 0
@@ -57,6 +38,9 @@
 			%results frequency by default every step
 			self.output_frequency=1;
 
+			%checkpoints frequency, by default never: 
+			self.recording_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
@@ -73,6 +57,7 @@
 			md = checkfield(md,'fieldname','settings.io_gather','numel',[1],'values',[0 1]);
 			md = checkfield(md,'fieldname','settings.lowmem','numel',[1],'values',[0 1]);
 			md = checkfield(md,'fieldname','settings.output_frequency','numel',[1],'>=',1);
+			md = checkfield(md,'fieldname','settings.recording_frequency','numel',[1],'>=',0);
 			md = checkfield(md,'fieldname','settings.waitonlock','numel',[1]);
 
 		end % }}}
@@ -83,6 +68,7 @@
 			fielddisplay(self,'io_gather','I/O gathering strategy for result outputs (default 1)');
 			fielddisplay(self,'lowmem','is the memory limited ? (0 or 1)');
 			fielddisplay(self,'output_frequency','frequency at which results are saved in all solutions with multiple time_steps');
+			fielddisplay(self,'recording_frequency','frequency at which the runs are being recorded, allowing for a restart');
 			fielddisplay(self,'waitonlock','maximum number of minutes to wait for batch results (NaN to deactivate)');
 			fielddisplay(self,'upload_server','server hostname where model should be uploaded');
 			fielddisplay(self,'upload_path','path on server where model should be uploaded');
@@ -96,11 +82,27 @@
 			WriteData(fid,'object',self,'fieldname','io_gather','format','Boolean');
 			WriteData(fid,'object',self,'fieldname','lowmem','format','Boolean');
 			WriteData(fid,'object',self,'fieldname','output_frequency','format','Integer');
+			WriteData(fid,'object',self,'fieldname','recording_frequency','format','Integer');
 			if self.waitonlock>0,
 				WriteData(fid,'enum',SettingsWaitonlockEnum(),'data',true,'format','Boolean');
 			else
 				WriteData(fid,'enum',SettingsWaitonlockEnum(),'data',false,'format','Boolean');
 			end
 		end % }}}
+		function savemodeljs(self,fid,modelname) % {{{
+		
+			writejsdouble(fid,[modelname '.settings.results_on_nodes'],self.results_on_nodes);
+			writejsdouble(fid,[modelname '.settings.io_gather'],self.io_gather);
+			writejsdouble(fid,[modelname '.settings.lowmem'],self.lowmem);
+			writejsdouble(fid,[modelname '.settings.output_frequency'],self.output_frequency);
+			writejsdouble(fid,[modelname '.settings.recording_frequency'],self.recording_frequency);
+			writejsdouble(fid,[modelname '.settings.waitonlock'],self.waitonlock);
+			writejsstring(fid,[modelname '.settings.upload_server'],self.upload_server);
+			writejsstring(fid,[modelname '.settings.upload_path'],self.upload_path);
+			writejsstring(fid,[modelname '.settings.upload_login'],self.upload_login);
+			writejsdouble(fid,[modelname '.settings.upload_port'],self.upload_port);
+			writejsstring(fid,[modelname '.settings.upload_filename'],self.upload_filename);
+
+		end % }}}
 	end
 end

Modified: issm/trunk/src/m/classes/settings.py
===================================================================
--- issm/trunk/src/m/classes/settings.py	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/classes/settings.py	2016-04-13 04:32:01 UTC (rev 20500)
@@ -16,6 +16,7 @@
 		self.io_gather           = 0
 		self.lowmem              = 0
 		self.output_frequency    = 0
+		self.recording_frequency    = 0
 		self.waitonlock          = 0
 
 		#set defaults
@@ -29,6 +30,7 @@
 		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,"recording_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"))
 		return string
 		#}}}
@@ -43,6 +45,10 @@
 		#results frequency by default every step
 		self.output_frequency=1
 
+		#checkpoints frequency, by default never: 
+		self.recording_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
@@ -56,6 +62,7 @@
 		md = checkfield(md,'fieldname','settings.io_gather','numel',[1],'values',[0,1])
 		md = checkfield(md,'fieldname','settings.lowmem','numel',[1],'values',[0,1])
 		md = checkfield(md,'fieldname','settings.output_frequency','numel',[1],'>=',1)
+		md = checkfield(md,'fieldname','settings.recording_frequency','numel',[1],'>=',0)
 		md = checkfield(md,'fieldname','settings.waitonlock','numel',[1])
 
 		return md
@@ -65,6 +72,7 @@
 		WriteData(fid,'object',self,'fieldname','io_gather','format','Boolean')
 		WriteData(fid,'object',self,'fieldname','lowmem','format','Boolean')
 		WriteData(fid,'object',self,'fieldname','output_frequency','format','Integer')
+		WriteData(fid,'object',self,'fieldname','recording_frequency','format','Integer')
 		if self.waitonlock>0:
 			WriteData(fid,'enum',SettingsWaitonlockEnum(),'data',True,'format','Boolean');
 		else:

Modified: issm/trunk/src/m/classes/spheremesh.m
===================================================================
--- issm/trunk/src/m/classes/spheremesh.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/classes/spheremesh.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -40,13 +40,13 @@
 		end % }}}
 		function md = checkconsistency(self,md,solution,analyses) % {{{
 
-			md = checkfield(md,'fieldname','spheremesh.x','NaN',1,'size',[md.spheremesh.numberofvertices 1]);
-			md = checkfield(md,'fieldname','spheremesh.y','NaN',1,'size',[md.spheremesh.numberofvertices 1]);
-			md = checkfield(md,'fieldname','spheremesh.z','NaN',1,'size',[md.spheremesh.numberofvertices 1]);
-			md = checkfield(md,'fieldname','spheremesh.r','NaN',1,'size',[md.spheremesh.numberofvertices 1]);
-			md = checkfield(md,'fieldname','spheremesh.theta','NaN',1,'size',[md.spheremesh.numberofvertices 1]);
-			md = checkfield(md,'fieldname','spheremesh.phi','NaN',1,'size',[md.spheremesh.numberofvertices 1]);
-			md = checkfield(md,'fieldname','spheremesh.elements','NaN',1,'>',0,'values',1:md.spheremesh.numberofvertices);
+			md = checkfield(md,'fieldname','spheremesh.x','NaN',1,'Inf',1,'size',[md.spheremesh.numberofvertices 1]);
+			md = checkfield(md,'fieldname','spheremesh.y','NaN',1,'Inf',1,'size',[md.spheremesh.numberofvertices 1]);
+			md = checkfield(md,'fieldname','spheremesh.z','NaN',1,'Inf',1,'size',[md.spheremesh.numberofvertices 1]);
+			md = checkfield(md,'fieldname','spheremesh.r','NaN',1,'Inf',1,'size',[md.spheremesh.numberofvertices 1]);
+			md = checkfield(md,'fieldname','spheremesh.theta','NaN',1,'Inf',1,'size',[md.spheremesh.numberofvertices 1]);
+			md = checkfield(md,'fieldname','spheremesh.phi','NaN',1,'Inf',1,'size',[md.spheremesh.numberofvertices 1]);
+			md = checkfield(md,'fieldname','spheremesh.elements','NaN',1,'Inf',1,'>',0,'values',1:md.spheremesh.numberofvertices);
 			md = checkfield(md,'fieldname','spheremesh.elements','size',[md.spheremesh.numberofelements 3]);
 			if any(~ismember(1:md.spheremesh.numberofvertices,sort(unique(md.spheremesh.elements(:)))));
 				md = checkmessage(md,'orphan nodes have been found. Check the spheremesh outline');
@@ -54,7 +54,7 @@
 			md = checkfield(md,'fieldname','spheremesh.numberoflayers','>=',0);
 			md = checkfield(md,'fieldname','spheremesh.numberofelements','>',0);
 			md = checkfield(md,'fieldname','spheremesh.numberofvertices','>',0);
-			md = checkfield(md,'fieldname','spheremesh.elementconnectivity','size',[md.spheremesh.numberofelements 3],'NaN',1);
+			md = checkfield(md,'fieldname','spheremesh.elementconnectivity','size',[md.spheremesh.numberofelements 3],'NaN',1,'Inf',1);
 		end % }}}
 		function disp(self) % {{{
 			disp(sprintf('   Mesh:')); 

Modified: issm/trunk/src/m/classes/steadystate.m
===================================================================
--- issm/trunk/src/m/classes/steadystate.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/classes/steadystate.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -10,17 +10,6 @@
 		requested_outputs = {};
 	end
 	methods
-        function createxml(self,fid) % {{{
-            fprintf(fid, '<!-- steadystate -->\n');            
-                    
-            % steadystate solution parameters
-            fprintf(fid,'%s\n%s\n%s\n','<frame key="1" label="steadystate solution parameters">','<section name="steadystate" />');                    
-                fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="reltol" type="',class(self.reltol),'" default="',convert2str(self.reltol),'">','     <section name="steadystate" />','     <help> relative tolerance criterion [K] </help>','  </parameter>');
-                fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="maxiter" type="',class(self.maxiter),'" default="',convert2str(self.maxiter),'">','     <section name="steadystate" />','     <help> maximum number of iterations </help>','  </parameter>');
-                fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="requested_outputs" type="',class(self.requested_outputs),'" default="',convert2str(self.requested_outputs),'">','     <section name="steadystate" />','     <help> additional requested outputs </help>','  </parameter>');
-            fprintf(fid,'%s\n%s\n','</frame>');    
-        
-        end % }}}
 		function self = steadystate(varargin) % {{{
 			switch nargin
 				case 0
@@ -79,5 +68,12 @@
 			end
 			WriteData(fid,'data',outputs,'enum',SteadystateRequestedOutputsEnum,'format','StringArray');
 		end % }}}
+		function savemodeljs(self,fid,modelname) % {{{
+		
+			writejsdouble(fid,[modelname '.steadystate.reltol'],self.reltol);
+			writejsdouble(fid,[modelname '.steadystate.maxiter'],self.maxiter);
+			writejscellstring(fid,[modelname '.steadystate.requested_outputs'],self.requested_outputs);
+
+		end % }}}
 	end
 end

Modified: issm/trunk/src/m/classes/stressbalance.m
===================================================================
--- issm/trunk/src/m/classes/stressbalance.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/classes/stressbalance.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -25,50 +25,6 @@
 		requested_outputs      = {};
 	end
 	methods
-		function createxml(self,fid) % {{{
-			fprintf(fid, '\n\n');
-			fprintf(fid, '%s\n', '<!-- StressBalance solution parameters: -->');
-
-			% Convergence criteria            
-			fprintf(fid,'%s\n%s\n%s\n','<frame key="1" label="Convergence criteria">','<section name="stressbalance" />'); 
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',    '<parameter key ="restol" type="',      class(self.restol),'" default="',        convert2str(self.restol),'">',	'     <section name="stressbalance" />','     <help> mechanical equilibrium residual convergence criterion </help>','</parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',    '<parameter key ="reltol" type="',          class(self.reltol),'" default="',            convert2str(self.reltol),'">',     '     <section name="stressbalance" />','     <help> velocity relative convergence criterion, NaN: not applied </help>','</parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',	'<parameter key ="abstol" type="',        class(self.abstol),'" default="',          convert2str(self.abstol),'">',	'     <section name="stressbalance" />','     <help> velocity absolute convergence criterion, NaN: not applied </help>','</parameter>');
-
-			%is newton drop-down (0,1,or 2)
-			fprintf(fid,'%s\n%s\n%s\n%s\n',    '<parameter key ="isnewton" type="alternative" optional="false">',	'     <section name="stressbalance" />','     <help> 0: Picards fixed point, 1: Newtons method, 2: hybrid </help>');
-			fprintf(fid,'%s\n','       <option value="0" type="string" default="true"> </option>');
-			fprintf(fid,'%s\n','       <option value="1" type="string" default="false"> </option>');
-			fprintf(fid,'%s\n%s\n','       <option value="2" type="string" default="false"> </option>','</parameter>');
-
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',    '<parameter key ="maxiter" type="',  	class(self.maxiter),'" default="',       convert2str(self.maxiter),'">',     '     <section name="stressbalance" />','     <help> maximum number of nonlinear iterations </help>','</parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',    '<parameter key ="viscosity_overshoot" type="',         class(self.viscosity_overshoot),'" default="',           convert2str(self.viscosity_overshoot),'">',	'     <section name="stressbalance" />','     <help> over-shooting constant new=new+C*(new-old) </help>','</parameter>');
-			fprintf(fid,'%s\n%s\n','</frame>');
-
-			% boundary conditions    
-			fprintf(fid,'%s\n%s\n%s\n','<frame key="2" label="Boundary conditions">','<section name="stressbalance" />'); 			 
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',    '<parameter key ="spcvx" type="',     	class(self.spcvx),'" default="',    	convert2str(self.spcvx),'">',     '     <section name="stressbalance" />','     <help> x-axis velocity constraint (NaN means no constraint) [m/yr] </help>','</parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',    '<parameter key ="spcvy" type="',     	class(self.spcvy),'" default="',    	convert2str(self.spcvy),'">',	'     <section name="stressbalance" />','     <help> y-axis velocity constraint (NaN means no constraint) [m/yr] </help>','</parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',    '<parameter key ="spcvz" type="',    	class(self.spcvz),'" default="',    	convert2str(self.spcvz),'">',     '     <section name="stressbalance" />','     <help> z-axis velocity constraint (NaN means no constraint) [m/yr] </help>','</parameter>');
-			fprintf(fid,'%s\n%s\n','</frame>');
-
-			% Rift options   
-			fprintf(fid,'%s\n%s\n%s\n','<frame key="3" label="Rift options">','<section name="stressbalance" />'); 	
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',    '<parameter key ="rift_penalty_threshold" type="',    	class(self.rift_penalty_threshold),'" default="',       convert2str(self.rift_penalty_threshold),'">',     '     <section name="stressbalance" />','     <help> threshold for instability of mechanical constraints </help>','</parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',    	'<parameter key ="rift_penalty_lock" type="',         class(self.rift_penalty_lock),'" default="',           convert2str(self.rift_penalty_lock),'">',	'     <section name="stressbalance" />','     <help> number of iterations before rift penalties are locked </help>','</parameter>');
-			fprintf(fid,'%s\n%s\n','</frame>'); 
-
-			%others
-			fprintf(fid,'%s\n%s\n%s\n','<frame key="4" label="Other">','<section name="stressbalance" />'); 	
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',    '<parameter key ="shelf_dampening" type="',  	class(self.shelf_dampening),'" default="',       convert2str(self.shelf_dampening),'">',     '     <section name="stressbalance" />','     <help> use dampening for floating ice ? Only for FS model </help>','</parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',  	'<parameter key ="FSreconditioning" type="', 	class(self.FSreconditioning),'" default="',           convert2str(self.FSreconditioning),'">',	'     <section name="stressbalance" />','     <help> multiplier for incompressibility equation. Only for FS model </help>','</parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',    '<parameter key ="referential" type="',  	class(self.referential),'" default="',       convert2str(self.referential),'">',     '     <section name="stressbalance" />','     <help> local referential </help>','</parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',  	'<parameter key ="loadingforce" type="', 	class(self.loadingforce),'" default="',           convert2str(self.loadingforce),'">',	'     <section name="stressbalance" />','     <help> loading force applied on each point [N/m^3] </help>','</parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',    '<parameter key ="requested_outputs" type="',  	class(self.requested_outputs),'" default="',       convert2str(self.requested_outputs),'">',     '     <section name="stressbalance" />','     <help> additional outputs requested </help>','</parameter>');
-
-
-			fprintf(fid,'%s\n%s\n','</frame>'); 
-		end % }}}
 		function self = extrude(self,md) % {{{
 			self.spcvx=project3d(md,'vector',self.spcvx,'type','node');
 			self.spcvy=project3d(md,'vector',self.spcvy,'type','node');
@@ -132,16 +88,17 @@
 
 			%Early return
 			if ~ismember(StressbalanceAnalysisEnum(),analyses), return; end
+			if (solution==TransientSolutionEnum & md.transient.isstressbalance == 0), return; end
 
-			md = checkfield(md,'fieldname','stressbalance.spcvx','timeseries',1);
-			md = checkfield(md,'fieldname','stressbalance.spcvy','timeseries',1);
-			md = checkfield(md,'fieldname','stressbalance.spcvz','timeseries',1);
-			md = checkfield(md,'fieldname','stressbalance.restol','size',[1 1],'>',0,'NaN',1);
+			md = checkfield(md,'fieldname','stressbalance.spcvx','Inf',1,'timeseries',1);
+			md = checkfield(md,'fieldname','stressbalance.spcvy','Inf',1,'timeseries',1);
+			md = checkfield(md,'fieldname','stressbalance.spcvz','Inf',1,'timeseries',1);
+			md = checkfield(md,'fieldname','stressbalance.restol','size',[1 1],'>',0,'NaN',1,'Inf',1);
 			md = checkfield(md,'fieldname','stressbalance.reltol','size',[1 1]);
 			md = checkfield(md,'fieldname','stressbalance.abstol','size',[1 1]);
 			md = checkfield(md,'fieldname','stressbalance.isnewton','numel',[1],'values',[0 1 2]);
-			md = checkfield(md,'fieldname','stressbalance.FSreconditioning','size',[1 1],'NaN',1);
-			md = checkfield(md,'fieldname','stressbalance.viscosity_overshoot','size',[1 1],'NaN',1);
+			md = checkfield(md,'fieldname','stressbalance.FSreconditioning','size',[1 1],'NaN',1,'Inf',1);
+			md = checkfield(md,'fieldname','stressbalance.viscosity_overshoot','size',[1 1],'NaN',1,'Inf',1);
 			md = checkfield(md,'fieldname','stressbalance.maxiter','size',[1 1],'>=',1);
 			md = checkfield(md,'fieldname','stressbalance.referential','size',[md.mesh.numberofvertices 6]);
 			md = checkfield(md,'fieldname','stressbalance.loadingforce','size',[md.mesh.numberofvertices 3]);
@@ -149,7 +106,7 @@
 
 			%singular solution
 			if ((~(any(~isnan(md.stressbalance.spcvx)) | any(~isnan(md.stressbalance.spcvy)))) & ~any(md.mask.groundedice_levelset>0)),
-				md = checkmessage(md,['model is not well posed (singular). You need at least one node with fixed velocity!']);
+				disp(sprintf('\n !!! Warning: no spc applied, model might not be well posed if no basal friction is applied, check for solution crash\n'));
 			end
 			%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),
@@ -237,9 +194,11 @@
 			WriteData(fid,'object',self,'class','stressbalance','fieldname','rift_penalty_threshold','format','Integer');
 			WriteData(fid,'object',self,'class','stressbalance','fieldname','referential','format','DoubleMat','mattype',1);
 
-			WriteData(fid,'data',self.loadingforce(:,1),'format','DoubleMat','mattype',1,'enum',LoadingforceXEnum);
-			WriteData(fid,'data',self.loadingforce(:,2),'format','DoubleMat','mattype',1,'enum',LoadingforceYEnum);
-			WriteData(fid,'data',self.loadingforce(:,3),'format','DoubleMat','mattype',1,'enum',LoadingforceZEnum);
+			if size(self.loadingforce,2)==3,
+				WriteData(fid,'data',self.loadingforce(:,1),'format','DoubleMat','mattype',1,'enum',LoadingforceXEnum);
+				WriteData(fid,'data',self.loadingforce(:,2),'format','DoubleMat','mattype',1,'enum',LoadingforceYEnum);
+				WriteData(fid,'data',self.loadingforce(:,3),'format','DoubleMat','mattype',1,'enum',LoadingforceZEnum);
+			end
 
 			%process requested outputs
 			outputs = self.requested_outputs;
@@ -250,5 +209,27 @@
 			end
 			WriteData(fid,'data',outputs,'enum',StressbalanceRequestedOutputsEnum,'format','StringArray');
 		end % }}}
+		function savemodeljs(self,fid,modelname) % {{{
+		
+			writejs1Darray(fid,[modelname '.stressbalance.spcvx'],self.spcvx);
+			writejs1Darray(fid,[modelname '.stressbalance.spcvy'],self.spcvy);
+			writejs1Darray(fid,[modelname '.stressbalance.spcvz'],self.spcvz);
+			writejsdouble(fid,[modelname '.stressbalance.restol'],self.restol);
+			writejsdouble(fid,[modelname '.stressbalance.reltol'],self.reltol);
+			writejsdouble(fid,[modelname '.stressbalance.abstol'],self.abstol);
+			writejsdouble(fid,[modelname '.stressbalance.isnewton'],self.isnewton);
+			writejsdouble(fid,[modelname '.stressbalance.FSreconditioning'],self.FSreconditioning);
+			writejsdouble(fid,[modelname '.stressbalance.viscosity_overshoot'],self.viscosity_overshoot);
+			writejsdouble(fid,[modelname '.stressbalance.maxiter'],self.maxiter);
+			writejsdouble(fid,[modelname '.stressbalance.shelf_dampening'],self.shelf_dampening);
+			writejs1Darray(fid,[modelname '.stressbalance.vertex_pairing'],self.vertex_pairing);
+			writejsdouble(fid,[modelname '.stressbalance.penalty_factor'],self.penalty_factor);
+			writejsdouble(fid,[modelname '.stressbalance.rift_penalty_lock'],self.rift_penalty_lock);
+			writejsdouble(fid,[modelname '.stressbalance.rift_penalty_threshold'],self.rift_penalty_threshold);
+			writejs2Darray(fid,[modelname '.stressbalance.referential'],self.referential);
+			writejs2Darray(fid,[modelname '.stressbalance.loadingforce'],self.loadingforce);
+			writejscellstring(fid,[modelname '.stressbalance.requested_outputs'],self.requested_outputs);
+
+		end % }}}
 	end
 end

Modified: issm/trunk/src/m/classes/stressbalance.py
===================================================================
--- issm/trunk/src/m/classes/stressbalance.py	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/classes/stressbalance.py	2016-04-13 04:32:01 UTC (rev 20500)
@@ -132,16 +132,16 @@
 		if StressbalanceAnalysisEnum() not in analyses:
 			return md
 
-		md = checkfield(md,'fieldname','stressbalance.spcvx','timeseries',1)
-		md = checkfield(md,'fieldname','stressbalance.spcvy','timeseries',1)
+		md = checkfield(md,'fieldname','stressbalance.spcvx','Inf',1,'timeseries',1)
+		md = checkfield(md,'fieldname','stressbalance.spcvy','Inf',1,'timeseries',1)
 		if m.strcmp(md.mesh.domaintype(),'3D'):
-			md = checkfield(md,'fieldname','stressbalance.spcvz','timeseries',1)
+			md = checkfield(md,'fieldname','stressbalance.spcvz','Inf',1,'timeseries',1)
 		md = checkfield(md,'fieldname','stressbalance.restol','size',[1],'>',0)
 		md = checkfield(md,'fieldname','stressbalance.reltol','size',[1])
 		md = checkfield(md,'fieldname','stressbalance.abstol','size',[1])
 		md = checkfield(md,'fieldname','stressbalance.isnewton','numel',[1],'values',[0,1,2])
-		md = checkfield(md,'fieldname','stressbalance.FSreconditioning','size',[1],'NaN',1)
-		md = checkfield(md,'fieldname','stressbalance.viscosity_overshoot','size',[1],'NaN',1)
+		md = checkfield(md,'fieldname','stressbalance.FSreconditioning','size',[1],'NaN',1,'Inf',1)
+		md = checkfield(md,'fieldname','stressbalance.viscosity_overshoot','size',[1],'NaN',1,'Inf',1)
 		md = checkfield(md,'fieldname','stressbalance.maxiter','size',[1],'>=',1)
 		md = checkfield(md,'fieldname','stressbalance.referential','size',[md.mesh.numberofvertices,6])
 		md = checkfield(md,'fieldname','stressbalance.loadingforce','size',[md.mesh.numberofvertices,3])
@@ -150,7 +150,7 @@
 		#singular solution
 #		if ~any((~isnan(md.stressbalance.spcvx)+~isnan(md.stressbalance.spcvy))==2),
 		if not numpy.any(numpy.logical_and(numpy.logical_not(numpy.isnan(md.stressbalance.spcvx)),numpy.logical_not(numpy.isnan(md.stressbalance.spcvy)))):
-			md.checkmessage("model is not well posed (singular). You need at least one node with fixed velocity!")
+			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
 #		if any(sum(isnan(md.stressbalance.referential),2)~=0 & sum(isnan(md.stressbalance.referential),2)~=6),
 		if numpy.any(numpy.logical_and(numpy.sum(numpy.isnan(md.stressbalance.referential),axis=1)!=0,numpy.sum(numpy.isnan(md.stressbalance.referential),axis=1)!=6)):
@@ -193,10 +193,17 @@
 		WriteData(fid,'object',self,'class','stressbalance','fieldname','rift_penalty_lock','format','Integer')
 		WriteData(fid,'object',self,'class','stressbalance','fieldname','rift_penalty_threshold','format','Integer')
 		WriteData(fid,'object',self,'class','stressbalance','fieldname','referential','format','DoubleMat','mattype',1)
+		
+		if isinstance(self.loadingforce, (list, tuple, numpy.ndarray)):
+			lx=self.loadingforce[:,0];
+			ly=self.loadingforce[:,1];
+			lz=self.loadingforce[:,2];
+		else:
+			lx=float('NaN'); ly=float('NaN'); lz=float('NaN');
 
-		WriteData(fid,'data',self.loadingforce[:,0],'format','DoubleMat','mattype',1,'enum',LoadingforceXEnum())
-		WriteData(fid,'data',self.loadingforce[:,1],'format','DoubleMat','mattype',1,'enum',LoadingforceYEnum())
-		WriteData(fid,'data',self.loadingforce[:,2],'format','DoubleMat','mattype',1,'enum',LoadingforceZEnum())
+		WriteData(fid,'data',lx,'format','DoubleMat','mattype',1,'enum',LoadingforceXEnum())
+		WriteData(fid,'data',ly,'format','DoubleMat','mattype',1,'enum',LoadingforceYEnum())
+		WriteData(fid,'data',lz,'format','DoubleMat','mattype',1,'enum',LoadingforceZEnum())
 
 		#process requested outputs
 		outputs = self.requested_outputs

Modified: issm/trunk/src/m/classes/taoinversion.m
===================================================================
--- issm/trunk/src/m/classes/taoinversion.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/classes/taoinversion.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -117,12 +117,12 @@
 			md = checkfield(md,'fieldname','inversion.max_parameters','size',[md.mesh.numberofvertices num_controls]);
 
 			if solution==BalancethicknessSolutionEnum()
-				md = checkfield(md,'fieldname','inversion.thickness_obs','size',[md.mesh.numberofvertices 1],'NaN',1);
+				md = checkfield(md,'fieldname','inversion.thickness_obs','size',[md.mesh.numberofvertices 1],'NaN',1,'Inf',1);
 			elseif solution==BalancethicknessSoftSolutionEnum()
-				md = checkfield(md,'fieldname','inversion.thickness_obs','size',[md.mesh.numberofvertices 1],'NaN',1);
+				md = checkfield(md,'fieldname','inversion.thickness_obs','size',[md.mesh.numberofvertices 1],'NaN',1,'Inf',1);
 			else
-				md = checkfield(md,'fieldname','inversion.vx_obs','size',[md.mesh.numberofvertices 1],'NaN',1);
-				md = checkfield(md,'fieldname','inversion.vy_obs','size',[md.mesh.numberofvertices 1],'NaN',1);
+				md = checkfield(md,'fieldname','inversion.vx_obs','size',[md.mesh.numberofvertices 1],'NaN',1,'Inf',1);
+				md = checkfield(md,'fieldname','inversion.vy_obs','size',[md.mesh.numberofvertices 1],'NaN',1,'Inf',1);
 			end
 		end % }}}
 		function disp(self) % {{{

Modified: issm/trunk/src/m/classes/thermal.m
===================================================================
--- issm/trunk/src/m/classes/thermal.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/classes/thermal.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -17,30 +17,6 @@
 		requested_outputs = {};
 	end
 	methods
-		function createxml(self,fid) % {{{
-			fprintf(fid, '<!-- thermal -->\n');            
-
-			% thermal solution parameters
-			fprintf(fid,'%s\n%s\n%s\n','<frame key="1" label="Thermal solution parameters">','<section name="thermal" />');                    
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="spctemperature" type="',class(self.spctemperature),'" default="',convert2str(self.spctemperature),'">','     <section name="thermal" />','     <help> temperature constraints (NaN means no constraint) [K] </help>','  </parameter>');
-
-			% penalty_threshold drop-down (0, 1, or 2)
-			fprintf(fid,'%s\n%s\n%s\n%s\n','  <parameter key ="penalty_threshold" type="alternative"  optional="false">','     <section name="thermal" />','     <help> 0: no, 1: artificial_diffusivity, 2: SUPG </help>');
-			fprintf(fid,'%s\n','       <option value="0" type="string" default="true"> </option>');
-			fprintf(fid,'%s\n','       <option value="1" type="string" default="false"> </option>');
-			fprintf(fid,'%s\n%s\n','       <option value="2" type="string" default="false"> </option>','</parameter>');
-
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="stabilization" type="',class(self.stabilization),'" default="',convert2str(self.stabilization),'">','     <section name="thermal" />','     <help> maximum number of non linear iterations </help>','  </parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="reltol" type="',class(self.reltol),'" default="',convert2str(self.reltol),'">','     <section name="steadystate" />','     <help> relative tolerance criterion [K] </help>','  </parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="maxiter" type="',class(self.maxiter),'" default="',convert2str(self.maxiter),'">','     <section name="thermal" />','     <help> stabilize unstable thermal constraints that keep zigzagging after n iteration (default is 0, no stabilization) </help>','  </parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="penalty_lock" type="',class(self.penalty_lock),'" default="',convert2str(self.penalty_lock),'">','     <section name="thermal" />','     <help> threshold to declare convergence of thermal solution (default is 0)  </help>','  </parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="penalty_factor" type="',class(self.penalty_factor),'" default="',convert2str(self.penalty_factor),'">','     <section name="thermal" />','     <help> scaling exponent (default is 3) </help>','  </parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="isenthalpy" type="',class(self.isenthalpy),'" default="',convert2str(self.isenthalpy),'">','     <section name="thermal" />','     <help> use an enthalpy formulation to include temperate ice (default is 0) </help>','  </parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="isdynamicbasalspc" type="',class(self.isdynamicbasalspc),'" default="',convert2str(self.isdynamicbasalspc),'">','     <section name="thermal" />','     <help> enable dynamic setting of basal forcing. recommended for enthalpy formulation (default is 0)  </help>','  </parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="requested_outputs" type="',class(self.requested_outputs),'" default="',convert2str(self.requested_outputs),'">','     <section name="thermal" />','     <help> additional outputs requested </help>','  </parameter>');
-			fprintf(fid,'%s\n%s\n','</frame>');    
-
-		end % }}}
 		function self = extrude(self,md) % {{{
 			self.spctemperature=project3d(md,'vector',self.spctemperature,'type','node','layer',md.mesh.numberoflayers,'padding',NaN);
 			if (length(md.initialization.temperature)==md.mesh.numberofvertices),
@@ -98,11 +74,17 @@
 			if (~ismember(ThermalAnalysisEnum(),analyses) & ~ismember(EnthalpyAnalysisEnum(),analyses)) | (solution==TransientSolutionEnum() & md.transient.isthermal==0), return; end
 
 			md = checkfield(md,'fieldname','thermal.stabilization','numel',[1],'values',[0 1 2]);
-			md = checkfield(md,'fieldname','thermal.spctemperature','timeseries',1);
+			md = checkfield(md,'fieldname','thermal.spctemperature','Inf',1,'timeseries',1,'>=',0);
 			if (ismember(EnthalpyAnalysisEnum(),analyses) & md.thermal.isenthalpy & dimension(md.mesh)==3),
-				pos=find(md.thermal.spctemperature(1:md.mesh.numberofvertices,:)~=NaN);
+
+				%Make sure the spc are less than melting point
+				TEMP=md.thermal.spctemperature(1:md.mesh.numberofvertices,:);
 				replicate=repmat(md.geometry.surface-md.mesh.z,1,size(md.thermal.spctemperature,2));
-				md = checkfield(md,'fieldname','thermal.spctemperature(find(md.thermal.spctemperature(1:md.mesh.numberofvertices,:)~=NaN))','<=',md.materials.meltingpoint-md.materials.beta*md.materials.rho_ice*md.constants.g*replicate(pos)+10^-5,'message','spctemperature should be less or equal than the adjusted melting point');
+				pos=find(~isnan(TEMP));
+				md = checkfield(md,'fieldname','thermal.spctemperature','field',TEMP(pos)',...
+					'<=',md.materials.meltingpoint-md.materials.beta*md.materials.rho_ice*md.constants.g*replicate(pos)+10^-5,...
+					'message','spctemperature should be less or equal than the adjusted melting point');
+
 				md = checkfield(md,'fieldname','thermal.isenthalpy','numel',[1],'values',[0 1]);
 				md = checkfield(md,'fieldname','thermal.isdynamicbasalspc','numel', [1],'values',[0 1]);
 				if(md.thermal.isenthalpy)
@@ -150,5 +132,19 @@
 			end
 			WriteData(fid,'data',outputs,'enum',ThermalRequestedOutputsEnum(),'format','StringArray');
         	end % }}}
+		function savemodeljs(self,fid,modelname) % {{{
+		
+			writejs1Darray(fid,[modelname '.thermal.spctemperature'],self.spctemperature);
+			writejsdouble(fid,[modelname '.thermal.penalty_threshold'],self.penalty_threshold);
+			writejsdouble(fid,[modelname '.thermal.stabilization'],self.stabilization);
+			writejsdouble(fid,[modelname '.thermal.reltol'],self.reltol);
+			writejsdouble(fid,[modelname '.thermal.maxiter'],self.maxiter);
+			writejsdouble(fid,[modelname '.thermal.penalty_lock'],self.penalty_lock);
+			writejsdouble(fid,[modelname '.thermal.penalty_factor'],self.penalty_factor);
+			writejsdouble(fid,[modelname '.thermal.isenthalpy'],self.isenthalpy);
+			writejsdouble(fid,[modelname '.thermal.isdynamicbasalspc'],self.isdynamicbasalspc);
+			writejscellstring(fid,[modelname '.thermal.requested_outputs'],self.requested_outputs);
+
+		end % }}}
 	end
 end

Modified: issm/trunk/src/m/classes/thermal.py
===================================================================
--- issm/trunk/src/m/classes/thermal.py	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/classes/thermal.py	2016-04-13 04:32:01 UTC (rev 20500)
@@ -94,7 +94,7 @@
 			return md
 
 		md = checkfield(md,'fieldname','thermal.stabilization','numel',[1],'values',[0,1,2])
-		md = checkfield(md,'fieldname','thermal.spctemperature','timeseries',1)
+		md = checkfield(md,'fieldname','thermal.spctemperature','Inf',1,'timeseries',1)
 		if EnthalpyAnalysisEnum() in analyses and md.thermal.isenthalpy and md.mesh.dimension()==3:
 			pos=numpy.nonzero(numpy.logical_not(numpy.isnan(md.thermal.spctemperature[0:md.mesh.numberofvertices])))
 			replicate=numpy.tile(md.geometry.surface-md.mesh.z,(1,numpy.size(md.thermal.spctemperature,axis=1)))

Modified: issm/trunk/src/m/classes/timestepping.m
===================================================================
--- issm/trunk/src/m/classes/timestepping.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/classes/timestepping.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -11,23 +11,8 @@
 		time_adapt      = 0;
 		cfl_coefficient = 0.;
 		interp_forcings = 1;
-		in_years        = 1;
 	end
 	methods
-       function createxml(self,fid) % {{{
-            fprintf(fid, '\n\n');
-            fprintf(fid, '%s\n', '<!-- Timestepping -->');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',    '<parameter key ="start_time" type="',              class(self.start_time),'" default="',                  convert2str(self.start_time),'">',              '     <section name="timestepping" />','     <help> simulation starting time [yr] </help>','</parameter>');
-            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',    '<parameter key ="final_time" type="',            class(self.final_time),'" default="',                convert2str(self.final_time),'">',   '     <section name="timestepping" />','     <help> final time to stop the simulation [yr] </help>','</parameter>');
-            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',        '<parameter key ="time_step" type="',      class(self.time_step),'" default="',          convert2str(self.time_step),'">',            '     <section name="timestepping" />','     <help> length of time steps [yr] </help>','</parameter>');
-            % time_adapt 0 or 1 drop down
-            fprintf(fid,'%s\n%s\n%s\n%s\n','<parameter key ="time_adapt" type="alternative" optional="false">','     <section name="timestepping" />','     <help> use cfl condition to define time step ? (0 or 1)  </help>');
-            fprintf(fid, '%s\n',   '       <option value="0" type="string" default="true"></option>');
-            fprintf(fid, '%s\n%s\n',   '       <option value="1" type="string" default="false"></option>','</parameter>');
-            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',    '<parameter key ="cfl_coefficient" type="',       class(self.cfl_coefficient),'" default="',              convert2str(self.cfl_coefficient),'">',              '     <section name="timestepping" />','     <help> coefficient applied to cfl condition </help>','</parameter>');
-            
-        end % }}}
-        
 		function self = timestepping(varargin) % {{{
 			switch nargin
 				case 0
@@ -50,15 +35,12 @@
 
 			%should we interpolate forcings between timesteps?
 			self.interp_forcings=1;
-
-			%In years by default
-			self.in_years = 1;
 		end % }}}
 		function md = checkconsistency(self,md,solution,analyses) % {{{
 
-			md = checkfield(md,'fieldname','timestepping.start_time','numel',[1],'NaN',1);
-			md = checkfield(md,'fieldname','timestepping.final_time','numel',[1],'NaN',1);
-			md = checkfield(md,'fieldname','timestepping.time_step','numel',[1],'>=',0,'NaN',1);
+			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);
 			md = checkfield(md,'fieldname','timestepping.time_adapt','numel',[1],'values',[0 1]);
 			md = checkfield(md,'fieldname','timestepping.cfl_coefficient','numel',[1],'>',0,'<=',1);
 			md = checkfield(md,'fieldname','timestepping.interp_forcings','numel',[1],'values',[0 1]);
@@ -69,27 +51,18 @@
 		function disp(self) % {{{
 			disp(sprintf('   timestepping parameters:'));
 
-			if(self.in_years)
-				unit = 'yr';
-			else
-				unit = 's';
-			end
+			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,'time_adapt','use cfl condition to define time step ? (0 or 1) ');
 			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,'in_years','time unit, 1: years, 0: seconds');
 
 		end % }}}
 		function marshall(self,md,fid) % {{{
 
-			if self.in_years,
-				scale = 365.0*24.0*3600.0;
-			else
-				scale = 1.;
-			end
+			scale = 365.0*24.0*3600.0;
 			WriteData(fid,'object',self,'fieldname','start_time','format','Double','scale',scale);
 			WriteData(fid,'object',self,'fieldname','final_time','format','Double','scale',scale);
 			WriteData(fid,'object',self,'fieldname','time_step','format','Double','scale',scale);
@@ -97,5 +70,15 @@
 			WriteData(fid,'object',self,'fieldname','cfl_coefficient','format','Double');
 			WriteData(fid,'object',self,'fieldname','interp_forcings','format','Boolean');
 		end % }}}
+		function savemodeljs(self,fid,modelname) % {{{
+		
+			writejsdouble(fid,[modelname '.timestepping.start_time'],self.start_time);
+			writejsdouble(fid,[modelname '.timestepping.final_time'],self.final_time);
+			writejsdouble(fid,[modelname '.timestepping.time_step'],self.time_step);
+			writejsdouble(fid,[modelname '.timestepping.time_adapt'],self.time_adapt);
+			writejsdouble(fid,[modelname '.timestepping.cfl_coefficient'],self.cfl_coefficient);
+			writejsdouble(fid,[modelname '.timestepping.interp_forcings'],self.interp_forcings);
+
+		end % }}}
 	end
 end

Modified: issm/trunk/src/m/classes/timestepping.py
===================================================================
--- issm/trunk/src/m/classes/timestepping.py	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/classes/timestepping.py	2016-04-13 04:32:01 UTC (rev 20500)
@@ -52,9 +52,9 @@
 	#}}}
 	def checkconsistency(self,md,solution,analyses):    # {{{
 
-		md = checkfield(md,'fieldname','timestepping.start_time','numel',[1],'NaN',1)
-		md = checkfield(md,'fieldname','timestepping.final_time','numel',[1],'NaN',1)
-		md = checkfield(md,'fieldname','timestepping.time_step','numel',[1],'>=',0,'NaN',1)
+		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)
 		md = checkfield(md,'fieldname','timestepping.time_adapt','numel',[1],'values',[0,1])
 		md = checkfield(md,'fieldname','timestepping.cfl_coefficient','numel',[1],'>',0,'<=',1)
 		if self.final_time-self.start_time<0:
@@ -65,7 +65,7 @@
 	# }}}
 	def marshall(self,md,fid):    # {{{
 
-		yts=365.0*24.0*3600.0
+                yts=md.constants.yts
 
 		WriteData(fid,'object',self,'fieldname','start_time','format','Double','scale',yts)
 		WriteData(fid,'object',self,'fieldname','final_time','format','Double','scale',yts)

Modified: issm/trunk/src/m/classes/toolkits.m
===================================================================
--- issm/trunk/src/m/classes/toolkits.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/classes/toolkits.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -52,7 +52,7 @@
 				 elseif IssmConfig('_HAVE_GSL_'),
 					 self.DefaultAnalysis           = issmgslsolver(); 
 				 else 
-					 error('Need at least Mumps or Gsl to define an issm solver type');
+					 disp('WARNING: Need at least Mumps or Gsl to define an issm solver type, no default solver assigned');
 				 end
 			 end
 
@@ -124,5 +124,17 @@
 
 			 fclose(fid);
 		 end %}}}
+		function savemodeljs(self,fid,modelname) % {{{
+	
+			analyses=properties(self);
+			 for i=1:numel(analyses),
+				 if isempty(fieldnames(self.(analyses{i})))
+					 error(['md.toolkits.' analyses{i} ' is empty']);
+				 else
+					 writejsstruct(fid,[modelname '.toolkits.' analyses{i}],self.(analyses{i}));
+				 end
+			 end
+	
+		end % }}}
 	 end
  end

Modified: issm/trunk/src/m/classes/toolkits.py
===================================================================
--- issm/trunk/src/m/classes/toolkits.py	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/classes/toolkits.py	2016-04-13 04:32:01 UTC (rev 20500)
@@ -5,6 +5,8 @@
 from fielddisplay import fielddisplay
 from EnumDefinitions import *
 from checkfield import checkfield
+from issmgslsolver import issmgslsolver
+from issmmumpssolver import issmmumpssolver
 
 class toolkits(object):
 	"""

Modified: issm/trunk/src/m/classes/transient.m
===================================================================
--- issm/trunk/src/m/classes/transient.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/classes/transient.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -5,35 +5,20 @@
 
 classdef transient
 	properties (SetAccess=public) 
+		issmb             = 0;
 		ismasstransport   = 0;
 		isstressbalance   = 0;
 		isthermal         = 0;
 		isgroundingline   = 0;
 		isgia             = 0;
 		isdamageevolution = 0;
-		islevelset        = 0;
-		iscalving         = 0;
+		ismovingfront     = 0;
 		ishydrology       = 0;
+		isslr             = 0;
+		iscoupler         = 0;
 		requested_outputs = {};
 	end
 	methods
-        function createxml(self,fid) % {{{
-            fprintf(fid, '<!-- transient -->\n');            
-                    
-            % transient solution parameters
-            fprintf(fid,'%s\n%s\n%s\n','<frame key="1" label="transient solution parameters">','<section name="transient" />');                    
-                fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="ismasstransport" type="',class(self.ismasstransport),'" default="',convert2str(self.ismasstransport),'">','     <section name="transient" />','     <help> indicates whether a masstransport solution is used in the transient </help>','  </parameter>');
-                fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="isstressbalance" type="',class(self.isstressbalance),'" default="',convert2str(self.isstressbalance),'">','     <section name="transient" />','     <help> indicates whether a stressbalance solution is used in the transient </help>','  </parameter>');
-                fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="isthermal" type="',class(self.isthermal),'" default="',convert2str(self.isthermal),'">','     <section name="transient" />','     <help> indicates whether a thermal solution is used in the transient </help>','  </parameter>');
-                fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="isgroundingline" type="',class(self.isgroundingline),'" default="',convert2str(self.isgroundingline),'">','     <section name="transient" />','     <help> indicates whether a groundingline migration is used in the transient </help>','  </parameter>');
-                fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="isgia" type="',class(self.isgia),'" default="',convert2str(self.isgia),'">','     <section name="transient" />','     <help> indicates whether a postglacial rebound model is used in the transient </help>','  </parameter>');
-                fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="isdamageevolution" type="',class(self.isdamageevolution),'" default="',convert2str(self.isdamageevolution),'">','     <section name="transient" />','     <help> indicates whether damage evolution is used in the transient </help>','  </parameter>');
-                fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="islevelset" type="',class(self.islevelset),'" default="',convert2str(self.islevelset),'">','     <section name="transient" />','     <help> LEVEL SET DESCRIPTION...  </help>','  </parameter>');
-                fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="iscalving" type="',class(self.iscalving),'" default="',convert2str(self.iscalving),'">','     <section name="transient" />','     <help> indicates whether calving is used in the transient </help>','  </parameter>');
-                fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="requested_outputs" type="',class(self.requested_outputs),'" default="',convert2str(self.requested_outputs),'">','     <section name="transient" />','     <help> list of additional outputs requested </help>','  </parameter>');
-            fprintf(fid,'%s\n%s\n','</frame>');    
-        
-        end % }}}
 		function self = transient(varargin) % {{{
 			switch nargin
 				case 0
@@ -45,15 +30,17 @@
 		function self = deactivateall(self) % {{{
 
 			%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.isdamageevolution = 0;
-			self.islevelset      = 0;
-			self.iscalving       =0;
+			self.ismovingfront   =0;
 			self.ishydrology     = 0;
+			self.isslr           = 0;
+			self.iscoupler       = 0;
 
 			%default output
 			self.requested_outputs={};
@@ -61,22 +48,24 @@
 		function self = setdefaultparameters(self) % {{{
 
 			%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.isdamageevolution = 0;
-			self.islevelset      = 0;
-			self.iscalving       = 0;
+			self.ismovingfront   = 0;
 			self.ishydrology     = 0;
+			self.isslr           = 0;
+			self.iscoupler       = 0;
 
 			%default output
 			self.requested_outputs={'default'};
 		end % }}}
 		function list = defaultoutputs(self,md) % {{{
-			if(self.ismasstransport)
-				list = {'SurfaceforcingsMassBalance'};
+			if(self.issmb)
+				list = {'SmbMassBalance'};
 			else
 				list = {};
 			end
@@ -86,34 +75,39 @@
 			%Early return
 			if solution~=TransientSolutionEnum(), return; end
 
+			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.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.isdamageevolution','numel',[1],'values',[0 1]);
-			md = checkfield(md,'fieldname','transient.islevelset','numel',[1],'values',[0 1]);
-			md = checkfield(md,'fieldname','transient.iscalving','numel',[1],'values',[0 1]);
+			md = checkfield(md,'fieldname','transient.ismovingfront','numel',[1],'values',[0 1]);
 			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.iscoupler','numel',[1],'values',[0 1]);
 
 		end % }}}
 		function disp(self) % {{{
 			disp(sprintf('   transient solution parameters:'));
 
+			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,'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,'isdamageevolution','indicates whether damage evolution is used in the transient');
-			fielddisplay(self,'islevelset','LEVEL SET DESCRIPTION...');
-			fielddisplay(self,'iscalving','indicates whether calving 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,'iscoupler','indicates whether different models are being run with need for coupling');
 			fielddisplay(self,'requested_outputs','list of additional outputs requested');
 
 		end % }}}
 		function marshall(self,md,fid) % {{{
+			WriteData(fid,'object',self,'fieldname','issmb','format','Boolean');
 			WriteData(fid,'object',self,'fieldname','ismasstransport','format','Boolean');
 			WriteData(fid,'object',self,'fieldname','isstressbalance','format','Boolean');
 			WriteData(fid,'object',self,'fieldname','isthermal','format','Boolean');
@@ -121,8 +115,9 @@
 			WriteData(fid,'object',self,'fieldname','isgia','format','Boolean');
 			WriteData(fid,'object',self,'fieldname','isdamageevolution','format','Boolean');
 			WriteData(fid,'object',self,'fieldname','ishydrology','format','Boolean');
-			WriteData(fid,'object',self,'fieldname','islevelset','format','Boolean');
-			WriteData(fid,'object',self,'fieldname','iscalving','format','Boolean');
+			WriteData(fid,'object',self,'fieldname','ismovingfront','format','Boolean');
+			WriteData(fid,'object',self,'fieldname','isslr','format','Boolean');
+			WriteData(fid,'object',self,'fieldname','iscoupler','format','Boolean');
 
 			%process requested outputs
 			outputs = self.requested_outputs;
@@ -133,5 +128,21 @@
 			end
 			WriteData(fid,'data',outputs,'enum',TransientRequestedOutputsEnum,'format','StringArray');
 		end % }}}
+		function savemodeljs(self,fid,modelname) % {{{
+		
+			writejsdouble(fid,[modelname '.trans.issmb'],self.issmb);
+			writejsdouble(fid,[modelname '.trans.ismasstransport'],self.ismasstransport);
+			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.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.iscoupler'],self.iscoupler);
+			writejscellstring(fid,[modelname '.trans.requested_outputs'],self.requested_outputs);
+
+		end % }}}
 	end
 end

Modified: issm/trunk/src/m/classes/transient.py
===================================================================
--- issm/trunk/src/m/classes/transient.py	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/classes/transient.py	2016-04-13 04:32:01 UTC (rev 20500)
@@ -12,15 +12,17 @@
 	"""
 
 	def __init__(self): # {{{
+		self.issmb   = False
 		self.ismasstransport   = False
 		self.isstressbalance   = False
 		self.isthermal         = False
 		self.isgroundingline   = False
 		self.isgia             = False
 		self.isdamageevolution = False
-		self.islevelset        = False
-		self.iscalving         = False
+		self.ismovingfront     = False
 		self.ishydrology       = False
+		self.isslr             = False
+		self.iscoupler         = False
 		self.requested_outputs = []
 
 		#set defaults
@@ -29,22 +31,24 @@
 		#}}}
 	def __repr__(self): # {{{
 		string='   transient solution parameters:'
+		string="%s\n%s"%(string,fielddisplay(self,'issmb','indicates if a surface mass balance solution is used in the transient'))
 		string="%s\n%s"%(string,fielddisplay(self,'ismasstransport','indicates if a masstransport solution is used in the transient'))
 		string="%s\n%s"%(string,fielddisplay(self,'isstressbalance','indicates if a stressbalance solution is used in the transient'))
 		string="%s\n%s"%(string,fielddisplay(self,'isthermal','indicates if a thermal solution is used in the transient'))
 		string="%s\n%s"%(string,fielddisplay(self,'isgroundingline','indicates if a groundingline migration is used in the transient'))
 		string="%s\n%s"%(string,fielddisplay(self,'isgia','indicates if a postglacial rebound is used in the transient'))
 		string="%s\n%s"%(string,fielddisplay(self,'isdamageevolution','indicates whether damage evolution is used in the transient'))
-		string="%s\n%s"%(string,fielddisplay(self,'islevelset','LEVELSET METHOD DESCRIPTION'))
-		string="%s\n%s"%(string,fielddisplay(self,'iscalving','indicates whether calving is used in the transient'))
+		string="%s\n%s"%(string,fielddisplay(self,'ismovingfront','indicates whether a moving front capability is used in the transient'))
 		string="%s\n%s"%(string,fielddisplay(self,'ishydrology','indicates whether an hydrology model is used'))
+		string="%s\n%s"%(string,fielddisplay(self,'isslr','indicates if a sea level rise solution is used in the transient'))
+		string="%s\n%s"%(string,fielddisplay(self,'iscoupler','indicates whether different models are being run with need for coupling'))
 		string="%s\n%s"%(string,fielddisplay(self,'requested_outputs','list of additional outputs requested'))
 		return string
 		#}}}
 	def defaultoutputs(self,md): # {{{
 
-		if self.ismasstransport:
-			return ['SurfaceforcingsMassBalance']
+		if self.issmb:
+			return ['SmbMassBalance']
 		else:
 			return []
 
@@ -52,15 +56,17 @@
 	def setallnullparameters(self): # {{{
 		
 		#Nothing done
+		self.issmb   = False
 		self.ismasstransport   = False
 		self.isstressbalance   = False
 		self.isthermal         = False
 		self.isgroundingline   = False
 		self.isgia             = False
 		self.isdamageevolution = False
-		self.islevelset        = False
-		self.iscalving         = False
+		self.ismovingfront     = False
 		self.ishydrology       = False
+		self.isslr             = False
+		self.iscoupler         = False
 
 		#default output
 		self.requested_outputs=[]
@@ -69,15 +75,17 @@
 	def setdefaultparameters(self): # {{{
 		
 		#full analysis: Stressbalance, Masstransport and Thermal but no groundingline migration for now
+		self.issmb = True
 		self.ismasstransport = True
 		self.isstressbalance = True
 		self.isthermal       = True
 		self.isgroundingline = False
 		self.isgia           = False
 		self.isdamageevolution = False
-		self.islevelset      = False
-		self.iscalving       = False
+		self.ismovingfront   = False
 		self.ishydrology     = False
+		self.isslr           = False
+		self.iscoupler       = False
 
 		#default output
 		self.requested_outputs=['default']
@@ -89,29 +97,33 @@
 		if not solution==TransientSolutionEnum():
 			return md
 
+		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.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.isdamageevolution','numel',[1],'values',[0,1])
-		md = checkfield(md,'fieldname','transient.islevelset','numel',[1],'values',[0,1])
 		md = checkfield(md,'fieldname','transient.ishydrology','numel',[1],'values',[0,1])
-		md = checkfield(md,'fieldname','transient.iscalving','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.iscoupler','numel',[1],'values',[0,1])
 		md = checkfield(md,'fieldname','transient.requested_outputs','stringrow',1)
 
 		return md
 	# }}}
 	def marshall(self,md,fid):    # {{{
+		WriteData(fid,'object',self,'fieldname','issmb','format','Boolean')
 		WriteData(fid,'object',self,'fieldname','ismasstransport','format','Boolean')
 		WriteData(fid,'object',self,'fieldname','isstressbalance','format','Boolean')
 		WriteData(fid,'object',self,'fieldname','isthermal','format','Boolean')
 		WriteData(fid,'object',self,'fieldname','isgroundingline','format','Boolean')
 		WriteData(fid,'object',self,'fieldname','isgia','format','Boolean')
 		WriteData(fid,'object',self,'fieldname','isdamageevolution','format','Boolean')
-		WriteData(fid,'object',self,'fieldname','islevelset','format','Boolean')
 		WriteData(fid,'object',self,'fieldname','ishydrology','format','Boolean')
-		WriteData(fid,'object',self,'fieldname','iscalving','format','Boolean')
+		WriteData(fid,'object',self,'fieldname','ismovingfront','format','Boolean')
+		WriteData(fid,'object',self,'fieldname','isslr','format','Boolean')
+		WriteData(fid,'object',self,'fieldname','iscoupler','format','Boolean')
 
 		#process requested outputs
 		outputs = self.requested_outputs

Modified: issm/trunk/src/m/classes/verbose.m
===================================================================
--- issm/trunk/src/m/classes/verbose.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/classes/verbose.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -9,6 +9,7 @@
 %      control     : control method
 %      qmu         : sensitivity analysis
 %      autodiff    : AD analysis
+%      smb         : smb analysis
 %
 %   Usage:
 %      verbose=verbose();
@@ -32,26 +33,12 @@
 		control=false;
 		qmu=false;
 		autodiff=false;
+		smb=false;
 		%ENDFIELDS
 		% }}}
 	end
 	%}}}
 	methods
-		function createxml(self,fid) % {{{
-			fprintf(fid, '\n\n');
-			fprintf(fid, '%s\n', '<!-- verbose -->');
-
-			fprintf(fid,'%s%s%s\n%s\n%s%s%s\n%s\n%s\n',    '<parameter key ="mprocessor" type="',              class(self.mprocessor),'" optional="false">',              '     <section name="verbose" />','        <option value="',convert2str(self.mprocessor),'" type="string" default="true"></option>','     <help>  </help>','</parameter>');
-			fprintf(fid,'%s%s%s\n%s\n%s%s%s\n%s\n%s\n',    '<parameter key ="module" type="',              class(self.module),'" optional="false">',              '     <section name="verbose" />','        <option value="',convert2str(self.module),'" type="string" default="true"></option>','     <help>  </help>','</parameter>');
-			fprintf(fid,'%s%s%s\n%s\n%s%s%s\n%s\n%s\n',    '<parameter key ="solution" type="',              class(self.solution),'" optional="false">',              '     <section name="verbose" />','        <option value="',convert2str(self.solution),'" type="string" default="true"></option>','     <help>  </help>','</parameter>');
-			fprintf(fid,'%s%s%s\n%s\n%s%s%s\n%s\n%s\n',    '<parameter key ="solver" type="',              class(self.solver),'" optional="false">',              '     <section name="verbose" />','        <option value="',convert2str(self.solver),'" type="string" default="true"></option>','     <help>  </help>','</parameter>');
-			fprintf(fid,'%s%s%s\n%s\n%s%s%s\n%s\n%s\n',    '<parameter key ="convergence" type="',              class(self.convergence),'" optional="false">',              '     <section name="verbose" />','        <option value="',convert2str(self.convergence),'" type="string" default="true"></option>','     <help>  </help>','</parameter>');
-			fprintf(fid,'%s%s%s\n%s\n%s%s%s\n%s\n%s\n',    '<parameter key ="control" type="',              class(self.control),'" optional="false">',              '     <section name="verbose" />','        <option value="',convert2str(self.control),'" type="string" default="true"></option>','     <help>  </help>','</parameter>');
-			fprintf(fid,'%s%s%s\n%s\n%s%s%s\n%s\n%s\n',    '<parameter key ="qmu" type="',              class(self.qmu),'" optional="false">',              '     <section name="verbose" />','        <option value="',convert2str(self.qmu),'" type="string" default="true"></option>','     <help>  </help>','</parameter>');
-			fprintf(fid,'%s%s%s\n%s\n%s%s%s\n%s\n',    '<parameter key ="autodiff" type="',              class(self.autodiff),'" optional="false">',              '     <section name="verbose" />','        <option value="',convert2str(self.autodiff),'" type="string" default="true"></option>','     <help>  </help>','</parameter>');
-
-
-		end % }}}
 		function verbose=verbose(varargin) % {{{
 
 			switch(nargin),
@@ -103,6 +90,7 @@
 		if (verbose.control), binary=bitor(binary,32); end
 		if (verbose.qmu), binary=bitor(binary,64); end
 		if (verbose.autodiff), binary=bitor(binary,128); end
+		if (verbose.smb), binary=bitor(binary,256); end
 		%ENDVERB2BIN
 
 		end
@@ -118,6 +106,7 @@
 		if bitand(binary,32), verbose.control=true; else verbose.control=false; end
 		if bitand(binary,64), verbose.qmu=true; else verbose.qmu=false; end
 		if bitand(binary,128), verbose.autodiff=true; else verbose.autodiff=false; end
+		if bitand(binary,256), verbose.smb=true; else verbose.smb=false; end
 		%ENDBIN2VERB
 
 		end
@@ -137,6 +126,7 @@
 		disp(sprintf('   %15s : %s','control',mat2str(verbose.control)));
 		disp(sprintf('   %15s : %s','qmu',mat2str(verbose.qmu)));
 		disp(sprintf('   %15s : %s','autodiff',mat2str(verbose.autodiff)));
+		disp(sprintf('   %15s : %s','smb',mat2str(verbose.smb)));
 		%ENDDISP
 
 		end
@@ -144,5 +134,18 @@
 		function marshall(self,md,fid) % {{{
 			WriteData(fid,'data',VerboseToBinary(self),'enum',VerboseEnum(),'format','Integer');
 		end % }}}
+		function savemodeljs(self,fid,modelname) % {{{
+		
+			writejsdouble(fid,[modelname '.verbose.mprocessor'],self.mprocessor);
+			writejsdouble(fid,[modelname '.verbose.module'],self.module);
+			writejsdouble(fid,[modelname '.verbose.solution'],self.solution);
+			writejsdouble(fid,[modelname '.verbose.solver'],self.solver);
+			writejsdouble(fid,[modelname '.verbose.convergence'],self.convergence);
+			writejsdouble(fid,[modelname '.verbose.control'],self.control);
+			writejsdouble(fid,[modelname '.verbose.qmu'],self.qmu);
+			writejsdouble(fid,[modelname '.verbose.autodiff'],self.autodiff);
+			writejsdouble(fid,[modelname '.verbose.smb'],self.smb);
+
+		end % }}}
 	end
 end

Modified: issm/trunk/src/m/classes/verbose.py
===================================================================
--- issm/trunk/src/m/classes/verbose.py	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/classes/verbose.py	2016-04-13 04:32:01 UTC (rev 20500)
@@ -16,6 +16,7 @@
 	      control     : control method
 	      qmu         : sensitivity analysis
 	      autodiff    : AD analysis
+	      smb         : SMB analysis
 
 	   Usage:
 	      verbose=verbose();
@@ -37,6 +38,7 @@
 		self.control     = False
 		self.qmu         = False
 		self.autodiff    = False
+		self.smb         = False
 		#ENDFIELDS
 
 		if not len(args):
@@ -83,6 +85,7 @@
 		s+="   %15s : %s\n" % ('control',self.control)
 		s+="   %15s : %s\n" % ('qmu',self.qmu)
 		s+="   %15s : %s\n" % ('autodiff',self.autodiff)
+		s+="   %15s : %s\n" % ('smb',self.smb)
 		#ENDDISP
 
 		return s
@@ -107,6 +110,8 @@
 			binary=binary | 64
 		if self.autodiff:
 			binary=binary | 128
+		if self.smb:
+			binary=binary | 256
 		#ENDVERB2BIN
 
 		return binary
@@ -122,6 +127,7 @@
 		self.control    =bool(binary &  32)
 		self.qmu        =bool(binary &  64)
 		self.autodiff   =bool(binary & 128)
+		self.smb        =bool(binary & 256)
 		#ENDBIN2VERB
 	# }}}
 	def checkconsistency(self,md,solution,analyses):    # {{{

Modified: issm/trunk/src/m/consistency/checkfield.m
===================================================================
--- issm/trunk/src/m/consistency/checkfield.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/consistency/checkfield.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -7,6 +7,7 @@
 %             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
+%      - Inf: 1 if check that there is no Inf
 %      - size: [lines cols], NaN for non checked dimensions
 %      - >:  greater than provided value
 %      - >=: greater or equal to provided value
@@ -35,7 +36,6 @@
 	eval(['field=md.' fieldname ';']);
 end
 
-
 %check empty
 if exist(options,'empty')
 	if isempty(field),
@@ -91,6 +91,16 @@
 	end
 end
 
+%check Inf
+if getfieldvalue(options,'Inf',0);
+	field2=reshape(field,prod(size(field)),1);
+	if any(isinf(field2)),
+		md = checkmessage(md,getfieldvalue(options,'message',...
+			['Inf values found in field ''' fieldname '''']));
+	end
+end
+
+
 %check cell
 if getfieldvalue(options,'cell',0);
 	if ~iscell(field),
@@ -138,6 +148,7 @@
 if exist(options,'>=')
 	lowerbound=getfieldvalue(options,'>=');
 	field2=reshape(field,prod(size(field)),1);
+	if getfieldvalue(options,'timeseries',0), field2=reshape(field(1:end-1,:),prod(size(field(1:end-1,:))),1); end
 	if any(field2<lowerbound),
 		md = checkmessage(md,getfieldvalue(options,'message',...
 			['field ''' fieldname ''' should have values above ' num2str(lowerbound(1,1))]));
@@ -146,6 +157,7 @@
 if exist(options,'>')
 	lowerbound=getfieldvalue(options,'>');
 	field2=reshape(field,prod(size(field)),1);
+	if getfieldvalue(options,'timeseries',0), field2=reshape(field(1:end-1,:),prod(size(field(1:end-1,:))),1); end
 	if any(field2<=lowerbound),
 		md = checkmessage(md,getfieldvalue(options,'message',...
 			['field ''' fieldname ''' should have values above ' num2str(lowerbound(1,1))]));
@@ -156,6 +168,7 @@
 if exist(options,'<=')
 	upperbound=getfieldvalue(options,'<=');
 	field2=reshape(field,prod(size(field)),1);
+	if getfieldvalue(options,'timeseries',0), field2=reshape(field(1:end-1,:),prod(size(field(1:end-1,:))),1); end
 	if any(field2>upperbound),
 		md = checkmessage(md,getfieldvalue(options,'message',...
 			['field ''' fieldname ''' should have values below ' num2str(upperbound(1,1))]));
@@ -164,6 +177,7 @@
 if exist(options,'<')
 	upperbound=getfieldvalue(options,'<');
 	field2=reshape(field,prod(size(field)),1);
+	if getfieldvalue(options,'timeseries',0), field2=reshape(field(1:end-1,:),prod(size(field(1:end-1,:))),1); end
 	if any(field2>=upperbound),
 		md = checkmessage(md,getfieldvalue(options,'message',...
 			['field ''' fieldname ''' should have values below ' num2str(upperbound(1,1))]));
@@ -198,12 +212,12 @@
 
 %Check forcings (size and times)
 if getfieldvalue(options,'timeseries',0),
-	if size(field,1)==md.mesh.numberofvertices,
+	if (size(field,1)==md.mesh.numberofvertices | size(field,1)==md.mesh.numberofelements),
 		if ~size(field,2)==1,
 			md = checkmessage(md,getfieldvalue(options,'message',...
 				['field ''' fieldname ''' should have only one column as there are md.mesh.numberofvertices lines']));
 		end
-	elseif size(field,1)==md.mesh.numberofvertices+1
+	elseif (size(field,1)==md.mesh.numberofvertices+1 | size(field,1)==md.mesh.numberofelements+1),
 		if any(field(end,:)~=sort(field(end,:))),
 			md = checkmessage(md,getfieldvalue(options,'message',...
 				['field ''' fieldname ''' columns should be sorted chronologically']));
@@ -217,3 +231,20 @@
 			['field ''' fieldname ''' should have md.mesh.numberofvertices or md.mesh.numberofvertices+1 lines']));
 	end
 end
+
+%Check single value forcings (size and times)
+if getfieldvalue(options,'singletimeseries',0),
+	if size(field,1)==2
+		if any(field(end,:)~=sort(field(end,:))),
+			md = checkmessage(md,getfieldvalue(options,'message',...
+				['field ''' fieldname ''' columns should be sorted chronologically']));
+		end
+		if any(field(end,1:end-1)==field(end,2:end)),
+			md = checkmessage(md,getfieldvalue(options,'message',...
+				['field ''' fieldname ''' columns must not contain duplicate timesteps']));
+		end
+	else
+		md = checkmessage(md,getfieldvalue(options,'message',...
+			['field ''' fieldname ''' should have 2 lines']));
+	end
+end

Modified: issm/trunk/src/m/consistency/checkfield.py
===================================================================
--- issm/trunk/src/m/consistency/checkfield.py	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/consistency/checkfield.py	2016-04-13 04:32:01 UTC (rev 20500)
@@ -94,6 +94,12 @@
 			md = md.checkmessage(options.getfieldvalue('message',\
 				"NaN values found in field '%s'" % fieldname))
 
+	#check Inf
+	if options.getfieldvalue('Inf',0):
+		if numpy.any(numpy.isinf(field)):
+			md = md.checkmessage(options.getfieldvalue('message',\
+				"Inf values found in field '%s'" % fieldname))
+
 	#check cell
 	if options.getfieldvalue('cell',0):
 		if not isinstance(field,(tuple,list,dict)):
@@ -155,7 +161,7 @@
 			if numpy.ndim(field)>1 and not numpy.size(field,1)==1:
 				md = md.checkmessage(options.getfieldvalue('message',\
 					"field '%s' should have only one column as there are md.mesh.numberofvertices lines" % fieldname))
-		elif numpy.size(field,0)==md.mesh.numberofvertices+1:
+		elif numpy.size(field,0)==md.mesh.numberofvertices+1 or numpy.size(field,0)==2:
 			if not all(field[-1,:]==numpy.sort(field[-1,:])):
 				md = md.checkmessage(options.getfieldvalue('message',\
 					"field '%s' columns should be sorted chronologically" % fieldname))
@@ -166,5 +172,18 @@
 			md = md.checkmessage(options.getfieldvalue('message',\
 				"field '%s' should have md.mesh.numberofvertices or md.mesh.numberofvertices+1 lines" % fieldname))
 
+	#Check single value forcings (size and times)
+	if options.getfieldvalue('singletimeseries',0):
+		if numpy.size(field,0)==2:
+			if not all(field[-1,:]==numpy.sort(field[-1,:])):
+				md = md.checkmessage(options.getfieldvalue('message',\
+						"field '%s' columns should be sorted chronologically" % fieldname))
+			if any(field[-1,0:-1]==field[-1,1:]):
+				md = md.checkmessage(options.getfieldvalue('message',\
+						"field '%s' columns must not contain duplicate timesteps" % fieldname))
+		else:
+				md = md.checkmessage(options.getfieldvalue('message',\
+				"field '%s' should have 2 lines" % fieldname))
+
 	return md
 

Modified: issm/trunk/src/m/consistency/comparemodels.m
===================================================================
--- issm/trunk/src/m/consistency/comparemodels.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/consistency/comparemodels.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -26,7 +26,17 @@
 		if numel(field1)==1 & isnan(field1) & isnan(field2),
 			%Do not do anything
 		elseif any(field1~=field2),
-			disp([fieldname ' differs']);
+			%Deal with NaN...
+			pos1=find(isnan(field1));
+			pos2=find(isnan(field2));
+			if numel(pos1)==numel(pos2) & all(pos1==pos2),
+				field1(pos1)=0; field2(pos2)=0;
+				if any(field1~=field2),
+					disp([fieldname ' differs']);
+				end
+			else
+				disp([fieldname ' differs']);
+			end
 		end
 	end
 

Modified: issm/trunk/src/m/consistency/ismodelselfconsistent.m
===================================================================
--- issm/trunk/src/m/consistency/ismodelselfconsistent.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/consistency/ismodelselfconsistent.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -49,7 +49,7 @@
 		analyses=[StressbalanceAnalysisEnum();StressbalanceVerticalAnalysisEnum();StressbalanceSIAAnalysisEnum();L2ProjectionBaseAnalysisEnum()];
 
 	case SteadystateSolutionEnum(),
-		analyses=[StressbalanceAnalysisEnum();StressbalanceVerticalAnalysisEnum();StressbalanceSIAAnalysisEnum();L2ProjectionBaseAnalysisEnum();ThermalAnalysisEnum();MeltingAnalysisEnum()];
+		analyses=[StressbalanceAnalysisEnum();StressbalanceVerticalAnalysisEnum();StressbalanceSIAAnalysisEnum();L2ProjectionBaseAnalysisEnum();ThermalAnalysisEnum();MeltingAnalysisEnum();EnthalpyAnalysisEnum()];
 
 	case ThermalSolutionEnum(),
 		analyses=[EnthalpyAnalysisEnum;ThermalAnalysisEnum();MeltingAnalysisEnum()];
@@ -79,11 +79,14 @@
 		analyses=[GiaAnalysisEnum()];
 
 	case TransientSolutionEnum(),
-		analyses=[StressbalanceAnalysisEnum();StressbalanceVerticalAnalysisEnum();StressbalanceSIAAnalysisEnum();L2ProjectionBaseAnalysisEnum();ThermalAnalysisEnum();MeltingAnalysisEnum();EnthalpyAnalysisEnum();MasstransportAnalysisEnum()];
+		analyses=[StressbalanceAnalysisEnum();StressbalanceVerticalAnalysisEnum();StressbalanceSIAAnalysisEnum();L2ProjectionBaseAnalysisEnum();ThermalAnalysisEnum();MeltingAnalysisEnum();EnthalpyAnalysisEnum();MasstransportAnalysisEnum();HydrologySommersAnalysisEnum];
 
 	case FlaimSolutionEnum(),
 		analyses=[FlaimAnalysisEnum()];
 
+	case SealevelriseSolutionEnum(),
+		analyses=[SealevelriseAnalysisEnum()];
+
 	case HydrologySolutionEnum(),
 		analyses=[L2ProjectionBaseAnalysisEnum();HydrologyShreveAnalysisEnum();HydrologyDCInefficientAnalysisEnum();HydrologyDCEfficientAnalysisEnum()];
 	

Modified: issm/trunk/src/m/consistency/ismodelselfconsistent.py
===================================================================
--- issm/trunk/src/m/consistency/ismodelselfconsistent.py	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/consistency/ismodelselfconsistent.py	2016-04-13 04:32:01 UTC (rev 20500)
@@ -13,7 +13,7 @@
 		analyses=[StressbalanceAnalysisEnum(),StressbalanceVerticalAnalysisEnum(),StressbalanceSIAAnalysisEnum(),L2ProjectionBaseAnalysisEnum()]
 
 	elif solutiontype == SteadystateSolutionEnum():
-		analyses=[StressbalanceAnalysisEnum(),StressbalanceVerticalAnalysisEnum(),StressbalanceSIAAnalysisEnum(),L2ProjectionBaseAnalysisEnum(),ThermalAnalysisEnum(),MeltingAnalysisEnum()]
+		analyses=[StressbalanceAnalysisEnum(),StressbalanceVerticalAnalysisEnum(),StressbalanceSIAAnalysisEnum(),L2ProjectionBaseAnalysisEnum(),ThermalAnalysisEnum(),MeltingAnalysisEnum(),EnthalpyAnalysisEnum()]
 
 	elif solutiontype == ThermalSolutionEnum():
 		analyses=[EnthalpyAnalysisEnum(),ThermalAnalysisEnum(),MeltingAnalysisEnum()]

Modified: issm/trunk/src/m/coordsystems/gdaltransform.m
===================================================================
--- issm/trunk/src/m/coordsystems/gdaltransform.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/coordsystems/gdaltransform.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -2,18 +2,26 @@
 %GDALTRANSFORM - switch from one projection system to another 
 %
 %   Usage:
-%      [x,y] = gdaltransform(x1,y1,'EPSG:3184','EPSG:3411')
+%      [x,y] = gdaltransform(x1,y1,epsg_in, epsg_out);
 %
+%   Example: 
+%      [x,y] = gdaltransform(md.mesh.lat,md.mesh.long,'EPSG:3184','EPSG:3411'); 
 %
+%   For reference: 
+%       EPSG: 4326 (lat,long)
+%       EPSG: 3411  (greenland, +proj=stere +lat_0=90 +lat_ts=70 +lon_0=-45 +k=1 +x_0=0 +y_0=0 +a=6378273 +b=6356889.449 +units=m +no_defs)
+%       EPSG: 3031 (antarctica, +proj=stere +lat_0=-90 +lat_ts=-71 +lon_0=0 +k=1 +x_0=0 +y_0=0 +datum=WGS84 +units=m +no_defs)
 
-	fid=fopen('.rand1234.txt','w');
+	%give ourselves a unique temporary directory: 
+	temproot=tempname; mkdir(temproot);
+
+	fid=fopen([temproot '/.rand1234.txt'],'w');
 	for i=1:length(x),
 		fprintf(fid,'%g %g\n',x(i),y(i));
 	end
 	fclose(fid);
 
-	[s,r]=system(['gdaltransform -s_srs ',proj_in,' -t_srs ',proj_out,'  < .rand1234.txt > .rand1235.txt']);
-
-	A=textread('.rand1235.txt');
+	[s,r]=system(['gdaltransform -s_srs ',proj_in,' -t_srs ',proj_out,'  < ' temproot '/.rand1234.txt > ' temproot '/.rand1235.txt']);
+	A=textread([temproot '/.rand1235.txt']);
 	xout=A(:,1);
 	yout=A(:,2);

Modified: issm/trunk/src/m/dev/devpath.py
===================================================================
--- issm/trunk/src/m/dev/devpath.py	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/dev/devpath.py	2016-04-13 04:32:01 UTC (rev 20500)
@@ -1,12 +1,15 @@
 #!/usr/bin/env python
-
 import os,sys
+import warnings
 
 #Recover ISSM_DIR and USERNAME
-ISSM_DIR=os.getenv('ISSM_DIR')
-USERNAME =os.getenv('USER')
+ISSM_DIR = os.getenv('ISSM_DIR')
+USERNAME = os.getenv('USER')
+JPL_SVN  = os.getenv('JPL_SVN')
 if(ISSM_DIR==None):
 	raise NameError('"ISSM_DIR" environment variable is empty! You should define ISSM_DIR in your .cshrc or .bashrc!')
+if(JPL_SVN==None):
+	warnings.warn('"JPL_SVN" environment variable is empty! add it to your .cshrc or .bashrc if you want to do distant computing')
 
 #Go through src/m and append any directory that contains a *.py file to PATH 
 for root,dirs,files in os.walk(ISSM_DIR+ '/src/m'):
@@ -20,6 +23,12 @@
 				
 sys.path.append(ISSM_DIR + '/lib')
 sys.path.append(ISSM_DIR + '/src/wrappers/python/.libs')
+# If using clusters, we need to have the path to the cluster settings directory
+if(JPL_SVN!=None):
+	if os.path.exists(JPL_SVN + '/usr/' + USERNAME):
+		sys.path.append(JPL_SVN + '/usr/' + USERNAME)
+	else:
+		warnings.warn('cluster settings should be in, '+ JPL_SVN +'/usr/' + USERNAME)
 
 #Manual imports for commonly used functions
 from plotmodel import plotmodel

Modified: issm/trunk/src/m/dev/issmversion.m
===================================================================
--- issm/trunk/src/m/dev/issmversion.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/dev/issmversion.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -11,12 +11,12 @@
 
 disp([' ']);
 disp([IssmConfig('PACKAGE_NAME') ' Version ' IssmConfig('PACKAGE_VERSION')]);
-disp(['(website: ' IssmConfig('PACKAGE_URL') ' contact:' IssmConfig('PACKAGE_BUGREPORT') ')']);
+disp(['(website: ' IssmConfig('PACKAGE_URL') ' contact: ' IssmConfig('PACKAGE_BUGREPORT') ')']);
 disp([' ']);
 disp(['Build date: ' IssmConfig('PACKAGE_BUILD_DATE')]);
 disp(['Compiled on ' IssmConfig('HOST_VENDOR') ' ' IssmConfig('HOST_OS') ' ' IssmConfig('HOST_ARCH') ' by ' IssmConfig('USER_NAME')]);
 disp([' ']);
-disp(['Copyright (c) 2009-2015 California Institute of Technology']);
+disp(['Copyright (c) 2009-2016 California Institute of Technology']);
 disp([' ']);
 disp(['    to get started type: issmdoc']);
 disp([' ']);

Modified: issm/trunk/src/m/dev/issmversion.py
===================================================================
--- issm/trunk/src/m/dev/issmversion.py	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/dev/issmversion.py	2016-04-13 04:32:01 UTC (rev 20500)
@@ -11,10 +11,10 @@
 
 print ' '
 print IssmConfig('PACKAGE_NAME')[0]+' Version '+IssmConfig('PACKAGE_VERSION')[0]
-print '(website: '+IssmConfig('PACKAGE_URL')[0]+' contact:'+IssmConfig('PACKAGE_BUGREPORT')[0]+')'
+print '(website: '+IssmConfig('PACKAGE_URL')[0]+' contact: '+IssmConfig('PACKAGE_BUGREPORT')[0]+')'
 print ' '
 print 'Build date: '+IssmConfig('PACKAGE_BUILD_DATE')[0]
-print 'Copyright (c) 2009-2013 California Institute of Technology'
+print 'Copyright (c) 2009-2016 California Institute of Technology'
 print ' '
 print '    to get started type: issmdoc'
 print ' '

Modified: issm/trunk/src/m/enum/EnumDefinitions.py
===================================================================
--- issm/trunk/src/m/enum/EnumDefinitions.py	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/enum/EnumDefinitions.py	2016-04-13 04:32:01 UTC (rev 20500)
@@ -8,6 +8,13 @@
 
 """
 
+def FemModelEnum(): return StringToEnum("FemModel")[0]
+def FemModelCommEnum(): return StringToEnum("FemModelComm")[0]
+def WorldCommEnum(): return StringToEnum("WorldComm")[0]
+def IcecapToEarthCommEnum(): return StringToEnum("IcecapToEarthComm")[0]
+def NumModelsEnum(): return StringToEnum("NumModels")[0]
+def ModelIdEnum(): return StringToEnum("ModelId")[0]
+def EarthIdEnum(): return StringToEnum("EarthId")[0]
 def AutodiffIsautodiffEnum(): return StringToEnum("AutodiffIsautodiff")[0]
 def AutodiffNumDependentsEnum(): return StringToEnum("AutodiffNumDependents")[0]
 def AutodiffNumDependentObjectsEnum(): return StringToEnum("AutodiffNumDependentObjects")[0]
@@ -44,12 +51,28 @@
 def BasalforcingsDeepwaterMeltingRateEnum(): return StringToEnum("BasalforcingsDeepwaterMeltingRate")[0]
 def BasalforcingsDeepwaterElevationEnum(): return StringToEnum("BasalforcingsDeepwaterElevation")[0]
 def BasalforcingsUpperwaterElevationEnum(): return StringToEnum("BasalforcingsUpperwaterElevation")[0]
+def BasalforcingsMeltrateFactorEnum(): return StringToEnum("BasalforcingsMeltrateFactor")[0]
+def BasalforcingsThresholdThicknessEnum(): return StringToEnum("BasalforcingsThresholdThickness")[0]
+def BasalforcingsUpperdepthMeltEnum(): return StringToEnum("BasalforcingsUpperdepthMelt")[0]
+def BasalforcingsMantleconductivityEnum(): return StringToEnum("BasalforcingsMantleconductivity")[0]
+def BasalforcingsNusseltEnum(): return StringToEnum("BasalforcingsNusselt")[0]
+def BasalforcingsDtbgEnum(): return StringToEnum("BasalforcingsDtbg")[0]
+def BasalforcingsPlumeradiusEnum(): return StringToEnum("BasalforcingsPlumeradius")[0]
+def BasalforcingsTopplumedepthEnum(): return StringToEnum("BasalforcingsTopplumedepth")[0]
+def BasalforcingsBottomplumedepthEnum(): return StringToEnum("BasalforcingsBottomplumedepth")[0]
+def BasalforcingsPlumexEnum(): return StringToEnum("BasalforcingsPlumex")[0]
+def BasalforcingsPlumeyEnum(): return StringToEnum("BasalforcingsPlumey")[0]
+def BasalforcingsCrustthicknessEnum(): return StringToEnum("BasalforcingsCrustthickness")[0]
+def BasalforcingsUppercrustthicknessEnum(): return StringToEnum("BasalforcingsUppercrustthickness")[0]
+def BasalforcingsUppercrustheatEnum(): return StringToEnum("BasalforcingsUppercrustheat")[0]
+def BasalforcingsLowercrustheatEnum(): return StringToEnum("BasalforcingsLowercrustheat")[0]
 def FloatingMeltRateEnum(): return StringToEnum("FloatingMeltRate")[0]
 def LinearFloatingMeltRateEnum(): return StringToEnum("LinearFloatingMeltRate")[0]
+def MismipFloatingMeltRateEnum(): return StringToEnum("MismipFloatingMeltRate")[0]
+def MantlePlumeGeothermalFluxEnum(): return StringToEnum("MantlePlumeGeothermalFlux")[0]
 def BedEnum(): return StringToEnum("Bed")[0]
 def BaseEnum(): return StringToEnum("Base")[0]
 def ConstantsGEnum(): return StringToEnum("ConstantsG")[0]
-def ConstantsOmegaEnum(): return StringToEnum("ConstantsOmega")[0]
 def ConstantsReferencetemperatureEnum(): return StringToEnum("ConstantsReferencetemperature")[0]
 def ConstantsYtsEnum(): return StringToEnum("ConstantsYts")[0]
 def DependentObjectEnum(): return StringToEnum("DependentObject")[0]
@@ -89,14 +112,17 @@
 def FlowequationVertexEquationEnum(): return StringToEnum("FlowequationVertexEquation")[0]
 def FrictionAsEnum(): return StringToEnum("FrictionAs")[0]
 def FrictionCoefficientEnum(): return StringToEnum("FrictionCoefficient")[0]
+def FrictionCoefficientcoulombEnum(): return StringToEnum("FrictionCoefficientcoulomb")[0]
 def FrictionPEnum(): return StringToEnum("FrictionP")[0]
 def FrictionQEnum(): return StringToEnum("FrictionQ")[0]
 def FrictionMEnum(): return StringToEnum("FrictionM")[0]
 def FrictionCEnum(): return StringToEnum("FrictionC")[0]
 def FrictionLawEnum(): return StringToEnum("FrictionLaw")[0]
 def FrictionGammaEnum(): return StringToEnum("FrictionGamma")[0]
+def FrictionFEnum(): return StringToEnum("FrictionF")[0]
 def FrictionWaterLayerEnum(): return StringToEnum("FrictionWaterLayer")[0]
 def FrictionEffectivePressureEnum(): return StringToEnum("FrictionEffectivePressure")[0]
+def FrictionCouplingEnum(): return StringToEnum("FrictionCoupling")[0]
 def GeometryHydrostaticRatioEnum(): return StringToEnum("GeometryHydrostaticRatio")[0]
 def HydrologyModelEnum(): return StringToEnum("HydrologyModel")[0]
 def HydrologyshreveEnum(): return StringToEnum("Hydrologyshreve")[0]
@@ -145,6 +171,17 @@
 def HydrologySedimentEnum(): return StringToEnum("HydrologySediment")[0]
 def HydrologyEfficientEnum(): return StringToEnum("HydrologyEfficient")[0]
 def HydrologySedimentKmaxEnum(): return StringToEnum("HydrologySedimentKmax")[0]
+def HydrologysommersEnum(): return StringToEnum("Hydrologysommers")[0]
+def HydrologyHeadEnum(): return StringToEnum("HydrologyHead")[0]
+def HydrologyGapHeightEnum(): return StringToEnum("HydrologyGapHeight")[0]
+def HydrologyBumpSpacingEnum(): return StringToEnum("HydrologyBumpSpacing")[0]
+def HydrologyBumpHeightEnum(): return StringToEnum("HydrologyBumpHeight")[0]
+def HydrologyEnglacialInputEnum(): return StringToEnum("HydrologyEnglacialInput")[0]
+def HydrologyMoulinInputEnum(): return StringToEnum("HydrologyMoulinInput")[0]
+def HydrologyReynoldsEnum(): return StringToEnum("HydrologyReynolds")[0]
+def HydrologyNeumannfluxEnum(): return StringToEnum("HydrologyNeumannflux")[0]
+def HydrologySpcheadEnum(): return StringToEnum("HydrologySpchead")[0]
+def HydrologyConductivityEnum(): return StringToEnum("HydrologyConductivity")[0]
 def IndependentObjectEnum(): return StringToEnum("IndependentObject")[0]
 def InversionControlParametersEnum(): return StringToEnum("InversionControlParameters")[0]
 def InversionControlScalingFactorsEnum(): return StringToEnum("InversionControlScalingFactors")[0]
@@ -177,6 +214,8 @@
 def InversionVyObsEnum(): return StringToEnum("InversionVyObs")[0]
 def InversionVzObsEnum(): return StringToEnum("InversionVzObs")[0]
 def MaskIceLevelsetEnum(): return StringToEnum("MaskIceLevelset")[0]
+def MaskOceanLevelsetEnum(): return StringToEnum("MaskOceanLevelset")[0]
+def MaskLandLevelsetEnum(): return StringToEnum("MaskLandLevelset")[0]
 def MaterialsBetaEnum(): return StringToEnum("MaterialsBeta")[0]
 def MaterialsHeatcapacityEnum(): return StringToEnum("MaterialsHeatcapacity")[0]
 def MaterialsLatentheatEnum(): return StringToEnum("MaterialsLatentheat")[0]
@@ -198,10 +237,8 @@
 def DamageElementinterpEnum(): return StringToEnum("DamageElementinterp")[0]
 def DamageHealingEnum(): return StringToEnum("DamageHealing")[0]
 def DamageStressThresholdEnum(): return StringToEnum("DamageStressThreshold")[0]
+def DamageKappaEnum(): return StringToEnum("DamageKappa")[0]
 def DamageStabilizationEnum(): return StringToEnum("DamageStabilization")[0]
-def DamagePenaltyThresholdEnum(): return StringToEnum("DamagePenaltyThreshold")[0]
-def DamagePenaltyLockEnum(): return StringToEnum("DamagePenaltyLock")[0]
-def DamagePenaltyFactorEnum(): return StringToEnum("DamagePenaltyFactor")[0]
 def DamageMaxiterEnum(): return StringToEnum("DamageMaxiter")[0]
 def DamageSpcdamageEnum(): return StringToEnum("DamageSpcdamage")[0]
 def DamageMaxDamageEnum(): return StringToEnum("DamageMaxDamage")[0]
@@ -215,14 +252,12 @@
 def CalvingCalvingrateEnum(): return StringToEnum("CalvingCalvingrate")[0]
 def CalvingMeltingrateEnum(): return StringToEnum("CalvingMeltingrate")[0]
 def CalvingLevermannEnum(): return StringToEnum("CalvingLevermann")[0]
-def CalvingPiEnum(): return StringToEnum("CalvingPi")[0]
 def CalvingDevEnum(): return StringToEnum("CalvingDev")[0]
 def DefaultCalvingEnum(): return StringToEnum("DefaultCalving")[0]
 def CalvingRequestedOutputsEnum(): return StringToEnum("CalvingRequestedOutputs")[0]
 def CalvinglevermannCoeffEnum(): return StringToEnum("CalvinglevermannCoeff")[0]
 def CalvinglevermannMeltingrateEnum(): return StringToEnum("CalvinglevermannMeltingrate")[0]
-def CalvingpiCoeffEnum(): return StringToEnum("CalvingpiCoeff")[0]
-def CalvingpiMeltingrateEnum(): return StringToEnum("CalvingpiMeltingrate")[0]
+def CalvingdevCoeffEnum(): return StringToEnum("CalvingdevCoeff")[0]
 def CalvingratexEnum(): return StringToEnum("Calvingratex")[0]
 def CalvingrateyEnum(): return StringToEnum("Calvingratey")[0]
 def CalvingratexAverageEnum(): return StringToEnum("CalvingratexAverage")[0]
@@ -241,6 +276,7 @@
 def MaterialsLithosphereDensityEnum(): return StringToEnum("MaterialsLithosphereDensity")[0]
 def MaterialsMantleShearModulusEnum(): return StringToEnum("MaterialsMantleShearModulus")[0]
 def MaterialsMantleDensityEnum(): return StringToEnum("MaterialsMantleDensity")[0]
+def MaterialsEarthDensityEnum(): return StringToEnum("MaterialsEarthDensity")[0]
 def MeshAverageVertexConnectivityEnum(): return StringToEnum("MeshAverageVertexConnectivity")[0]
 def MeshElements2dEnum(): return StringToEnum("MeshElements2d")[0]
 def MeshElementsEnum(): return StringToEnum("MeshElements")[0]
@@ -257,12 +293,17 @@
 def MeshXEnum(): return StringToEnum("MeshX")[0]
 def MeshYEnum(): return StringToEnum("MeshY")[0]
 def MeshZEnum(): return StringToEnum("MeshZ")[0]
+def MeshLatEnum(): return StringToEnum("MeshLat")[0]
+def MeshLongEnum(): return StringToEnum("MeshLong")[0]
+def MeshREnum(): return StringToEnum("MeshR")[0]
 def MeshElementtypeEnum(): return StringToEnum("MeshElementtype")[0]
+def MeshSegmentsEnum(): return StringToEnum("MeshSegments")[0]
 def DomainTypeEnum(): return StringToEnum("DomainType")[0]
 def DomainDimensionEnum(): return StringToEnum("DomainDimension")[0]
 def Domain2DhorizontalEnum(): return StringToEnum("Domain2Dhorizontal")[0]
 def Domain2DverticalEnum(): return StringToEnum("Domain2Dvertical")[0]
 def Domain3DEnum(): return StringToEnum("Domain3D")[0]
+def Domain3DsurfaceEnum(): return StringToEnum("Domain3Dsurface")[0]
 def MiscellaneousNameEnum(): return StringToEnum("MiscellaneousName")[0]
 def MasstransportHydrostaticAdjustmentEnum(): return StringToEnum("MasstransportHydrostaticAdjustment")[0]
 def MasstransportIsfreesurfaceEnum(): return StringToEnum("MasstransportIsfreesurface")[0]
@@ -288,12 +329,12 @@
 def SettingsIoGatherEnum(): return StringToEnum("SettingsIoGather")[0]
 def SettingsLowmemEnum(): return StringToEnum("SettingsLowmem")[0]
 def SettingsOutputFrequencyEnum(): return StringToEnum("SettingsOutputFrequency")[0]
+def SettingsRecordingFrequencyEnum(): return StringToEnum("SettingsRecordingFrequency")[0]
 def SettingsWaitonlockEnum(): return StringToEnum("SettingsWaitonlock")[0]
 def DebugProfilingEnum(): return StringToEnum("DebugProfiling")[0]
 def ProfilingCurrentMemEnum(): return StringToEnum("ProfilingCurrentMem")[0]
 def ProfilingCurrentFlopsEnum(): return StringToEnum("ProfilingCurrentFlops")[0]
 def ProfilingSolutionTimeEnum(): return StringToEnum("ProfilingSolutionTime")[0]
-def MaxIterationConvergenceFlagEnum(): return StringToEnum("MaxIterationConvergenceFlag")[0]
 def SteadystateMaxiterEnum(): return StringToEnum("SteadystateMaxiter")[0]
 def SteadystateNumRequestedOutputsEnum(): return StringToEnum("SteadystateNumRequestedOutputs")[0]
 def SteadystateReltolEnum(): return StringToEnum("SteadystateReltol")[0]
@@ -319,6 +360,8 @@
 def TimesteppingTimeAdaptEnum(): return StringToEnum("TimesteppingTimeAdapt")[0]
 def TimesteppingTimeStepEnum(): return StringToEnum("TimesteppingTimeStep")[0]
 def TimesteppingInterpForcingsEnum(): return StringToEnum("TimesteppingInterpForcings")[0]
+def TransientIssmbEnum(): return StringToEnum("TransientIssmb")[0]
+def TransientIscouplerEnum(): return StringToEnum("TransientIscoupler")[0]
 def TransientIsstressbalanceEnum(): return StringToEnum("TransientIsstressbalance")[0]
 def TransientIsgroundinglineEnum(): return StringToEnum("TransientIsgroundingline")[0]
 def TransientIsmasstransportEnum(): return StringToEnum("TransientIsmasstransport")[0]
@@ -326,7 +369,8 @@
 def TransientIsgiaEnum(): return StringToEnum("TransientIsgia")[0]
 def TransientIsdamageevolutionEnum(): return StringToEnum("TransientIsdamageevolution")[0]
 def TransientIshydrologyEnum(): return StringToEnum("TransientIshydrology")[0]
-def TransientIscalvingEnum(): return StringToEnum("TransientIscalving")[0]
+def TransientIsmovingfrontEnum(): return StringToEnum("TransientIsmovingfront")[0]
+def TransientIsslrEnum(): return StringToEnum("TransientIsslr")[0]
 def TransientNumRequestedOutputsEnum(): return StringToEnum("TransientNumRequestedOutputs")[0]
 def TransientRequestedOutputsEnum(): return StringToEnum("TransientRequestedOutputs")[0]
 def PotentialEnum(): return StringToEnum("Potential")[0]
@@ -337,43 +381,101 @@
 def BalancethicknessCmuEnum(): return StringToEnum("BalancethicknessCmu")[0]
 def BalancethicknessOmegaEnum(): return StringToEnum("BalancethicknessOmega")[0]
 def BalancethicknessD0Enum(): return StringToEnum("BalancethicknessD0")[0]
-def SurfaceforcingsEnum(): return StringToEnum("Surfaceforcings")[0]
-def SMBEnum(): return StringToEnum("SMB")[0]
-def SurfaceforcingsMassBalanceEnum(): return StringToEnum("SurfaceforcingsMassBalance")[0]
+def SmbEnum(): return StringToEnum("Smb")[0]
+def SmbAnalysisEnum(): return StringToEnum("SmbAnalysis")[0]
+def SmbSolutionEnum(): return StringToEnum("SmbSolution")[0]
+def SmbNumRequestedOutputsEnum(): return StringToEnum("SmbNumRequestedOutputs")[0]
+def SmbRequestedOutputsEnum(): return StringToEnum("SmbRequestedOutputs")[0]
+def SmbIsInitializedEnum(): return StringToEnum("SmbIsInitialized")[0]
+def SMBforcingEnum(): return StringToEnum("SMBforcing")[0]
+def SmbMassBalanceEnum(): return StringToEnum("SmbMassBalance")[0]
+def SMBgembEnum(): return StringToEnum("SMBgemb")[0]
+def SmbInitDensityScalingEnum(): return StringToEnum("SmbInitDensityScaling")[0]
+def SmbTaEnum(): return StringToEnum("SmbTa")[0]
+def SmbVEnum(): return StringToEnum("SmbV")[0]
+def SmbDswrfEnum(): return StringToEnum("SmbDswrf")[0]
+def SmbDlwrfEnum(): return StringToEnum("SmbDlwrf")[0]
+def SmbPEnum(): return StringToEnum("SmbP")[0]
+def SmbSwfEnum(): return StringToEnum("SmbSwf")[0]
+def SmbEAirEnum(): return StringToEnum("SmbEAir")[0]
+def SmbPAirEnum(): return StringToEnum("SmbPAir")[0]
+def SmbTmeanEnum(): return StringToEnum("SmbTmean")[0]
+def SmbCEnum(): return StringToEnum("SmbC")[0]
+def SmbTzEnum(): return StringToEnum("SmbTz")[0]
+def SmbVzEnum(): return StringToEnum("SmbVz")[0]
+def SmbDtEnum(): return StringToEnum("SmbDt")[0]
+def SmbDzEnum(): return StringToEnum("SmbDz")[0]
+def SmbAIdxEnum(): return StringToEnum("SmbAIdx")[0]
+def SmbSwIdxEnum(): return StringToEnum("SmbSwIdx")[0]
+def SmbDenIdxEnum(): return StringToEnum("SmbDenIdx")[0]
+def SmbZTopEnum(): return StringToEnum("SmbZTop")[0]
+def SmbDzTopEnum(): return StringToEnum("SmbDzTop")[0]
+def SmbDzMinEnum(): return StringToEnum("SmbDzMin")[0]
+def SmbZYEnum(): return StringToEnum("SmbZY")[0]
+def SmbZMaxEnum(): return StringToEnum("SmbZMax")[0]
+def SmbZMinEnum(): return StringToEnum("SmbZMin")[0]
+def SmbOutputFreqEnum(): return StringToEnum("SmbOutputFreq")[0]
+def SmbASnowEnum(): return StringToEnum("SmbASnow")[0]
+def SmbAIceEnum(): return StringToEnum("SmbAIce")[0]
+def SmbCldFracEnum(): return StringToEnum("SmbCldFrac")[0]
+def SmbT0wetEnum(): return StringToEnum("SmbT0wet")[0]
+def SmbT0dryEnum(): return StringToEnum("SmbT0dry")[0]
+def SmbKEnum(): return StringToEnum("SmbK")[0]
+def SmbDEnum(): return StringToEnum("SmbD")[0]
+def SmbReEnum(): return StringToEnum("SmbRe")[0]
+def SmbGdnEnum(): return StringToEnum("SmbGdn")[0]
+def SmbGspEnum(): return StringToEnum("SmbGsp")[0]
+def SmbECEnum(): return StringToEnum("SmbEC")[0]
+def SmbCondensationEnum(): return StringToEnum("SmbCondensation")[0]
+def SmbWEnum(): return StringToEnum("SmbW")[0]
+def SmbAEnum(): return StringToEnum("SmbA")[0]
+def SmbTEnum(): return StringToEnum("SmbT")[0]
+def SmbIsgraingrowthEnum(): return StringToEnum("SmbIsgraingrowth")[0]
+def SmbIsalbedoEnum(): return StringToEnum("SmbIsalbedo")[0]
+def SmbIsshortwaveEnum(): return StringToEnum("SmbIsshortwave")[0]
+def SmbIsthermalEnum(): return StringToEnum("SmbIsthermal")[0]
+def SmbIsaccumulationEnum(): return StringToEnum("SmbIsaccumulation")[0]
+def SmbIsmeltEnum(): return StringToEnum("SmbIsmelt")[0]
+def SmbIsdensificationEnum(): return StringToEnum("SmbIsdensification")[0]
+def SmbIsturbulentfluxEnum(): return StringToEnum("SmbIsturbulentflux")[0]
 def SMBpddEnum(): return StringToEnum("SMBpdd")[0]
-def SurfaceforcingsDelta18oEnum(): return StringToEnum("SurfaceforcingsDelta18o")[0]
-def SurfaceforcingsDelta18oSurfaceEnum(): return StringToEnum("SurfaceforcingsDelta18oSurface")[0]
-def SurfaceforcingsIsdelta18oEnum(): return StringToEnum("SurfaceforcingsIsdelta18o")[0]
-def SurfaceforcingsIsmungsmEnum(): return StringToEnum("SurfaceforcingsIsmungsm")[0]
-def SurfaceforcingsPrecipitationsPresentdayEnum(): return StringToEnum("SurfaceforcingsPrecipitationsPresentday")[0]
-def SurfaceforcingsPrecipitationsLgmEnum(): return StringToEnum("SurfaceforcingsPrecipitationsLgm")[0]
-def SurfaceforcingsTemperaturesPresentdayEnum(): return StringToEnum("SurfaceforcingsTemperaturesPresentday")[0]
-def SurfaceforcingsTemperaturesLgmEnum(): return StringToEnum("SurfaceforcingsTemperaturesLgm")[0]
-def SurfaceforcingsPrecipitationEnum(): return StringToEnum("SurfaceforcingsPrecipitation")[0]
-def SurfaceforcingsDesfacEnum(): return StringToEnum("SurfaceforcingsDesfac")[0]
-def SurfaceforcingsS0pEnum(): return StringToEnum("SurfaceforcingsS0p")[0]
-def SurfaceforcingsS0tEnum(): return StringToEnum("SurfaceforcingsS0t")[0]
-def SurfaceforcingsRlapsEnum(): return StringToEnum("SurfaceforcingsRlaps")[0]
-def SurfaceforcingsRlapslgmEnum(): return StringToEnum("SurfaceforcingsRlapslgm")[0]
-def SurfaceforcingsPfacEnum(): return StringToEnum("SurfaceforcingsPfac")[0]
-def SurfaceforcingsTdiffEnum(): return StringToEnum("SurfaceforcingsTdiff")[0]
-def SurfaceforcingsSealevEnum(): return StringToEnum("SurfaceforcingsSealev")[0]
+def SmbDelta18oEnum(): return StringToEnum("SmbDelta18o")[0]
+def SmbDelta18oSurfaceEnum(): return StringToEnum("SmbDelta18oSurface")[0]
+def SmbIsdelta18oEnum(): return StringToEnum("SmbIsdelta18o")[0]
+def SmbIsmungsmEnum(): return StringToEnum("SmbIsmungsm")[0]
+def SmbIsd18opdEnum(): return StringToEnum("SmbIsd18opd")[0]
+def SmbPrecipitationsPresentdayEnum(): return StringToEnum("SmbPrecipitationsPresentday")[0]
+def SmbPrecipitationsLgmEnum(): return StringToEnum("SmbPrecipitationsLgm")[0]
+def SmbTemperaturesPresentdayEnum(): return StringToEnum("SmbTemperaturesPresentday")[0]
+def SmbTemperaturesLgmEnum(): return StringToEnum("SmbTemperaturesLgm")[0]
+def SmbPrecipitationEnum(): return StringToEnum("SmbPrecipitation")[0]
+def SmbDesfacEnum(): return StringToEnum("SmbDesfac")[0]
+def SmbS0pEnum(): return StringToEnum("SmbS0p")[0]
+def SmbS0tEnum(): return StringToEnum("SmbS0t")[0]
+def SmbRlapsEnum(): return StringToEnum("SmbRlaps")[0]
+def SmbRlapslgmEnum(): return StringToEnum("SmbRlapslgm")[0]
+def SmbPfacEnum(): return StringToEnum("SmbPfac")[0]
+def SmbTdiffEnum(): return StringToEnum("SmbTdiff")[0]
+def SmbSealevEnum(): return StringToEnum("SmbSealev")[0]
+def SMBd18opddEnum(): return StringToEnum("SMBd18opdd")[0]
+def SmbDpermilEnum(): return StringToEnum("SmbDpermil")[0]
 def SMBgradientsEnum(): return StringToEnum("SMBgradients")[0]
-def SurfaceforcingsMonthlytemperaturesEnum(): return StringToEnum("SurfaceforcingsMonthlytemperatures")[0]
-def SurfaceforcingsHrefEnum(): return StringToEnum("SurfaceforcingsHref")[0]
-def SurfaceforcingsSmbrefEnum(): return StringToEnum("SurfaceforcingsSmbref")[0]
-def SurfaceforcingsBPosEnum(): return StringToEnum("SurfaceforcingsBPos")[0]
-def SurfaceforcingsBNegEnum(): return StringToEnum("SurfaceforcingsBNeg")[0]
+def SmbMonthlytemperaturesEnum(): return StringToEnum("SmbMonthlytemperatures")[0]
+def SmbHrefEnum(): return StringToEnum("SmbHref")[0]
+def SmbSmbrefEnum(): return StringToEnum("SmbSmbref")[0]
+def SmbBPosEnum(): return StringToEnum("SmbBPos")[0]
+def SmbBNegEnum(): return StringToEnum("SmbBNeg")[0]
 def SMBhenningEnum(): return StringToEnum("SMBhenning")[0]
 def SMBcomponentsEnum(): return StringToEnum("SMBcomponents")[0]
-def SurfaceforcingsAccumulationEnum(): return StringToEnum("SurfaceforcingsAccumulation")[0]
-def SurfaceforcingsEvaporationEnum(): return StringToEnum("SurfaceforcingsEvaporation")[0]
-def SurfaceforcingsRunoffEnum(): return StringToEnum("SurfaceforcingsRunoff")[0]
+def SmbAccumulationEnum(): return StringToEnum("SmbAccumulation")[0]
+def SmbEvaporationEnum(): return StringToEnum("SmbEvaporation")[0]
+def SmbRunoffEnum(): return StringToEnum("SmbRunoff")[0]
 def SMBmeltcomponentsEnum(): return StringToEnum("SMBmeltcomponents")[0]
-def SurfaceforcingsMeltEnum(): return StringToEnum("SurfaceforcingsMelt")[0]
-def SurfaceforcingsRefreezeEnum(): return StringToEnum("SurfaceforcingsRefreeze")[0]
-def SurfaceforcingsIspddEnum(): return StringToEnum("SurfaceforcingsIspdd")[0]
-def SurfaceforcingsIssmbgradientsEnum(): return StringToEnum("SurfaceforcingsIssmbgradients")[0]
+def SmbMeltEnum(): return StringToEnum("SmbMelt")[0]
+def SmbRefreezeEnum(): return StringToEnum("SmbRefreeze")[0]
+def SMBgcmEnum(): return StringToEnum("SMBgcm")[0]
+def SmbIspddEnum(): return StringToEnum("SmbIspdd")[0]
+def SmbIssmbgradientsEnum(): return StringToEnum("SmbIssmbgradients")[0]
 def SolutionTypeEnum(): return StringToEnum("SolutionType")[0]
 def AnalysisTypeEnum(): return StringToEnum("AnalysisType")[0]
 def ConfigurationTypeEnum(): return StringToEnum("ConfigurationType")[0]
@@ -405,6 +507,7 @@
 def HydrologyShreveAnalysisEnum(): return StringToEnum("HydrologyShreveAnalysis")[0]
 def HydrologyDCInefficientAnalysisEnum(): return StringToEnum("HydrologyDCInefficientAnalysis")[0]
 def HydrologyDCEfficientAnalysisEnum(): return StringToEnum("HydrologyDCEfficientAnalysis")[0]
+def HydrologySommersAnalysisEnum(): return StringToEnum("HydrologySommersAnalysis")[0]
 def HydrologySolutionEnum(): return StringToEnum("HydrologySolution")[0]
 def MeltingAnalysisEnum(): return StringToEnum("MeltingAnalysis")[0]
 def MasstransportAnalysisEnum(): return StringToEnum("MasstransportAnalysis")[0]
@@ -442,6 +545,7 @@
 def FSApproximationEnum(): return StringToEnum("FSApproximation")[0]
 def FSvelocityEnum(): return StringToEnum("FSvelocity")[0]
 def FSpressureEnum(): return StringToEnum("FSpressure")[0]
+def DataSetEnum(): return StringToEnum("DataSet")[0]
 def ConstraintsEnum(): return StringToEnum("Constraints")[0]
 def LoadsEnum(): return StringToEnum("Loads")[0]
 def MaterialsEnum(): return StringToEnum("Materials")[0]
@@ -458,12 +562,15 @@
 def ControlInputEnum(): return StringToEnum("ControlInput")[0]
 def DatasetInputEnum(): return StringToEnum("DatasetInput")[0]
 def DoubleInputEnum(): return StringToEnum("DoubleInput")[0]
+def DoubleArrayInputEnum(): return StringToEnum("DoubleArrayInput")[0]
 def DataSetParamEnum(): return StringToEnum("DataSetParam")[0]
 def DoubleMatArrayParamEnum(): return StringToEnum("DoubleMatArrayParam")[0]
 def DoubleMatParamEnum(): return StringToEnum("DoubleMatParam")[0]
 def DoubleParamEnum(): return StringToEnum("DoubleParam")[0]
 def DoubleVecParamEnum(): return StringToEnum("DoubleVecParam")[0]
 def ElementEnum(): return StringToEnum("Element")[0]
+def ElementHookEnum(): return StringToEnum("ElementHook")[0]
+def HookEnum(): return StringToEnum("Hook")[0]
 def ExternalResultEnum(): return StringToEnum("ExternalResult")[0]
 def FileParamEnum(): return StringToEnum("FileParam")[0]
 def InputEnum(): return StringToEnum("Input")[0]
@@ -482,7 +589,9 @@
 def NodeEnum(): return StringToEnum("Node")[0]
 def NumericalfluxEnum(): return StringToEnum("Numericalflux")[0]
 def NumericalfluxTypeEnum(): return StringToEnum("NumericalfluxType")[0]
+def NeumannfluxEnum(): return StringToEnum("Neumannflux")[0]
 def ParamEnum(): return StringToEnum("Param")[0]
+def MoulinEnum(): return StringToEnum("Moulin")[0]
 def PengridEnum(): return StringToEnum("Pengrid")[0]
 def PenpairEnum(): return StringToEnum("Penpair")[0]
 def ProfilerEnum(): return StringToEnum("Profiler")[0]
@@ -558,6 +667,7 @@
 def SurfaceSlopeYEnum(): return StringToEnum("SurfaceSlopeY")[0]
 def TemperatureEnum(): return StringToEnum("Temperature")[0]
 def TemperaturePicardEnum(): return StringToEnum("TemperaturePicard")[0]
+def TemperaturePDDEnum(): return StringToEnum("TemperaturePDD")[0]
 def ThicknessAbsMisfitEnum(): return StringToEnum("ThicknessAbsMisfit")[0]
 def SurfaceAbsMisfitEnum(): return StringToEnum("SurfaceAbsMisfit")[0]
 def VelEnum(): return StringToEnum("Vel")[0]
@@ -581,6 +691,7 @@
 def ThicknessAbsGradientEnum(): return StringToEnum("ThicknessAbsGradient")[0]
 def ThicknessAlongGradientEnum(): return StringToEnum("ThicknessAlongGradient")[0]
 def ThicknessAcrossGradientEnum(): return StringToEnum("ThicknessAcrossGradient")[0]
+def ThicknessPositiveEnum(): return StringToEnum("ThicknessPositive")[0]
 def IntMatParamEnum(): return StringToEnum("IntMatParam")[0]
 def RheologyBbarAbsGradientEnum(): return StringToEnum("RheologyBbarAbsGradient")[0]
 def RheologyBAbsGradientEnum(): return StringToEnum("RheologyBAbsGradient")[0]
@@ -610,6 +721,7 @@
 def DeviatoricStressyyEnum(): return StringToEnum("DeviatoricStressyy")[0]
 def DeviatoricStressyzEnum(): return StringToEnum("DeviatoricStressyz")[0]
 def DeviatoricStresszzEnum(): return StringToEnum("DeviatoricStresszz")[0]
+def DeviatoricStresseffectiveEnum(): return StringToEnum("DeviatoricStresseffective")[0]
 def StrainRateEnum(): return StringToEnum("StrainRate")[0]
 def StrainRatexxEnum(): return StringToEnum("StrainRatexx")[0]
 def StrainRatexyEnum(): return StringToEnum("StrainRatexy")[0]
@@ -623,6 +735,7 @@
 def GiadWdtEnum(): return StringToEnum("GiadWdt")[0]
 def GiaWEnum(): return StringToEnum("GiaW")[0]
 def P0Enum(): return StringToEnum("P0")[0]
+def P0ArrayEnum(): return StringToEnum("P0Array")[0]
 def P1Enum(): return StringToEnum("P1")[0]
 def P1DGEnum(): return StringToEnum("P1DG")[0]
 def P1bubbleEnum(): return StringToEnum("P1bubble")[0]
@@ -760,6 +873,11 @@
 def MassfluxatgateNameEnum(): return StringToEnum("MassfluxatgateName")[0]
 def MassfluxatgateDefinitionenumEnum(): return StringToEnum("MassfluxatgateDefinitionenum")[0]
 def MassfluxatgateSegmentsEnum(): return StringToEnum("MassfluxatgateSegments")[0]
+def NodalvalueEnum(): return StringToEnum("Nodalvalue")[0]
+def NodalvalueNameEnum(): return StringToEnum("NodalvalueName")[0]
+def NodalvalueDefinitionenumEnum(): return StringToEnum("NodalvalueDefinitionenum")[0]
+def NodalvalueModelEnumEnum(): return StringToEnum("NodalvalueModelEnum")[0]
+def NodalvalueNodeEnum(): return StringToEnum("NodalvalueNode")[0]
 def MisfitNameEnum(): return StringToEnum("MisfitName")[0]
 def MisfitDefinitionenumEnum(): return StringToEnum("MisfitDefinitionenum")[0]
 def MisfitModelEnumEnum(): return StringToEnum("MisfitModelEnum")[0]
@@ -786,9 +904,13 @@
 def MinVzEnum(): return StringToEnum("MinVz")[0]
 def MaxVzEnum(): return StringToEnum("MaxVz")[0]
 def MaxAbsVzEnum(): return StringToEnum("MaxAbsVz")[0]
+def FloatingAreaEnum(): return StringToEnum("FloatingArea")[0]
+def GroundedAreaEnum(): return StringToEnum("GroundedArea")[0]
 def IceMassEnum(): return StringToEnum("IceMass")[0]
 def IceVolumeEnum(): return StringToEnum("IceVolume")[0]
 def IceVolumeAboveFloatationEnum(): return StringToEnum("IceVolumeAboveFloatation")[0]
+def TotalFloatingBmbEnum(): return StringToEnum("TotalFloatingBmb")[0]
+def TotalGroundedBmbEnum(): return StringToEnum("TotalGroundedBmb")[0]
 def TotalSmbEnum(): return StringToEnum("TotalSmb")[0]
 def AbsoluteEnum(): return StringToEnum("Absolute")[0]
 def IncrementalEnum(): return StringToEnum("Incremental")[0]
@@ -825,12 +947,15 @@
 def IntersectEnum(): return StringToEnum("Intersect")[0]
 def NodalEnum(): return StringToEnum("Nodal")[0]
 def OldGradientEnum(): return StringToEnum("OldGradient")[0]
+def OutputBufferPointerEnum(): return StringToEnum("OutputBufferPointer")[0]
+def OutputBufferSizePointerEnum(): return StringToEnum("OutputBufferSizePointer")[0]
 def OutputFilePointerEnum(): return StringToEnum("OutputFilePointer")[0]
 def ToolkitsFileNameEnum(): return StringToEnum("ToolkitsFileName")[0]
 def RootPathEnum(): return StringToEnum("RootPath")[0]
 def OutputFileNameEnum(): return StringToEnum("OutputFileName")[0]
 def InputFileNameEnum(): return StringToEnum("InputFileName")[0]
 def LockFileNameEnum(): return StringToEnum("LockFileName")[0]
+def RestartFileNameEnum(): return StringToEnum("RestartFileName")[0]
 def ToolkitsOptionsAnalysesEnum(): return StringToEnum("ToolkitsOptionsAnalyses")[0]
 def ToolkitsOptionsStringsEnum(): return StringToEnum("ToolkitsOptionsStrings")[0]
 def QmuErrNameEnum(): return StringToEnum("QmuErrName")[0]
@@ -861,10 +986,31 @@
 def PatersonEnum(): return StringToEnum("Paterson")[0]
 def ArrheniusEnum(): return StringToEnum("Arrhenius")[0]
 def LliboutryDuvalEnum(): return StringToEnum("LliboutryDuval")[0]
-def TransientIslevelsetEnum(): return StringToEnum("TransientIslevelset")[0]
+def SpclevelsetEnum(): return StringToEnum("Spclevelset")[0]
 def ExtrapolationVariableEnum(): return StringToEnum("ExtrapolationVariable")[0]
 def IceMaskNodeActivationEnum(): return StringToEnum("IceMaskNodeActivation")[0]
 def LevelsetfunctionSlopeXEnum(): return StringToEnum("LevelsetfunctionSlopeX")[0]
 def LevelsetfunctionSlopeYEnum(): return StringToEnum("LevelsetfunctionSlopeY")[0]
 def LevelsetfunctionPicardEnum(): return StringToEnum("LevelsetfunctionPicard")[0]
+def LevelsetReinitFrequencyEnum(): return StringToEnum("LevelsetReinitFrequency")[0]
+def SealevelriseSolutionEnum(): return StringToEnum("SealevelriseSolution")[0]
+def SealevelriseAnalysisEnum(): return StringToEnum("SealevelriseAnalysis")[0]
+def SealevelEnum(): return StringToEnum("Sealevel")[0]
+def SealevelEustaticEnum(): return StringToEnum("SealevelEustatic")[0]
+def SealevelriseDeltathicknessEnum(): return StringToEnum("SealevelriseDeltathickness")[0]
+def SealevelriseMaxiterEnum(): return StringToEnum("SealevelriseMaxiter")[0]
+def SealevelriseReltolEnum(): return StringToEnum("SealevelriseReltol")[0]
+def SealevelriseAbstolEnum(): return StringToEnum("SealevelriseAbstol")[0]
+def SealevelriseLoveHEnum(): return StringToEnum("SealevelriseLoveH")[0]
+def SealevelriseLoveKEnum(): return StringToEnum("SealevelriseLoveK")[0]
+def SealevelriseTideLoveHEnum(): return StringToEnum("SealevelriseTideLoveH")[0]
+def SealevelriseTideLoveKEnum(): return StringToEnum("SealevelriseTideLoveK")[0]
+def SealevelriseRigidEnum(): return StringToEnum("SealevelriseRigid")[0]
+def SealevelriseElasticEnum(): return StringToEnum("SealevelriseElastic")[0]
+def SealevelriseRotationEnum(): return StringToEnum("SealevelriseRotation")[0]
+def SealevelriseGElasticEnum(): return StringToEnum("SealevelriseGElastic")[0]
+def SealevelriseDegaccEnum(): return StringToEnum("SealevelriseDegacc")[0]
+def SealevelriseTransitionsEnum(): return StringToEnum("SealevelriseTransitions")[0]
+def SealevelriseRequestedOutputsEnum(): return StringToEnum("SealevelriseRequestedOutputs")[0]
+def SealevelriseNumRequestedOutputsEnum(): return StringToEnum("SealevelriseNumRequestedOutputs")[0]
 def MaximumNumberOfDefinitionsEnum(): return StringToEnum("MaximumNumberOfDefinitions")[0]

Modified: issm/trunk/src/m/exp/exptool.m
===================================================================
--- issm/trunk/src/m/exp/exptool.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/exp/exptool.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -15,6 +15,7 @@
 %      - marker (default='+')
 %      - markersize (default=7)
 %      - markeredgecolor (default='r')
+%      - nofigurecopy (default=0) do not copy current figure, this is needed on some plateform to avoid an offset in the figure
 %
 %   Usage:
 %      exptool(newfile,varargin)
@@ -97,26 +98,35 @@
 [path root ext]=fileparts(newfile);
 
 %get current figure
-if ~isempty(get(0,'children')),%if there is already a figure (return the number of opened figures)
-	set(gcf,'Renderer','zbuffer'); %fixes a bug on Mac OS X (not needed in future Matlab version)
-	P=get(gcf,'position');
-	F=getframe(gca);
-	F=F.cdata;
-	%get current axis
-	xlim=get(gca,'Xlim');
-	ylim=get(gca,'Ylim');
-	%recreate x_m and y_m
-	x_m=linspace(xlim(1),xlim(2),size(F,2));
-	y_m=linspace(ylim(2),ylim(1),size(F,1)); %getframe reverse axis...
-	%plot the data in another figure
-	figure; set(gcf,'position',P);
-	imagesc(x_m,y_m,F); set(gca,'Ydir','normal');
-	prevplot=1;
-	prevplot2=1;
+nofigurecopy=getfieldvalue(options,'nofigurecopy',1);
+if ~nofigurecopy,
+	if ~isempty(get(0,'children')),%if there is already a figure (return the number of opened figures)
+		set(gcf,'Renderer','zbuffer'); %fixes a bug on Mac OS X (not needed in future Matlab version)
+		P=get(gcf,'position');
+		Fp=get(gca,'position');
+		F=getframe(gca);
+		F=F.cdata;
+		%get current axis
+		xlim=get(gca,'Xlim');
+		ylim=get(gca,'Ylim');
+		%recreate x_m and y_m
+		x_m=linspace(xlim(1),xlim(2),size(F,2));
+		y_m=linspace(ylim(2),ylim(1),size(F,1)); %getframe reverse axis...
+		%plot the data in another figure
+		figure; set(gcf,'position',P);
+		imagesc(x_m,y_m,F); set(gca,'Ydir','normal','Position',Fp,'Xlim',xlim,'Ylim',ylim);
+		prevplot=1;
+		prevplot2=1;
+	else
+		figure
+		prevplot=0;
+		prevplot2=0;
+	end
 else
-	figure
-	prevplot=0;
-	prevplot2=0;
+	g=get(gca,'children');
+	L=length(g);
+	prevplot=L;
+	prevplot2=L;
 end
 
 %plot existing profile if any
@@ -347,4 +357,6 @@
 end
 
 %close window
-close;
+if ~nofigurecopy,
+	close;
+end

Modified: issm/trunk/src/m/exp/expwrite.m
===================================================================
--- issm/trunk/src/m/exp/expwrite.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/exp/expwrite.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -27,6 +27,14 @@
 end
 
 fid=fopen(filename,'w');
+if fid==-1,
+	choice=input(['WARNING: file ' filename ' could not be created, would you like to save your exp as ./temp_expwrite.exp? (y/n)'],'s');
+	if ~strcmpi(choice,'y'),
+		disp('no file written... exiting');
+		return
+	end
+	fid=fopen('./temp_expwrite.exp','w');
+end
 for n=1:length(a),
 	if(length(a(n).x)~=length(a(n).y)),
 		error('contours x and y coordinates must be of identical size');

Modified: issm/trunk/src/m/exp/expwrite.py
===================================================================
--- issm/trunk/src/m/exp/expwrite.py	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/exp/expwrite.py	2016-04-13 04:32:01 UTC (rev 20500)
@@ -2,9 +2,9 @@
 
 def expwrite(contours,filename):
 	"""
-	EXPWRITE - write an Argus file from a structure given in input
+	EXPWRITE - write an Argus file from a dictionary given in input
 
-	   This routine writes an Argus file from a list of dict's containing the fields:
+	   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.
@@ -19,25 +19,28 @@
 	"""
 
 	fid=open(filename,'w')
-	for contour in contours:
-		if numpy.size(contour['x'])!=numpy.size(contour['y']):
+	for x,y in zip(contours['x'],contours['y']):
+		#if numpy.size(contour['x'])!=numpy.size(contour['y']):
+		if len(x)!=len(y):
 			raise RuntimeError("contours x and y coordinates must be of identical size")
-   
-		if 'name' in contour:
-			fid.write("%s%s\n" % ('## Name:',contour['name']))
+		if 'name' in contours:
+			fid.write("%s%s\n" % ('## Name:',contours['name']))
 		else:
 			fid.write("%s%s\n" % ('## Name:',filename))
    
-		#Add density if it's not there
-		if 'density' not in contour:
-			contour['density']=1
+		#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" % (numpy.size(contour['x']),contour['density']))
+		#fid.write("%i %f\n" % (numpy.size(contour['x']),contour['density']))
+		fid.write("%i %f\n" % (numpy.size(x),density))
 		fid.write("%s\n" % '# X pos Y pos')
-		for x,y in zip(contour['x'],contour['y']):
-			fid.write("%10.10f %10.10f\n" % (x,y))
+		#for x,y in zip(contour['x'],contour['y']):
+		for xi,yi in zip(x,y):
+			fid.write("%10.10f %10.10f\n" % (xi,yi))
 		fid.write("\n")
 
 	fid.close()

Modified: issm/trunk/src/m/interp/ProfileValues.m
===================================================================
--- issm/trunk/src/m/interp/ProfileValues.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/interp/ProfileValues.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -1,12 +1,11 @@
 function [Z,data_interp]=ProfileValues(md,data,xprof,yprof,resolution)
 %PROFILEVALUES - compute the value of a field on a vertical profile
 %
-%   This routine gets the value of a given field of the model on points
-%   given by filname (Argus type file)
+%   This routine gets the value of a given field of the model on 
+%   a point given by its coordinates
 %
 %   Usage:
-%      [z,data]=ProfileValues(md,data,filename,resolution)
-%      [z,data]=ProfileValues(md,data,profile_structure,resolution)
+%      [z,data]=ProfileValues(md,data,xcoord,ycoord,resolution)
 
 %Get bed and surface for each 2d point, offset to make sure that it is inside the glacier system
 offset=10^-3;

Modified: issm/trunk/src/m/interp/SectionValues.py
===================================================================
--- issm/trunk/src/m/interp/SectionValues.py	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/interp/SectionValues.py	2016-04-13 04:32:01 UTC (rev 20500)
@@ -60,8 +60,8 @@
 		s_segment=npy.zeros(portion)
 
 		for j in xrange(int(portion)):
-			x_segment[j]=x_start+(j-1)*(x_end-x_start)/portion
-			y_segment[j]=y_start+(j-1)*(y_end-y_start)/portion
+			x_segment[j]=x_start+(j)*(x_end-x_start)/portion
+			y_segment[j]=y_start+(j)*(y_end-y_start)/portion
 			s_segment[j]=s_start+j*length_segment/portion
 	
 		#plug into X and Y

Modified: issm/trunk/src/m/interp/averaging.py
===================================================================
--- issm/trunk/src/m/interp/averaging.py	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/interp/averaging.py	2016-04-13 04:32:01 UTC (rev 20500)
@@ -1,7 +1,10 @@
 import numpy as npy
 from GetAreas import GetAreas
-from scipy.sparse import csc_matrix
 import MatlabFuncs as m
+try:
+	from scipy.sparse import csc_matrix
+except ImportError:
+	print "could not import scipy, no averaging capabilities enabled"
 
 def averaging(md,data,iterations,layer=0):
 	'''

Modified: issm/trunk/src/m/inversions/marshallcostfunctions.m
===================================================================
--- issm/trunk/src/m/inversions/marshallcostfunctions.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/inversions/marshallcostfunctions.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -12,4 +12,5 @@
 	pos=find(cost_functions==505); data(pos)=ThicknessAcrossGradientEnum();
 	pos=find(cost_functions==506); data(pos)=BalancethicknessMisfitEnum();
 	pos=find(cost_functions==507); data(pos)=RheologyBAbsGradientEnum();
+	pos=find(cost_functions==510); data(pos)=ThicknessPositiveEnum();
 	pos=find(cost_functions==601); data(pos)=SurfaceAbsMisfitEnum();

Modified: issm/trunk/src/m/inversions/supportedcostfunctions.m
===================================================================
--- issm/trunk/src/m/inversions/supportedcostfunctions.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/inversions/supportedcostfunctions.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -1,3 +1,3 @@
 function list = supportedcostfunctions(),
 
-	list = [101:105 201 501:507 601:604];
+	list = [101:105 201 501:507 510 601:604];

Modified: issm/trunk/src/m/io/structtonc.m
===================================================================
--- issm/trunk/src/m/io/structtonc.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/io/structtonc.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -27,7 +27,8 @@
 
 %Double vector
 elseif isa(field,'double') & size(field,2)==1,
-	if step==1,
+
+if step==1,
 		dim_id          = netcdf.defDim(ncid,[fieldname '_size1'],size(field,1));
 		var_id(counter) = netcdf.defVar(ncid,fieldname,'NC_DOUBLE',dim_id);
 	else

Modified: issm/trunk/src/m/mech/mechanicalproperties.m
===================================================================
--- issm/trunk/src/m/mech/mechanicalproperties.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/mech/mechanicalproperties.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -1,4 +1,4 @@
-function md=mechanicalproperties(md,vx,vy)
+function md=mechanicalproperties(md,vx,vy,varargin)
 %MECHANICALPROPERTIES - compute stress and strain rate for a goven velocity
 %
 %   this routine computes the components of the (deviatoric) stress tensor,
@@ -23,6 +23,10 @@
 	disp('Warning: the model has some non SSA elements. These will be treated like SSA''s elements');
 end
 
+%get damage, if passed
+options = pairoptions(varargin{:});
+damage = getfieldvalue(options,'damage',zeros(md.mesh.numberofvertices,1));
+
 %initialization
 numberofelements=md.mesh.numberofelements;
 index=md.mesh.elements;
@@ -61,7 +65,7 @@
 	location=find(second_inv==0 & power==0);
 	nu(location)=B_bar(location);
 elseif isa(md.materials,'matdamageice')
-	Zinv=md.materials.rheology_Z(index)*summation/3;
+	Zinv=1-damage(index)*summation/3;
 	location=find(second_inv~=0);
 	nu(location)=Zinv(location).*B_bar(location)./(second_inv(location).^power(location));
 	location=find(second_inv==0 & power==0);

Modified: issm/trunk/src/m/mech/mechanicalproperties.py
===================================================================
--- issm/trunk/src/m/mech/mechanicalproperties.py	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/mech/mechanicalproperties.py	2016-04-13 04:32:01 UTC (rev 20500)
@@ -3,7 +3,7 @@
 from results import results
 from averaging import averaging
 
-def mechanicalproperties(md,vx,vy):
+def mechanicalproperties(md,vx,vy,**kwargs):
 	"""
 	MECHANICALPROPERTIES - compute stress and strain rate for a goven velocity
 	
@@ -29,6 +29,15 @@
 	if npy.any(md.flowequation.element_equation!=2):
 		print 'Warning: the model has some non SSA elements. These will be treated like SSA elements'
 
+        #unpack kwargs
+	if 'damage' in kwargs: 
+	    damage=kwargs.pop('damage')
+            if len(damage)!=md.mesh.numberofvertices:
+		raise ValueError('if damage is supplied it should be of size ' + md.mesh.numberofvertices)
+            if npy.ndim(damage)==2:
+                damage=damage.reshape(-1,)
+        else: damage=None
+
 	if npy.ndim(vx)==2:
 		vx=vx.reshape(-1,)
 	if npy.ndim(vy)==2:
@@ -74,9 +83,9 @@
 		nu[location]=B_bar[location]
 		location=npy.nonzero(npy.logical_and(second_inv==0,power!=0))
 		nu[location]=10^18
-	elif 'matdamageice' in md.materials.__module__:
+	elif 'matdamageice' in md.materials.__module__ and damage is not None:
 		print 'computing damage-dependent properties!'
-		Zinv=npy.dot(1-md.damage.D[index-1],summation/3.).reshape(-1,)
+		Zinv=npy.dot(1-damage[index-1],summation/3.).reshape(-1,)
 		location=npy.nonzero(second_inv)
 		nu[location]=Zinv[location]*B_bar[location]/npy.power(second_inv[location],power[location])
 		location=npy.nonzero(npy.logical_and(second_inv==0,power==0))

Modified: issm/trunk/src/m/mesh/bamg.m
===================================================================
--- issm/trunk/src/m/mesh/bamg.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/mesh/bamg.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -234,7 +234,10 @@
 		track=getfieldvalue(options,'tracks');
 		if all(ischar(track)),
 			A=expread(track);
-			track=[A.x A.y];
+			track=[];
+			for i=1:length(A), 
+				track=[track; [A(i).x A(i).y]];
+			end
 		else
 			track=double(track); %for some reason, it is of class "single"
 		end

Modified: issm/trunk/src/m/mesh/rifts/meshaddrifts.m
===================================================================
--- issm/trunk/src/m/mesh/rifts/meshaddrifts.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/mesh/rifts/meshaddrifts.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -33,7 +33,7 @@
 	md2=modelextract(md,'Meshaddrifts.Contour.exp');
 
 	%create domain of md2 model: 
-	md2.mesh.segments=contourenvelope(md2,'Meshaddrifts.Contour.exp');
+	md2.mesh.segments=contourenvelope(md2.mesh,'Meshaddrifts.Contour.exp');
 	domain_index=md2.mesh.segments(1,1:2);
 	while (domain_index(end)~=domain_index(1)),
 		pos=find(md2.mesh.segments(:,1)==domain_index(end));

Modified: issm/trunk/src/m/mesh/rifts/meshprocessrifts.m
===================================================================
--- issm/trunk/src/m/mesh/rifts/meshprocessrifts.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/mesh/rifts/meshprocessrifts.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -62,3 +62,8 @@
 aires=GetAreas(md.mesh.elements,md.mesh.x,md.mesh.y);
 pos=find(aires<0);
 md.mesh.elements(pos,:)=[md.mesh.elements(pos,2) md.mesh.elements(pos,1) md.mesh.elements(pos,3)];
+
+%case of 3D surface mesh: 
+if strcmpi(class(md.mesh),'mesh3dsurface'),
+	md.mesh.z=md.mesh.x; md.mesh.z(:)=0;
+end

Modified: issm/trunk/src/m/mesh/roundmesh.py
===================================================================
--- issm/trunk/src/m/mesh/roundmesh.py	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/mesh/roundmesh.py	2016-04-13 04:32:01 UTC (rev 20500)
@@ -28,10 +28,10 @@
 	x_list=roundsigfig(radius*x_list*numpy.cos(theta),12)
 	y_list=roundsigfig(radius*y_list*numpy.sin(theta),12)
 	A=OrderedDict()
-	A['x']=x_list
-	A['y']=y_list
+	A['x']=[x_list]
+	A['y']=[y_list]
 	A['density']=1.
-	expwrite([A],'RoundDomainOutline.exp')
+	expwrite(A,'RoundDomainOutline.exp')
 
 	#Call Bamg
 	md=triangle(md,'RoundDomainOutline.exp',resolution)

Modified: issm/trunk/src/m/mesh/triangle.m
===================================================================
--- issm/trunk/src/m/mesh/triangle.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/mesh/triangle.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -40,21 +40,24 @@
 [elements,x,y,segments,segmentmarkers]=TriMesh(domainname,riftname,area);
 
 %check that all the created nodes belong to at least one element
-orphan=find(~ismember([1:length(x)],sort(unique(elements(:)))));
-for i=1:length(orphan),
-	disp('WARNING: removing orphans');
-	%get rid of the orphan node i
-	%update x and y
-	x=[x(1:orphan(i)-(i-1)-1); x(orphan(i)-(i-1)+1:end)];
-	y=[y(1:orphan(i)-(i-1)-1); y(orphan(i)-(i-1)+1:end)];
-	%update elements
-	pos=find(elements>orphan(i)-(i-1));
-	elements(pos)=elements(pos)-1;
-	%update segments
-	pos1=find(segments(:,1)>orphan(i)-(i-1));
-	pos2=find(segments(:,2)>orphan(i)-(i-1));
-	segments(pos1,1)=segments(pos1,1)-1;
-	segments(pos2,2)=segments(pos2,2)-1;
+removeorphans=1;
+if removeorphans,
+	orphan=find(~ismember([1:length(x)],sort(unique(elements(:)))));
+	for i=1:length(orphan),
+		disp('WARNING: removing orphans');
+		%get rid of the orphan node i
+		%update x and y
+		x=[x(1:orphan(i)-(i-1)-1); x(orphan(i)-(i-1)+1:end)];
+		y=[y(1:orphan(i)-(i-1)-1); y(orphan(i)-(i-1)+1:end)];
+		%update elements
+		pos=find(elements>orphan(i)-(i-1));
+		elements(pos)=elements(pos)-1;
+		%update segments
+		pos1=find(segments(:,1)>orphan(i)-(i-1));
+		pos2=find(segments(:,2)>orphan(i)-(i-1));
+		segments(pos1,1)=segments(pos1,1)-1;
+		segments(pos2,2)=segments(pos2,2)-1;
+	end
 end
 
 %plug into md

Modified: issm/trunk/src/m/os/issmbbftpin.m
===================================================================
--- issm/trunk/src/m/os/issmbbftpin.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/os/issmbbftpin.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -33,7 +33,7 @@
 	for i=1:length(packages),
 		command=[command 'get ' packages{i} ';'];
 	end
-	command=[command '''  pfe1.nas.nasa.gov'];
+	command=[command '''  pfe22.nas.nasa.gov'];
 
 	eval(command);
 

Modified: issm/trunk/src/m/os/issmbbftpout.m
===================================================================
--- issm/trunk/src/m/os/issmbbftpout.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/os/issmbbftpout.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -20,11 +20,11 @@
 else 
 
 	%build a string of the type: bbftp -s -u elarour -e 'setnbstream 8; cd /nobackupp10/elarour/Testing/Interactive3/; put Antarctica.tar.gz' pfe1.nas.nasa.gov
-	command=['!bbftp -s -V -u ' login ' -e ''setnbstream 8; cd ' path '; ']
+	command=['!bbftp -s -V -u ' login ' -e ''setnbstream 8; cd ' path '; '];
 	for i=1:length(packages),
 		command=[command 'put ' packages{i} ';'];
 	end
-	command=[command '''  pfe1.nas.nasa.gov'];
+	command=[command '''  pfe22.nas.nasa.gov'];
 
 	eval(command);
 end

Modified: issm/trunk/src/m/os/issmdir.m
===================================================================
--- issm/trunk/src/m/os/issmdir.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/os/issmdir.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -4,15 +4,24 @@
 %   Usage:
 %      ISSM_DIR=issmdir()
 
-if ~ispc(),
-	ISSM_DIR =getenv('ISSM_DIR');
+%Initialize output ISSM_DIR
+ISSM_DIR='';
+slash=filesep();
+
+%Get ISSM_DIR from function path (we do not want to force users to edit their bashrc)
+path=which('issmdir');
+
+%issmdir might be in bin,
+pos=strfind(path,['bin' slash 'issmdir.m']);
+if ~isempty(pos),
+	ISSM_DIR=path(1:pos-1);
 else
-	ISSM_DIR =getenv('ISSM_DIR_WIN');
-	if strcmpi(ISSM_DIR(end),'/') | strcmpi(ISSM_DIR(end),'\'),
-		ISSM_DIR = ISSM_DIR(1:end-1); %shave off the last '/'
+	pos=strfind(path,['src' slash 'm' slash 'os' slash 'issmdir.m']);
+	if ~isempty(pos),
+		ISSM_DIR=path(1:pos-1);
 	end
 end
 
-if (isempty(ISSM_DIR)),
-	error('issmdir error message: ''ISSM_DIR'' environment variable is empty! You should define ISSM_DIR in your .cshrc or .bashrc!');
+if isempty(ISSM_DIR),
+	error('Could not determine the location of ISSM...');
 end

Modified: issm/trunk/src/m/os/issmscpin.py
===================================================================
--- issm/trunk/src/m/os/issmscpin.py	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/os/issmscpin.py	2016-04-13 04:32:01 UTC (rev 20500)
@@ -54,18 +54,12 @@
 		else:
 			#just use standard unix scp
 			#string to copy multiple files using scp: 
-			if len(packages)==1:
-				string=packages[0]
-			else:
-				string='{'
-				for package in packages:
-					string+=packages[i]+','
-				string=string[:-1]+'}'
-
+			string='\{'+','.join([str(x) for x in packages])+'\}'
+			
 			if port:
-				subprocess.call('scp -P %d %s at localhost:%s %s' % (port,login,os.path.join(path,string),os.getcwd),shell=True)
+				subprocess.call('scp -P %d %s at localhost:%s %s/. ' % (port,login,os.path.join(path,string),os.getcwd()),shell=True)
 			else:
-				subprocess.call('scp %s@%s:%s %s' % (login,host,os.path.join(path,string),os.getcwd),shell=True)
+				subprocess.call('scp %s@%s:%s %s/.' % (login,host,os.path.join(path,string),os.getcwd()),shell=True)
 		
 			#check scp worked
 			for package in packages:

Modified: issm/trunk/src/m/os/oshostname.m
===================================================================
--- issm/trunk/src/m/os/oshostname.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/os/oshostname.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -1,25 +1,29 @@
 function hostname=oshostname()
-%OSHOSTNAME figure out hostname, irrespective of os type
+%OSHOSTNAME - Determine hostname, irrespective of os type
 %
-%   usage: hostname=oshostname();
-%
-%
+%   Usage:
+%      hostname=oshostname();
 
-if ispc(),
-	[status,hostname]=system('hostname');
-	if status, 
-		error('oshostname error message: could not run hostname command on windows os');
+%See http://www.mathworks.com/help/matlab/ref/system.html "tips" section
+%We need to add < /dev/null otherwise what is in the clipboard is added
+[status,hostname]=system('hostname < /dev/null');
+
+% If that command did not work, we have an alternative
+if status~=0,
+	if ispc
+		hostname = getenv('COMPUTERNAME');
+	else
+		hostname = getenv('HOSTNAME');
 	end
-else
-	%See http://www.mathworks.com/help/matlab/ref/system.html "tips" section
-	%We need to add < /dev/null otherwise what is in the clipboard is added
-	[status,hostname]=system('hostname < /dev/null');
-	hostname = strrep(hostname,'-','');
-	if status, 
-		error('oshostname error message: could not run hostname command on *nix os');
-	end
 end
 
-%remove carriage return and blank spaces
-hostname=hostname(1:end-1);
-hostname=ddewhite(hostname);
+% Take out minus signs
+hostname = strrep(hostname,'-','');
+
+% Trim and lower case
+hostname = strtrim(lower(hostname));
+
+% Check that machine name is not empty
+if isempty(hostname),
+	error('Cannot determine machine name');
+end

Modified: issm/trunk/src/m/parameterization/contourenvelope.m
===================================================================
--- issm/trunk/src/m/parameterization/contourenvelope.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/parameterization/contourenvelope.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -1,12 +1,12 @@
-function segments=contourenvelope(md,varargin)
+function segments=contourenvelope(mh,varargin)
 %CONTOURENVELOPE - build a set of segments enveloping a contour .exp
 %
 %   Usage:
-%      segments=contourenvelope(md,varargin)
+%      segments=contourenvelope(mh,varargin)
 %
 %   Example:
-%      segments=contourenvelope(md,'Stream.exp');
-%      segments=contourenvelope(md);
+%      segments=contourenvelope(mh,'Stream.exp');
+%      segments=contourenvelope(mh);
 
 %some checks
 if nargin>2,
@@ -32,27 +32,27 @@
 
 %Now, build the connectivity tables for this mesh.
 %Computing connectivity
-if (size(md.mesh.vertexconnectivity,1)~=md.mesh.numberofvertices & size(md.mesh.vertexconnectivity,1)~=md.mesh.numberofvertices2d),
-	md.mesh.vertexconnectivity=NodeConnectivity(md.mesh.elements,md.mesh.numberofvertices);
+if isnan(mh.vertexconnectivity),
+	mh.vertexconnectivity=NodeConnectivity(mh.elements,mh.numberofvertices);
 end
-if (size(md.mesh.elementconnectivity,1)~=md.mesh.numberofelements & size(md.mesh.elementconnectivity,1)~=md.mesh.numberofelements2d),
-	md.mesh.elementconnectivity=ElementConnectivity(md.mesh.elements,md.mesh.vertexconnectivity);
+if isnan(mh.elementconnectivity),
+	mh.elementconnectivity=ElementConnectivity(mh.elements,mh.vertexconnectivity);
 end
 
 %get nodes inside profile
-mesh.elementconnectivity=md.mesh.elementconnectivity;
-if dimension(md.mesh)==2,
-	mesh.elements=md.mesh.elements;
-	mesh.x=md.mesh.x;
-	mesh.y=md.mesh.y;
-	mesh.numberofvertices=md.mesh.numberofvertices;
-	mesh.numberofelements=md.mesh.numberofelements;
+mesh.elementconnectivity=mh.elementconnectivity;
+if dimension(mh)==2,
+	mesh.elements=mh.elements;
+	mesh.x=mh.x;
+	mesh.y=mh.y;
+	mesh.numberofvertices=mh.numberofvertices;
+	mesh.numberofelements=mh.numberofelements;
 else
-	mesh.elements=md.mesh.elements2d;
-	mesh.x=md.mesh.x2d;
-	mesh.y=md.mesh.y2d;
-	mesh.numberofvertices=md.mesh.numberofvertices2d;
-	mesh.numberofelements=md.mesh.numberofelements2d;
+	mesh.elements=mh.elements2d;
+	mesh.x=mh.x2d;
+	mesh.y=mh.y2d;
+	mesh.numberofvertices=mh.numberofvertices2d;
+	mesh.numberofelements=mh.numberofelements2d;
 end
 
 if nargin==2,

Modified: issm/trunk/src/m/parameterization/setflowequation.m
===================================================================
--- issm/trunk/src/m/parameterization/setflowequation.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/parameterization/setflowequation.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -257,8 +257,6 @@
 
 %Create vertices_type
 md.flowequation.vertex_equation=zeros(md.mesh.numberofvertices,1);
-pos=find(nodeonSIA);
-md.flowequation.vertex_equation(pos)=1;
 pos=find(nodeonSSA);
 md.flowequation.vertex_equation(pos)=2;
 pos=find(nodeonL1L2);
@@ -267,6 +265,9 @@
 md.flowequation.vertex_equation(pos)=4;
 pos=find(nodeonFS);
 md.flowequation.vertex_equation(pos)=5;
+%DO SIA LAST! Otherwise spcs might not be set up correctly (SIA should have priority)
+pos=find(nodeonSIA);
+md.flowequation.vertex_equation(pos)=1;
 if any(FSflag),
 	pos=find(~nodeonFS);
 	if(~any(HOflag) & ~any(SSAflag)),

Modified: issm/trunk/src/m/parameterization/setflowequation.py
===================================================================
--- issm/trunk/src/m/parameterization/setflowequation.py	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/parameterization/setflowequation.py	2016-04-13 04:32:01 UTC (rev 20500)
@@ -245,8 +245,6 @@
 
 	#Create vertices_type
 	md.flowequation.vertex_equation=numpy.zeros(md.mesh.numberofvertices,int)
-	pos=numpy.nonzero(nodeonSIA)
-	md.flowequation.vertex_equation[pos]=1
 	pos=numpy.nonzero(nodeonSSA)
 	md.flowequation.vertex_equation[pos]=2
 	pos=numpy.nonzero(nodeonL1L2)
@@ -255,6 +253,9 @@
 	md.flowequation.vertex_equation[pos]=4
 	pos=numpy.nonzero(nodeonFS)
 	md.flowequation.vertex_equation[pos]=5
+	#DO SIA LAST! Otherwise spcs might not be set up correctly (SIA should have priority)
+	pos=numpy.nonzero(nodeonSIA)
+	md.flowequation.vertex_equation[pos]=1
 	if any(FSflag):
 		pos=numpy.nonzero(numpy.logical_not(nodeonFS))
 		if not (any(HOflag) or any(SSAflag)):

Modified: issm/trunk/src/m/plot/applyoptions.m
===================================================================
--- issm/trunk/src/m/plot/applyoptions.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/plot/applyoptions.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -98,6 +98,11 @@
 	basinzoom(options);
 end
 
+%Zoom
+if exist(options,'zoom');
+	zoom(getfieldvalue(options,'zoom',2));
+end
+
 %ShowBasins
 if strcmpi(getfieldvalue(options,'showbasins','off'),'on')
 	showbasins(options);
@@ -276,7 +281,9 @@
 		textpositioni=textposition{i};
 		textrotationi=textrotation{i};
 		h=text(textpositioni(1),textpositioni(2),10,textstringi,'FontSize',textsizei,'FontWeight',textweighti,'Color',textcolori,'Rotation',textrotationi);
-		set(h,'Clipping','on'); %prevent text from appearing outside of the box
+		if strcmpi(getfieldvalue(options,'textclip','on'),'on'),
+			set(h,'Clipping','on'); %prevent text from appearing outside of the box
+		end
 	end
 end
 

Modified: issm/trunk/src/m/plot/applyoptions.py
===================================================================
--- issm/trunk/src/m/plot/applyoptions.py	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/plot/applyoptions.py	2016-04-13 04:32:01 UTC (rev 20500)
@@ -1,10 +1,13 @@
 import numpy as npy
 from cmaptools import truncate_colormap
 from plot_contour import plot_contour
+from plot_streamlines import plot_streamlines
+from expdisp import expdisp
 
 try:
 	from matplotlib.ticker import MaxNLocator
 	from mpl_toolkits.axes_grid1 import make_axes_locatable
+	from mpl_toolkits.mplot3d import Axes3D
 	import matplotlib as mpl
 	import pylab as p
 	import matplotlib.pyplot as plt
@@ -131,6 +134,10 @@
 	#}}}
 
 	#view
+	#if int(md.mesh.dimension) == 3 and options.exist('layer'):
+	#	#options.getfieldvalue('view') ?
+	#	ax=fig.gca(projection='3d')
+	#plt.show()
 
 	#axis {{{
 	if options.exist('axis'):
@@ -141,6 +148,8 @@
 	# }}}
 
 	#box
+	if options.exist('box'):
+		eval(options.getfieldvalue('box'))
 
 	#xlim, ylim, zlim {{{
 	if options.exist('xlim'):
@@ -171,6 +180,7 @@
 	#}}}
 
 	#shading
+	#if options.exist('shading'):
 
 	#grid {{{
 	if options.exist('grid'):
@@ -205,53 +215,74 @@
 
 	#colorbar {{{
 	if options.getfieldvalue('colorbar',1)==1:
-		if cbar_extend==0:
-			extend='neither'
-		elif cbar_extend==1:
-			extend='max'
-		elif cbar_extend==2:
-			extend='min'
-		elif cbar_extend==3:
-			extend='both'
-		cb = mpl.colorbar.ColorbarBase(ax.cax, cmap=cmap, norm=norm, extend=extend)
-		if options.exist('alpha'):
-			cb.set_alpha(options.getfieldvalue('alpha'))
-		if options.exist('colorbarnumticks'):
-			cb.locator=MaxNLocator(nbins=options.getfieldvalue('colorbarnumticks',5))
-		else:
-			cb.locator=MaxNLocator(nbins=5) # default 5 ticks
-		if options.exist('colorbartickspacing'):
-			locs=npy.arange(lims[0],lims[1]+1,options.getfieldvalue('colorbartickspacing'))
-			cb.set_ticks(locs)
-		if options.exist('colorbarlines'):
-			locs=npy.arange(lims[0],lims[1]+1,options.getfieldvalue('colorbarlines'))
-			cb.add_lines(locs,['k' for i in range(len(locs))],npy.ones_like(locs))
-		if options.exist('colorbartitle'):
-			if options.exist('colorbartitlepad'):
-				cb.set_label(options.getfieldvalue('colorbartitle'),\
-						labelpad=options.getfieldvalue('colorbartitlepad'),fontsize=fontsize)
-			else:
-				cb.set_label(options.getfieldvalue('colorbartitle'),fontsize=fontsize)
-		cb.ax.tick_params(labelsize=fontsize)
-		cb.update_ticks()
-		plt.sca(ax) # return to original axes control
+	    if cbar_extend==0:
+	    	extend='neither'
+	    elif cbar_extend==1:
+	    	extend='max'
+	    elif cbar_extend==2:
+	    	extend='min'
+	    elif cbar_extend==3:
+	    	extend='both'
+	    cb = mpl.colorbar.ColorbarBase(ax.cax, cmap=cmap, norm=norm, extend=extend)
+	    if options.exist('alpha'):
+	    	cb.set_alpha(options.getfieldvalue('alpha'))
+	    if options.exist('colorbarnumticks'):
+	    	cb.locator=MaxNLocator(nbins=options.getfieldvalue('colorbarnumticks',5))
+	    else:
+	    	cb.locator=MaxNLocator(nbins=5) # default 5 ticks
+	    if options.exist('colorbartickspacing'):
+	    	locs=npy.arange(lims[0],lims[1]+1,options.getfieldvalue('colorbartickspacing'))
+	    	cb.set_ticks(locs)
+	    if options.exist('colorbarlines'):
+	    	locs=npy.arange(lims[0],lims[1]+1,options.getfieldvalue('colorbarlines'))
+	    	cb.add_lines(locs,['k' for i in range(len(locs))],npy.ones_like(locs))
+	    if options.exist('colorbarlineatvalue'):
+                locs=options.getfieldvalue('colorbarlineatvalue')
+                colors=options.getfieldvalue('colorbarlineatvaluecolor',['k' for i in range (len(locs))])
+                widths=options.getfieldvalue('colorbarlineatvaluewidth',npy.ones_like(locs))
+                cb.add_lines(locs,colors,widths)
+	    if options.exist('colorbartitle'):
+	        if options.exist('colorbartitlepad'):
+	    	    cb.set_label(options.getfieldvalue('colorbartitle'),\
+                            labelpad=options.getfieldvalue('colorbartitlepad'),fontsize=fontsize)
+	    	else:
+	    	    cb.set_label(options.getfieldvalue('colorbartitle'),fontsize=fontsize)
+	    cb.ax.tick_params(labelsize=fontsize)
+            cb.solids.set_rasterized(True)
+	    cb.update_ticks()
+            cb.set_alpha(1)
+            cb.draw_all()
+	    plt.sca(ax) # return to original axes control
 	#}}}
 
+        #expdisp {{{
+        if options.exist('expdisp'):
+            filename=options.getfieldvalue('expdisp')
+            style=options.getfieldvalue('expstyle','k')
+            linewidth=options.getfieldvalue('explinewidth',1)
+            for i in xrange(len(filename)):
+                filenamei=filename[i]
+                stylei=style[i]
+                if type(linewidth)==list:
+                    linewidthi=linewidth[i]
+                else:
+                    linewidthi=linewidth
+                expdisp(filenamei,ax,linestyle=stylei,linewidth=linewidthi,unitmultiplier=options.getfieldvalue('unit',1))
+        #}}}
+
 	#area
 
-	#expdisp
-
 	#text {{{
 	if options.exist('text'):
-		text=options.getfieldvalue('text')
-		textx=options.getfieldvalue('textx')
-		texty=options.getfieldvalue('texty')
-		textsize=options.getfieldvalue('textsize')
-		textcolor=options.getfieldvalue('textcolor')
-		textweight=options.getfieldvalue('textweight')
-		textrotation=options.getfieldvalue('textrotation')
-		for label,x,y,size,color,weight,rotation in zip(text,textx,texty,textsize,textcolor,textweight,textrotation):
-			ax.text(x,y,label,transform=ax.transAxes,fontsize=size,color=color,weight=weight,rotation=rotation)
+	    text=options.getfieldvalue('text')
+	    textx=options.getfieldvalue('textx')
+	    texty=options.getfieldvalue('texty')
+	    textcolor=options.getfieldvalue('textcolor')
+	    textweight=options.getfieldvalue('textweight')
+	    textrotation=options.getfieldvalue('textrotation')
+            textfontsize=options.getfieldvalue('textfontsize')
+	    for label,x,y,size,color,weight,rotation in zip(text,textx,texty,textfontsize,textcolor,textweight,textrotation):
+                ax.text(x,y,label,transform=ax.transAxes,fontsize=size,color=color,weight=weight,rotation=rotation)
 	#}}}
 
 	#north arrow
@@ -259,6 +290,8 @@
 	#scale ruler
 
 	#streamlines
+        if options.exist('streamlines'):
+            plot_streamlines(md,options,ax)
 
 
 	#axis positions

Modified: issm/trunk/src/m/plot/checkplotoptions.py
===================================================================
--- issm/trunk/src/m/plot/checkplotoptions.py	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/plot/checkplotoptions.py	2016-04-13 04:32:01 UTC (rev 20500)
@@ -60,16 +60,20 @@
 		textpos=options.getfieldvalue('textposition',[0.5,0.5])
 		if not isinstance(textpos,list):
 			raise Exception('textposition should be passed as a list')
-		textx=[item[0] for item in textpos]
-		texty=[item[1] for item in textpos]
+                if any(isinstance(i,list) for i in textpos):
+		    textx=[item[0] for item in textpos]
+		    texty=[item[1] for item in textpos]
+                else:
+                    textx=[textpos[0]]
+                    texty=[textpos[1]]
 		if len(textx)!=numtext or len(texty)!=numtext:
 			raise Exception('textposition should contain one list of x,y vertices for every text instance')
 
 		# font size
-		if options.exist('textsize'):
-			textsize=options.getfieldvalue('textsize',12)
+		if options.exist('textfontsize'):
+			textfontsize=options.getfieldvalue('textfontsize',12)
 			sizelist=[]
-			sizelist.extend(textsize if isinstance(textsize,list) else [textsize])
+			sizelist.extend(textsize if isinstance(textfontsize,list) else [textfontsize])
 		else:
 			sizelist=[12]
 		if len(sizelist)==1:
@@ -87,9 +91,9 @@
 
 		# textweight
 		if options.exist('textweight'):
-			textweightvalues=options.getfieldvalue('textweight')
+			textweight=options.getfieldvalue('textweight')
 			weightlist=[]
-			weightlist.extend(textweight if isinstance(textwieght,list) else [textweight])
+			weightlist.extend(textweight if isinstance(textweight,list) else [textweight])
 		else:
 			weightlist=['normal']
 		if len(weightlist)==1:
@@ -108,7 +112,7 @@
 		options.changefieldvalue('text',textlist)
 		options.addfield('textx',textx)
 		options.addfield('texty',texty)
-		options.changefieldvalue('textsize',sizelist)
+		options.changefieldvalue('textfontsize',sizelist)
 		options.changefieldvalue('textcolor',colorlist)
 		options.changefieldvalue('textweight',weightlist)
 		options.changefieldvalue('textrotation',rotationlist)

Modified: issm/trunk/src/m/plot/colormaps/lbmap.m
===================================================================
--- issm/trunk/src/m/plot/colormaps/lbmap.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/plot/colormaps/lbmap.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -55,6 +55,8 @@
 		baseMap = BrownBlueMap;
 	case 'redblue'
 		baseMap = RedBlueMap;
+	case 'bluered'
+		baseMap = BlueRedMap;
 	otherwise
 		error(['Invalid scheme ' scheme])
 	end
@@ -107,3 +109,16 @@
 	68 199 239;
 	0 170 226;
 	0 116 188]/255;
+
+function baseMap = BlueRedMap
+	baseMap = [0 116 188;
+	0 170 226;
+	68 199 239;
+	154 217 238;
+	216 236 241;
+	242 238 197;
+	249 216 168;
+	245 177 139;
+	239 133 122;
+	216  82  88;
+	175  53  71]/255;

Modified: issm/trunk/src/m/plot/googlemaps.m
===================================================================
--- issm/trunk/src/m/plot/googlemaps.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/plot/googlemaps.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -39,8 +39,16 @@
 			[linspace(xlim(1),xlim(2),100) linspace(xlim(2),xlim(2),100) linspace(xlim(2),xlim(1),100) linspace(xlim(1),xlim(1),100)],...
 			[linspace(ylim(1),ylim(1),100) linspace(ylim(1),ylim(2),100) linspace(ylim(2),ylim(2),100) linspace(ylim(2),ylim(1),100)],...
 			-1,0,71);
+	elseif md.mesh.epsg==26906, %UTM 6V Columbia Glacier Alaska
+		[latlist lonlist]= utm2ll(...
+			[linspace(xlim(1),xlim(2),100) linspace(xlim(2),xlim(2),100) linspace(xlim(2),xlim(1),100) linspace(xlim(1),xlim(1),100)],...
+			[linspace(ylim(1),ylim(1),100) linspace(ylim(1),ylim(2),100) linspace(ylim(2),ylim(2),100) linspace(ylim(2),ylim(1),100)],...
+			6);
+	elseif numel(md.mesh.lat)==numel(md.mesh.x),
+		latlist = md.mesh.lat; %That might work?
+		lonlist = md.mesh.long;
 	else
-		error('EPSG code not supported yet');
+		error('EPSG code not supported yet, and no lat long found in md.mesh');
 	end
 
 	%Image corners in lat/long

Modified: issm/trunk/src/m/plot/manualcb.m
===================================================================
--- issm/trunk/src/m/plot/manualcb.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/plot/manualcb.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -67,12 +67,21 @@
 
 %Display colorbar
 hold on
+numcolors=size(cmap,1);
 if strcmpi(getfieldvalue(options,'orientation','vertical'),'vertical'),
-	image_rgb = ind2rgb(repmat(uint16(1:length(cmap))',1,2),cmap);
+	image_rgb = ind2rgb(repmat((1:numcolors)',1,2),cmap);
 else
-	image_rgb = ind2rgb(repmat(uint16(1:length(cmap))',1,2)',cmap);
+	image_rgb = ind2rgb(repmat((1:numcolors)',1,2)',cmap);
 end
-imagesc([0 1],[0 1],image_rgb);
+if 1,
+	%disappears somtimes
+	imagesc([0 1],[0 1],repmat(image_rgb,[1 10 1]));
+else
+	%Creates triangles when exported as pdf
+	for i=1:numcolors,
+		patch([0,0,1,1],[(i-1)/numcolors,i/numcolors,i/numcolors,(i-1)/numcolors],'none','FaceColor',cmap(i,:),'Clipping','off','EdgeColor','none')
+	end
+end
 patch([0,0,1,1],[0,1,1,0],'k','FaceColor','none','Clipping','off')
 
 %Add ticks

Modified: issm/trunk/src/m/plot/plot_BC.m
===================================================================
--- issm/trunk/src/m/plot/plot_BC.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/plot/plot_BC.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -1,7 +1,7 @@
 function plot_BC(md,options,width,i,data)
 
 %plot neuman
-plot_icefront(md,options,width,i,data)
+h0 = plot_icefront(md,options,width,i,data);
 
 hold on
 
@@ -27,19 +27,13 @@
 		'yo','MarkerSize',6 ,'MarkerFaceColor','y');
 end
 
-%update legend
-[legend_h,object_h,plot_h,text_strings]=legend();
-legend('off');
-if strcmpi(dirichleton,'on'),
-	text_strings{end+1}='vx Dirichlet';
-	text_strings{end+1}='vy Dirichlet';
-	if h3, text_strings{end+1}='vz Dirichlet'; end
-	plot_h(end+1)=h1;
-	plot_h(end+1)=h2;
-	if h3, plot_h(end+1)=h3; end
-end
-legend(plot_h,text_strings,'location','NorthEast')
+strings = {'Neumann'};
+if ~isempty(h1), strings{end+1} = 'vx Dirichlet'; end
+if ~isempty(h2), strings{end+1} = 'vy Dirichlet'; end
+if ~isempty(h3), strings{end+1} = 'vz Dirichlet'; end
 
+legend([h0,h1,h2,h3],strings,'location','NorthEast');
+
 hold off
 
 %apply options

Modified: issm/trunk/src/m/plot/plot_contour.py
===================================================================
--- issm/trunk/src/m/plot/plot_contour.py	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/plot/plot_contour.py	2016-04-13 04:32:01 UTC (rev 20500)
@@ -1,7 +1,10 @@
 from averaging import averaging
-import matplotlib.pyplot as plt
 from processmesh import processmesh
 from processdata import processdata
+try:
+	import matplotlib.pyplot as plt
+except ImportError:
+	print "could not import pylab, matplotlib has not been installed, no plotting capabilities enabled"
 
 def plot_contour(md,datain,options,ax):
 	'''

Modified: issm/trunk/src/m/plot/plot_elementstype.m
===================================================================
--- issm/trunk/src/m/plot/plot_elementstype.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/plot/plot_elementstype.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -16,101 +16,99 @@
 %plot
 subplot(width,width,i);
 
-plot_unit(x,y,z,elements,data,is2d,isplanet,datatype,options);
-return;
 if is2d
-	posNONE=find(data==0);
-	A=elements(posNONE,1); B=elements(posNONE,2); C=elements(posNONE,3); 
+	pos=find(data==0);
+	A=elements(pos,1); B=elements(pos,2); C=elements(pos,3); 
 	p1=patch( 'Faces', [A B C], 'Vertices', [x y z],'CData',0,'FaceColor','flat','EdgeColor',edgecolor);
-	posH=find(data==1);
-	A=elements(posH,1); B=elements(posH,2); C=elements(posH,3); 
-	p2=patch( 'Faces', [A B C], 'Vertices', [x y z],'CData',1,'FaceColor','flat','EdgeColor',edgecolor);
-	posM=find(data==2);
-	A=elements(posM,1); B=elements(posM,2); C=elements(posM,3); 
-	posM=find(data==3);
-	A=elements(posM,1); B=elements(posM,2); C=elements(posM,3); 
-	p4=patch( 'Faces', [A B C], 'Vertices', [x y z],'CData',2,'FaceColor','flat','EdgeColor',edgecolor);
-	posP=find(data==4);
-	A=elements(posP,1); B=elements(posP,2); C=elements(posP,3); 
-	p5=patch( 'Faces', [A B C], 'Vertices', [x y z],'CData',3,'FaceColor','flat','EdgeColor',edgecolor);
-	posS=find(data==5);
-	A=elements(posS,1); B=elements(posS,2); C=elements(posS,3); 
-	p6=patch( 'Faces', [A B C], 'Vertices', [x y z],'CData',4,'FaceColor','flat','EdgeColor',edgecolor);
-	posMP=find(data==6);
-	A=elements(posMP,1); B=elements(posMP,2); C=elements(posMP,3); 
-	p7=patch( 'Faces', [A B C], 'Vertices', [x y z],'CData',5,'FaceColor','flat','EdgeColor',edgecolor);
-	posPS=find(data==7);
-	A=elements(posPS,1); B=elements(posPS,2); C=elements(posPS,3); 
-	p8=patch( 'Faces', [A B C], 'Vertices', [x y z],'CData',7,'FaceColor','flat','EdgeColor',edgecolor);
-	posMS=find(data==8);
-	A=elements(posMS,1); B=elements(posMS,2); C=elements(posMS,3); 
-	p9=patch( 'Faces', [A B C], 'Vertices', [x y z],'CData',6,'FaceColor','flat','EdgeColor',edgecolor);
+	pos=find(data==1);
+	A=elements(pos,1); B=elements(pos,2); C=elements(pos,3); 
+	p2=patch( 'Faces', [A B C], 'Vertices', [x y z],'CData',2,'FaceColor','flat','EdgeColor',edgecolor);
+	pos=find(data==2);
+	A=elements(pos,1); B=elements(pos,2); C=elements(pos,3); 
+	p3=patch( 'Faces', [A B C], 'Vertices', [x y z],'CData',3,'FaceColor','flat','EdgeColor',edgecolor);
+	pos=find(data==3);
+	A=elements(pos,1); B=elements(pos,2); C=elements(pos,3); 
+	p4=patch( 'Faces', [A B C], 'Vertices', [x y z],'CData',4,'FaceColor','flat','EdgeColor',edgecolor);
+	pos=find(data==4);
+	A=elements(pos,1); B=elements(pos,2); C=elements(pos,3); 
+	p5=patch( 'Faces', [A B C], 'Vertices', [x y z],'CData',5,'FaceColor','flat','EdgeColor',edgecolor);
+	pos=find(data==5);
+	A=elements(pos,1); B=elements(pos,2); C=elements(pos,3); 
+	p6=patch( 'Faces', [A B C], 'Vertices', [x y z],'CData',6,'FaceColor','flat','EdgeColor',edgecolor);
+	pos=find(data==6);
+	A=elements(pos,1); B=elements(pos,2); C=elements(pos,3); 
+	p7=patch( 'Faces', [A B C], 'Vertices', [x y z],'CData',7,'FaceColor','flat','EdgeColor',edgecolor);
+	pos=find(data==7);
+	A=elements(pos,1); B=elements(pos,2); C=elements(pos,3); 
+	p8=patch( 'Faces', [A B C], 'Vertices', [x y z],'CData',8,'FaceColor','flat','EdgeColor',edgecolor);
+	pos=find(data==8);
+	A=elements(pos,1); B=elements(pos,2); C=elements(pos,3); 
+	p9=patch( 'Faces', [A B C], 'Vertices', [x y z],'CData',9,'FaceColor','flat','EdgeColor',edgecolor);
 else
-	PosNONE=find(data==0);
-	A=elements(PosNONE,1); B=elements(PosNONE,2); C=elements(PosNONE,3); D=elements(PosNONE,4); E=elements(PosNONE,5); F=elements(PosNONE,6);
+	pos=find(data==0);
+	A=elements(pos,1); B=elements(pos,2); C=elements(pos,3); D=elements(pos,4); E=elements(pos,5); F=elements(pos,6);
 	p1=patch( 'Faces', [A B C],'Vertices', [x y z],'CData', 0,'FaceColor','flat','EdgeColor',edgecolor);
 	patch( 'Faces', [D E F],  'Vertices', [x y z],'CData', 0,'FaceColor','flat','EdgeColor',edgecolor);
 	patch( 'Faces', [A B E D],'Vertices', [x y z],'CData', 0,'FaceColor','flat','EdgeColor',edgecolor);
 	patch( 'Faces', [B E F C],'Vertices', [x y z],'CData', 0,'FaceColor','flat','EdgeColor',edgecolor);
 	patch( 'Faces', [C A D F],'Vertices', [x y z],'CData', 0,'FaceColor','flat','EdgeColor',edgecolor);
-	posH=find(data==1);
-	A=elements(posH,1); B=elements(posH,2); C=elements(posH,3); D=elements(posH,4); E=elements(posH,5); F=elements(posH,6);
+	pos=find(data==1);
+	A=elements(pos,1); B=elements(pos,2); C=elements(pos,3); D=elements(pos,4); E=elements(pos,5); F=elements(pos,6);
 	p2=patch( 'Faces', [A B C],'Vertices', [x y z],'CData', 1,'FaceColor','flat','EdgeColor',edgecolor);
 	patch( 'Faces', [D E F],  'Vertices', [x y z],'CData', 1,'FaceColor','flat','EdgeColor',edgecolor);
 	patch( 'Faces', [A B E D],'Vertices', [x y z],'CData', 1,'FaceColor','flat','EdgeColor',edgecolor);
 	patch( 'Faces', [B E F C],'Vertices', [x y z],'CData', 1,'FaceColor','flat','EdgeColor',edgecolor);
 	patch( 'Faces', [C A D F],'Vertices', [x y z],'CData', 1,'FaceColor','flat','EdgeColor',edgecolor);
-	posM=find(data==2);
-	A=elements(posM,1); B=elements(posM,2); C=elements(posM,3); D=elements(posM,4); E=elements(posM,5); F=elements(posM,6);
+	pos=find(data==2);
+	A=elements(pos,1); B=elements(pos,2); C=elements(pos,3); D=elements(pos,4); E=elements(pos,5); F=elements(pos,6);
 	p3=patch( 'Faces', [A B C],'Vertices', [x y z],'CData', 2,'FaceColor','flat','EdgeColor',edgecolor);
 	patch( 'Faces', [D E F],  'Vertices', [x y z],'CData', 2,'FaceColor','flat','EdgeColor',edgecolor);
 	patch( 'Faces', [A B E D],'Vertices', [x y z],'CData', 2,'FaceColor','flat','EdgeColor',edgecolor);
 	patch( 'Faces', [B E F C],'Vertices', [x y z],'CData', 2,'FaceColor','flat','EdgeColor',edgecolor);
 	patch( 'Faces', [C A D F],'Vertices', [x y z],'CData', 2,'FaceColor','flat','EdgeColor',edgecolor);
-	posP=find(data==3);
-	A=elements(posP,1); B=elements(posP,2); C=elements(posP,3); D=elements(posP,4); E=elements(posP,5); F=elements(posP,6);
+	pos=find(data==3);
+	A=elements(pos,1); B=elements(pos,2); C=elements(pos,3); D=elements(pos,4); E=elements(pos,5); F=elements(pos,6);
 	p4=patch( 'Faces', [A B C],'Vertices', [x y z],'CData', 3,'FaceColor','flat','EdgeColor',edgecolor);
 	patch( 'Faces', [D E F],  'Vertices', [x y z],'CData', 3,'FaceColor','flat','EdgeColor',edgecolor);
 	patch( 'Faces', [A B E D],'Vertices', [x y z],'CData', 3,'FaceColor','flat','EdgeColor',edgecolor);
 	patch( 'Faces', [B E F C],'Vertices', [x y z],'CData', 3,'FaceColor','flat','EdgeColor',edgecolor);
 	patch( 'Faces', [C A D F],'Vertices', [x y z],'CData', 3,'FaceColor','flat','EdgeColor',edgecolor);
-	posP=find(data==3);
-	A=elements(posP,1); B=elements(posP,2); C=elements(posP,3); D=elements(posP,4); E=elements(posP,5); F=elements(posP,6);
+	pos=find(data==3);
+	A=elements(pos,1); B=elements(pos,2); C=elements(pos,3); D=elements(pos,4); E=elements(pos,5); F=elements(pos,6);
 	p5=patch( 'Faces', [A B C],'Vertices', [x y z],'CData', 3,'FaceColor','flat','EdgeColor',edgecolor);
 	patch( 'Faces', [D E F],  'Vertices', [x y z],'CData', 3,'FaceColor','flat','EdgeColor',edgecolor);
 	patch( 'Faces', [A B E D],'Vertices', [x y z],'CData', 3,'FaceColor','flat','EdgeColor',edgecolor);
 	patch( 'Faces', [B E F C],'Vertices', [x y z],'CData', 3,'FaceColor','flat','EdgeColor',edgecolor);
 	patch( 'Faces', [C A D F],'Vertices', [x y z],'CData', 3,'FaceColor','flat','EdgeColor',edgecolor);
-	posS=find(data==4);
-	A=elements(posS,1); B=elements(posS,2); C=elements(posS,3); D=elements(posS,4); E=elements(posS,5); F=elements(posS,6);
+	pos=find(data==4);
+	A=elements(pos,1); B=elements(pos,2); C=elements(pos,3); D=elements(pos,4); E=elements(pos,5); F=elements(pos,6);
 	p6=patch( 'Faces', [A B C],'Vertices', [x y z],'CData', 4,'FaceColor','flat','EdgeColor',edgecolor);
 	patch( 'Faces', [D E F],  'Vertices', [x y z],'CData', 4,'FaceColor','flat','EdgeColor',edgecolor);
 	patch( 'Faces', [A B E D],'Vertices', [x y z],'CData', 4,'FaceColor','flat','EdgeColor',edgecolor);
 	patch( 'Faces', [B E F C],'Vertices', [x y z],'CData', 4,'FaceColor','flat','EdgeColor',edgecolor);
 	patch( 'Faces', [C A D F],'Vertices', [x y z],'CData', 4,'FaceColor','flat','EdgeColor',edgecolor);
-	posP=find(data==5);
-	A=elements(posP,1); B=elements(posP,2); C=elements(posP,3); D=elements(posP,4); E=elements(posP,5); F=elements(posP,6);
+	pos=find(data==5);
+	A=elements(pos,1); B=elements(pos,2); C=elements(pos,3); D=elements(pos,4); E=elements(pos,5); F=elements(pos,6);
 	p7=patch( 'Faces', [A B C],'Vertices', [x y z],'CData', 5,'FaceColor','flat','EdgeColor',edgecolor);
 	patch( 'Faces', [D E F],  'Vertices', [x y z],'CData', 5,'FaceColor','flat','EdgeColor',edgecolor);
 	patch( 'Faces', [A B E D],'Vertices', [x y z],'CData', 5,'FaceColor','flat','EdgeColor',edgecolor);
 	patch( 'Faces', [B E F C],'Vertices', [x y z],'CData', 5,'FaceColor','flat','EdgeColor',edgecolor);
 	patch( 'Faces', [C A D F],'Vertices', [x y z],'CData', 5,'FaceColor','flat','EdgeColor',edgecolor);
 	%HOFS elements
-	PosPS=find(data==7);
-	A=elements(PosPS,1); B=elements(PosPS,2); C=elements(PosPS,3); D=elements(PosPS,4); E=elements(PosPS,5); F=elements(PosPS,6);
+	pos=find(data==7);
+	A=elements(pos,1); B=elements(pos,2); C=elements(pos,3); D=elements(pos,4); E=elements(pos,5); F=elements(pos,6);
 	p8=patch( 'Faces', [A B C],'Vertices', [x y z],'CData', 7,'FaceColor','flat','EdgeColor',edgecolor);
 	patch( 'Faces', [D E F],  'Vertices', [x y z],'CData', 7,'FaceColor','flat','EdgeColor',edgecolor);
 	patch( 'Faces', [A B E D],'Vertices', [x y z],'CData', 7,'FaceColor','flat','EdgeColor',edgecolor);
 	patch( 'Faces', [B E F C],'Vertices', [x y z],'CData', 7,'FaceColor','flat','EdgeColor',edgecolor);
 	patch( 'Faces', [C A D F],'Vertices', [x y z],'CData', 7,'FaceColor','flat','EdgeColor',edgecolor);
-	PosMS=find(data==6);
-	A=elements(PosMS,1); B=elements(PosMS,2); C=elements(PosMS,3); D=elements(PosMS,4); E=elements(PosMS,5); F=elements(PosMS,6);
+	pos=find(data==6);
+	A=elements(pos,1); B=elements(pos,2); C=elements(pos,3); D=elements(pos,4); E=elements(pos,5); F=elements(pos,6);
 	p9=patch( 'Faces', [A B C],'Vertices', [x y z],'CData', 6,'FaceColor','flat','EdgeColor',edgecolor);
 	patch( 'Faces', [D E F],  'Vertices', [x y z],'CData', 6,'FaceColor','flat','EdgeColor',edgecolor);
 	patch( 'Faces', [A B E D],'Vertices', [x y z],'CData', 6,'FaceColor','flat','EdgeColor',edgecolor);
 	patch( 'Faces', [B E F C],'Vertices', [x y z],'CData', 6,'FaceColor','flat','EdgeColor',edgecolor);
 	patch( 'Faces', [C A D F],'Vertices', [x y z],'CData', 6,'FaceColor','flat','EdgeColor',edgecolor);
-
 end
 legend([p1 p2 p3 p4 p5 p6 p7 p8 p9],...
 		'None','SIA','SSA','L1L2','HO',...

Modified: issm/trunk/src/m/plot/plot_googlemaps.m
===================================================================
--- issm/trunk/src/m/plot/plot_googlemaps.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/plot/plot_googlemaps.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -24,20 +24,26 @@
 	%Get xlim and ylim (used to extract radar image)
 	xlim=getfieldvalue(options,'xlim',[min(x) max(x)]);
 	ylim=getfieldvalue(options,'ylim',[min(y) max(y)]);
-	if md.mesh.epsg==3413,
+	if md.mesh.epsg==3413, %UPS Greenland
 		[latlist lonlist]= xy2ll(...
 			[linspace(xlim(1),xlim(2),100) linspace(xlim(2),xlim(2),100) linspace(xlim(2),xlim(1),100) linspace(xlim(1),xlim(1),100)],...
 			[linspace(ylim(1),ylim(1),100) linspace(ylim(1),ylim(2),100) linspace(ylim(2),ylim(2),100) linspace(ylim(2),ylim(1),100)],...
 			+1,45,70);
-	elseif md.mesh.epsg==3031,
+	elseif md.mesh.epsg==3031, %UPS Antarctica
 		[latlist lonlist]= xy2ll(...
 			[linspace(xlim(1),xlim(2),100) linspace(xlim(2),xlim(2),100) linspace(xlim(2),xlim(1),100) linspace(xlim(1),xlim(1),100)],...
 			[linspace(ylim(1),ylim(1),100) linspace(ylim(1),ylim(2),100) linspace(ylim(2),ylim(2),100) linspace(ylim(2),ylim(1),100)],...
 			-1,0,71);
-	else
+	elseif md.mesh.epsg==26906, %UTM 6V Columbia Glacier Alaska
+		[latlist lonlist]= utm2ll(...
+			[linspace(xlim(1),xlim(2),100) linspace(xlim(2),xlim(2),100) linspace(xlim(2),xlim(1),100) linspace(xlim(1),xlim(1),100)],...
+			[linspace(ylim(1),ylim(1),100) linspace(ylim(1),ylim(2),100) linspace(ylim(2),ylim(2),100) linspace(ylim(2),ylim(1),100)],...
+			6);
+	elseif numel(md.mesh.lat)==numel(md.mesh.x),
 		latlist = md.mesh.lat; %That might work?
 		lonlist = md.mesh.long;
-		error('EPSG code not supported yet');
+	else
+		error('EPSG code not supported yet, and no lat long found in md.mesh');
 	end
 
 	%Image corners in lat/long

Modified: issm/trunk/src/m/plot/plot_icefront.m
===================================================================
--- issm/trunk/src/m/plot/plot_icefront.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/plot/plot_icefront.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -1,4 +1,4 @@
-function plot_icefront(md,options,width,i,data)
+function h2 = plot_icefront(md,options,width,i,data)
 %PLOT_ICEFRONT - plot segment on neumann BC
 %
 %   Usage:

Modified: issm/trunk/src/m/plot/plot_manager.py
===================================================================
--- issm/trunk/src/m/plot/plot_manager.py	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/plot/plot_manager.py	2016-04-13 04:32:01 UTC (rev 20500)
@@ -28,7 +28,7 @@
 	'fig' is a handle to the figure instance created by plotmodel.
 
 	'ax' is a handle to the axes instance created by plotmodel.  This is
-	currently generated using matplotlib's AxesGrid toolki.
+	currently generated using matplotlib's AxesGrid toolkit.
 
 	Usage:
 		plot_manager(md,options,fig,ax);

Modified: issm/trunk/src/m/plot/plot_overlay.py
===================================================================
--- issm/trunk/src/m/plot/plot_overlay.py	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/plot/plot_overlay.py	2016-04-13 04:32:01 UTC (rev 20500)
@@ -1,14 +1,22 @@
 import numpy as npy
 from processmesh import processmesh
 from processdata import processdata
+from xy2ll import xy2ll
 import matplotlib.pyplot as plt
 import matplotlib as mpl
+try:
+    from mpl_toolkits.basemap import Basemap
+except ImportError:
+    print 'Basemap toolkit not installed'
+
 import os
+
 try:
-	from osgeo import gdal
+        from osgeo import gdal
 except ImportError:
 	print 'osgeo/gdal for python not installed, plot_overlay is disabled'
 
+
 def plot_overlay(md,data,options,ax):
 	'''
 	Function for plotting a georeferenced image.  This function is called
@@ -27,8 +35,6 @@
 
 	if not is2d:
 		raise StandardError('overlay plot not supported for 3D meshes, project on a 2D layer first')
-	if datatype==3:
-		raise StandardError('overlay not yet supported for quiver plots')	
 
 	if not options.exist('geotiff_name'):
 		raise StandardError('overlay error: provide geotiff_name with path to geotiff file')
@@ -64,6 +70,7 @@
 
 	# normalize array
 	arr=arr/npy.float(npy.max(arr.ravel()))
+        arr=1.-arr # somehow the values got flipped
 
 	if options.getfieldvalue('overlayhist',0)==1:
 		ax=plt.gca()
@@ -76,6 +83,7 @@
 		plt.figure(num)
 		plt.hist(arr.flatten(),bins=256,range=(0.,1.))
 		plt.title('histogram of overlay image, use for setting overlaylims')
+                plt.show()
 		plt.sca(ax) # return to original axes/figure
 		
 	# get parameters from cropped geotiff
@@ -90,20 +98,35 @@
 	xarr=npy.arange(xmin,xmax,dx)
 	yarr=npy.arange(ymin,ymax,-dy) # -dy since origin='upper' (not sure how robust this is)
 	xg,yg=npy.meshgrid(xarr,yarr)
+	overlaylims=options.getfieldvalue('overlaylims',[min(arr.ravel()),max(arr.ravel())])
+	norm=mpl.colors.Normalize(vmin=overlaylims[0],vmax=overlaylims[1])
+
 	if options.exist('basemap'):
-		# TODO get handle to or create basemap instance 
 		# create coordinate grid in map projection units (for plotting)
-		lats,lons=xy2ll(xg,yg,-1,0,71)
-		xgmap,ygmap=m(lons,lats) # map projection units returned by basemap instance
+		lat,lon=xy2ll(xlim,ylim,-1,0,71)
+                #plt.sca(ax)
+                width=xmax-xmin
+                height=ymax-ymin
+                lat_0,lon_0=xy2ll(xmin+width/2.,ymin+height/2.,-1,0,71)
+	        m=Basemap(projection='spstere',
+                        llcrnrlon=lon[0],llcrnrlat=lat[0],urcrnrlon=lon[1],urcrnrlat=lat[1],
+                        epsg=3031,
+                        resolution='c')
+                        #width=width,height=height,lon_0=lon_0,lat_0=lat_0,
+                        #lat_0=-90,lon_0=0,lat_ts=-71,
+                        #llcrnrx=x0,llcrnry=y0,urcrnrx=x1,urcrnry=y1)
+                #test
+                #m.ax=ax
+	        meridians=npy.arange(-180.,181.,1.)
+	        parallels=npy.arange(-80.,80.,1.)
+	        m.drawparallels(parallels,labels=[0,0,1,1]) # labels=[left,right,top,bottom]
+	        m.drawmeridians(meridians,labels=[1,1,0,0])
+                m.drawcoastlines()
+	        pc=m.pcolormesh(xg, yg, npy.flipud(arr), cmap=mpl.cm.Greys, norm=norm, ax=ax)
+
 	else:
-		xgmap=xg
-		ygmap=yg
-	
-	overlaylims=options.getfieldvalue('overlaylims',[min(arr.ravel()),max(arr.ravel())])
-
-	norm=mpl.colors.Normalize(vmin=overlaylims[0],vmax=overlaylims[1])
-
-	pc=ax.pcolormesh(xgmap, ygmap, npy.flipud(arr), cmap=mpl.cm.Greys, norm=norm)
+	        pc=ax.pcolormesh(xg, yg, npy.flipud(arr), cmap=mpl.cm.Greys, norm=norm)
+        
 	#rasterization? 
 	if options.getfieldvalue('rasterized',0):
 		pc.set_rasterized(True)

Modified: issm/trunk/src/m/plot/plot_quiver.m
===================================================================
--- issm/trunk/src/m/plot/plot_quiver.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/plot/plot_quiver.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -17,9 +17,11 @@
 h=[];
 for i=1:quivers.numcolors
 	pos=find(quivers.colorind==i);
-	hprime=quiver(quivers.x(pos),quivers.y(pos),quivers.u(pos),quivers.v(pos),...
-		'Color',palette(i,:),'ShowArrowHead','on','AutoScale','off');
-	h=[h;hprime];
+	if ~isempty(pos),
+		hprime=quiver(quivers.x(pos),quivers.y(pos),quivers.u(pos),quivers.v(pos),...
+			'Color',palette(i,:),'ShowArrowHead','on','AutoScale','off');
+		h=[h;hprime];
+	end
 end
 
 %take care of colorbar

Modified: issm/trunk/src/m/plot/plot_tensor_components.m
===================================================================
--- issm/trunk/src/m/plot/plot_tensor_components.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/plot/plot_tensor_components.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -68,7 +68,7 @@
 function Apply_options_tensor(md,options,type,component)
 	%apply options
 	if ismember('_',type) %user plotet stress_tensor
-		strings=strsplit(type,'_');
+		strings=strsplit_strict(type,'_');
 		string=strings{1};
 	else %default plot: user requested stress
 		string=type;

Modified: issm/trunk/src/m/plot/plot_tensor_principal.m
===================================================================
--- issm/trunk/src/m/plot/plot_tensor_principal.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/plot/plot_tensor_principal.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -66,7 +66,7 @@
 function Apply_options_tensor(md,options,type,component)
 %apply options
 if ismember('_',type) %user plotet stress_tensor
-	strings=strsplit(type,'_');
+	strings=strsplit_strict(type,'_');
 	string=strings{1};
 else %default plot: user requested stress
 	string=type;

Modified: issm/trunk/src/m/plot/plot_tensor_principalaxis.m
===================================================================
--- issm/trunk/src/m/plot/plot_tensor_principalaxis.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/plot/plot_tensor_principalaxis.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -88,7 +88,7 @@
 end
 
 %apply options
-strings=strsplit(type,'_');
+strings=strsplit_strict(type,'_');
 string=strings{1};
 options=addfielddefault(options,'title',[upper(string(1)) string(2:end) ' principal axis ' type(end)]);
 options=addfielddefault(options,'colorbar',0);

Modified: issm/trunk/src/m/plot/plot_transient_movie.m
===================================================================
--- issm/trunk/src/m/plot/plot_transient_movie.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/plot/plot_transient_movie.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -61,7 +61,7 @@
 			[data datatype]=processdata(md,results(i).(field),options);
 
 			clf;
-			titlestring=[field ' at time ' num2str(results(i).time/md.constants.yts) ' year'];
+			titlestring=[field ' at time ' num2str(results(i).time) ' year'];
 			plot_unit(x,y,z,elements,data,is2d,isplanet,datatype,options)
 			apply_options_movie(md,options,titlestring);
 

Modified: issm/trunk/src/m/plot/plot_unit.py
===================================================================
--- issm/trunk/src/m/plot/plot_unit.py	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/plot/plot_unit.py	2016-04-13 04:32:01 UTC (rev 20500)
@@ -1,82 +1,92 @@
 from cmaptools import truncate_colormap
 try:
-	import pylab as p
-	import matplotlib as mpl
-	import matplotlib.pyplot as plt
+    import pylab as p
+    import matplotlib as mpl
+    import matplotlib.pyplot as plt
+    import numpy as npy
 except ImportError:
-	print "could not import pylab, matplotlib has not been installed, no plotting capabilities enabled"
+    print "could not import pylab, matplotlib has not been installed, no plotting capabilities enabled"
 
 def plot_unit(x,y,z,elements,data,is2d,isplanet,datatype,options,ax):
-	"""
-	PLOT_UNIT - unit plot, display data
-	
-		Usage:
-			plot_unit(x,y,z,elements,data,is2d,isplanet,datatype,options)
-	
-		See also: PLOTMODEL, PLOT_MANAGER
-	"""
-	
-	#edgecolor
-	edgecolor=options.getfieldvalue('edgecolor','None')
-	
-	#number of colorlevels for plots
-	colorlevels=options.getfieldvalue('colorlevels',128)
-	
-	alpha=options.getfieldvalue('alpha',1)
-	
-	#colormap
-	# default sequential colormap
-	defaultmap=truncate_colormap(mpl.cm.gnuplot2,0.1,0.9,128)
-	cmap=options.getfieldvalue('colormap',defaultmap)
-	if options.exist('cmap_set_over'):
-	   over=options.getfieldvalue('cmap_set_over','0.5')
-	   cmap.set_over(over)
-	if options.exist('cmap_set_under'):
-	   under=options.getfieldvalue('cmap_set_under','0.5')
-	   cmap.set_under(under)
-	
-	#normalize colormap if clim/caxis specified
-	if options.exist('clim'):
-	   lims=options.getfieldvalue('clim',[min(data),max(data)])
-	elif options.exist('caxis'):
-	   lims=options.getfieldvalue('caxis',[min(data),max(data)])
-	else:
-		if min(data)==max(data):
-			lims=[min(data)-0.5,max(data)+0.5]
-		else:
-			lims=[min(data),max(data)]
-	norm = mpl.colors.Normalize(vmin=lims[0], vmax=lims[1])
-	if datatype==1:
-	   #element plot
-		if is2d:
-			tri=ax.tripcolor(x,y,elements,data,colorlevels,cmap=cmap,norm=norm,alpha=alpha,edgecolors=edgecolor)
-		else:
-			raise ValueError('plot_unit error: 3D element plot not supported yet')
-		return 
-	
-	elif datatype==2:
-		#node plot
-		if is2d:
-			tri=ax.tricontourf(x,y,elements,data,colorlevels,cmap=cmap,norm=norm,alpha=alpha,extend='both')
-			if edgecolor != 'None':
-				ax.triplot(x,y,elements,color=edgecolor)
-		else:
-			raise ValueError('plot_unit error: 3D node plot not supported yet')
-		return
-	
-	elif datatype==3:
-		print 'plot_unit message: quiver plot not implemented yet'
-		return
-	
-	elif datatype==4:
-		#P1 patch plot
-		print 'plot_unit message: P1 patch plot not implemented yet'
-		return
-	
-	elif datatype==5:
-		print 'plot_unit message: P0 patch plot not implemented yet'
-		return
-	
-	else:
-		raise ValueError('datatype=%d not supported' % datatype)
-
+    """
+    PLOT_UNIT - unit plot, display data
+    
+    	Usage:
+    		plot_unit(x,y,z,elements,data,is2d,isplanet,datatype,options)
+    
+    	See also: PLOTMODEL, PLOT_MANAGER
+    """
+    
+    #edgecolor
+    edgecolor=options.getfieldvalue('edgecolor','None')
+    
+    #number of colorlevels for plots
+    colorlevels=options.getfieldvalue('colorlevels',128)
+    
+    alpha=options.getfieldvalue('alpha',1)
+    
+    #colormap
+    # default sequential colormap
+    defaultmap=truncate_colormap(mpl.cm.gnuplot2,0.1,0.9,128)
+    cmap=options.getfieldvalue('colormap',defaultmap)
+    if options.exist('cmap_set_over'):
+        over=options.getfieldvalue('cmap_set_over','0.5')
+        cmap.set_over(over)
+    if options.exist('cmap_set_under'):
+        under=options.getfieldvalue('cmap_set_under','0.5')
+        cmap.set_under(under)
+    
+    #normalize colormap if clim/caxis specified
+    if options.exist('clim'):
+        lims=options.getfieldvalue('clim',[npy.amin(data),npy.amax(data)])
+    elif options.exist('caxis'):
+        lims=options.getfieldvalue('caxis',[npy.amin(data),npy.amax(data)])
+    else:
+        if npy.amin(data)==npy.amax(data):
+            lims=[npy.amin(data)-0.5,npy.amax(data)+0.5]
+        else:
+    	    lims=[npy.amin(data),npy.amax(data)]
+    norm = mpl.colors.Normalize(vmin=lims[0], vmax=lims[1])
+    if datatype==1:
+       #element plot
+        if is2d:
+    	    tri=ax.tripcolor(x,y,elements,data,colorlevels,cmap=cmap,norm=norm,alpha=alpha,edgecolors=edgecolor)
+    	else:
+    	    raise ValueError('plot_unit error: 3D element plot not supported yet')
+    	return 
+    
+    elif datatype==2:
+    	#node plot
+    	if is2d:
+    	    tri=ax.tricontourf(x,y,elements,data,colorlevels,cmap=cmap,norm=norm,alpha=alpha,extend='both')
+    	    if edgecolor != 'None':
+    	        ax.triplot(x,y,elements,color=edgecolor)
+    	else:
+    	    raise ValueError('plot_unit error: 3D node plot not supported yet')
+    	return
+    
+    elif datatype==3:
+        vx=data[:,0]
+        vy=data[:,1]
+        #TODO write plot_quiver.py to handle this here
+        color=npy.sqrt(vx**2+vy**2)
+        scale=options.getfieldvalue('scale',1000)
+        width=options.getfieldvalue('width',0.005*(npy.amax(x)-npy.amin(y)))
+        headwidth=options.getfieldvalue('headwidth',3)
+        headlength=options.getfieldvalue('headlength',5)
+        Q=ax.quiver(x,y,vx,vy,color,cmap=cmap,norm=norm,scale=scale,
+                width=width,headwidth=headwidth,headlength=headlength)
+    	return
+    
+    elif datatype==4:
+    	#P1 patch plot
+    	print 'plot_unit message: P1 patch plot not implemented yet'
+    	return
+    
+    elif datatype==5:
+    	print 'plot_unit message: P0 patch plot not implemented yet'
+    	return
+    
+    else:
+    	raise ValueError('datatype=%d not supported' % datatype)
+    

Modified: issm/trunk/src/m/plot/plot_vstime.m
===================================================================
--- issm/trunk/src/m/plot/plot_vstime.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/plot/plot_vstime.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -5,7 +5,7 @@
 
 %getting the variable structure
 datastruct  = getfieldvalue(options,'Input');
-structnames = strsplit(datastruct,'.');
+structnames = strsplit_strict(datastruct,'.');
 
 %getting the position of the to be ploted point
 location=getfieldvalue(options,'position');

Modified: issm/trunk/src/m/plot/plotmodel.py
===================================================================
--- issm/trunk/src/m/plot/plotmodel.py	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/plot/plotmodel.py	2016-04-13 04:32:01 UTC (rev 20500)
@@ -4,7 +4,7 @@
 try:
 	import pylab as p
 	import matplotlib.pyplot as plt
-	from mpl_toolkits.axes_grid1 import ImageGrid
+	from mpl_toolkits.axes_grid1 import ImageGrid, AxesGrid
 except ImportError:
 	print "could not import pylab, matplotlib has not been installed, no plotting capabilities enabled"
 

Modified: issm/trunk/src/m/plot/processdata.m
===================================================================
--- issm/trunk/src/m/plot/processdata.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/plot/processdata.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -126,12 +126,13 @@
 	%Mask?
 	if exist(options,'mask'),
 		flags=getfieldvalue(options,'mask');
+		maskvalue=getfieldvalue(options,'maskvalue',NaN);
 		pos=find(~flags);
 		if length(flags)==md.mesh.numberofvertices,
 			[pos2 dummy]=find(ismember(md.mesh.elements,pos));
-			data(pos2,:)=NaN;
+			data(pos2,:)=maskvalue;
 		elseif length(flags)==md.mesh.numberofelements
-			data(pos,:)=NaN;
+			data(pos,:)=maskvalue;
 		else
 			disp('plotmodel warning: mask length not supported yet (supported length are md.mesh.numberofvertices and md.mesh.numberofelements');
 		end
@@ -156,11 +157,12 @@
 	%Mask?
 	if exist(options,'mask'),
 		flags=getfieldvalue(options,'mask');
+		maskvalue=getfieldvalue(options,'maskvalue',NaN);
 		pos=find(~flags);
 		if length(flags)==md.mesh.numberofvertices,
-			data(pos,:)=NaN;
+			data(pos,:)=maskvalue;
 		elseif length(flags)==md.mesh.numberofelements
-			data(md.mesh.elements(pos,:),:)=NaN;
+			data(md.mesh.elements(pos,:),:)=maskvalue;
 		else
 			disp('plotmodel warning: mask length not supported yet (supported length are md.mesh.numberofvertices and md.mesh.numberofelements');
 		end

Modified: issm/trunk/src/m/plot/processdata.py
===================================================================
--- issm/trunk/src/m/plot/processdata.py	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/plot/processdata.py	2016-04-13 04:32:01 UTC (rev 20500)
@@ -2,90 +2,107 @@
 import numpy as npy
 
 def processdata(md,data,options):
-	"""
-	PROCESSDATA - process data to be plotted
-
-		datatype = 1 -> elements
-		datatype = 2 -> nodes
-		datatype = 3 -> node quivers
-		datatype = 4 -> patch
-
-		Usage:
-			data,datatype=processdata(md,data,options);
-
-		See also: PLOTMODEL, PROCESSMESH
-	"""
-
-	#check format
-	if (len(data)==0 or (len(data)==1 and not isinstance(data,dict) and isnan(data).all())):
-		raise ValueError("processdata error message: 'data' provided is empty")
-
-	#needed later on
-	if 'numberofvertices2d' in dir(md.mesh):
-		numberofvertices2d=md.mesh.numberofvertices2d
-		numberofelements2d=md.mesh.numberofelements2d
-	else:
-		numberofvertices2d=npy.nan
-		numberofelements2d=npy.nan
-
-	procdata=npy.copy(data)
-
-	#process patch
-
-	#initialize datatype
-	datatype=0
-
-	#get datasize
-	if npy.ndim(procdata)==1:
-		datasize=npy.array([len(procdata),1])
-	else:
-		datasize=npy.shape(procdata)
-	
-	#process NaN's if any
-	nanfill=options.getfieldvalue('nan',-9999)
-	if npy.any(npy.isnan(procdata)):
-		lb=npy.min(data[~npy.isnan(data)])
-		ub=npy.max(data[~npy.isnan(data)])
-		if lb==ub:
-			lb=lb-0.5
-			ub=ub+0.5
-			nanfill=lb-1
-		procdata[npy.isnan(procdata)]=nanfill
-		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"
-
-	#non-patch processing 
-
-	#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?
-
-		#log?
-
-	#node data
-	if datasize[0]==md.mesh.numberofvertices and datasize[1]==1:
-		datatype=2
-
-		#mask?
-
-		#log?
-
-	#layer projection?
-
-	#control arrow density if quiver plot
-
-	#convert rank-2 array to rank-1
-	if npy.ndim(procdata)==2 and npy.shape(procdata)[1]==1:
-		procdata=procdata.reshape(-1,)
-
-	#if datatype is still zero, error out
-	if datatype==0:
-		raise ValueError("processdata error: data provided not recognized or not supported")
-	else:
-		return procdata, datatype
+    """
+    PROCESSDATA - process data to be plotted
+    
+    	datatype = 1 -> elements
+    	datatype = 2 -> nodes
+    	datatype = 3 -> node quivers
+    	datatype = 4 -> patch
+    
+    	Usage:
+    		data,datatype=processdata(md,data,options);
+    
+    	See also: PLOTMODEL, PROCESSMESH
+    """
+    
+    #check format
+    if (len(data)==0 or (len(data)==1 and not isinstance(data,dict) and isnan(data).all())):
+        raise ValueError("processdata error message: 'data' provided is empty")
+    
+    #needed later on
+    if 'numberofvertices2d' in dir(md.mesh):
+    	numberofvertices2d=md.mesh.numberofvertices2d
+    	numberofelements2d=md.mesh.numberofelements2d
+    else:
+    	numberofvertices2d=npy.nan
+    	numberofelements2d=npy.nan
+    
+    procdata=npy.copy(data)
+    
+    #process patch
+    
+    #initialize datatype
+    datatype=0
+    
+    #get datasize
+    if npy.ndim(procdata)==1:
+    	datasize=npy.array([len(procdata),1])
+    else:
+    	datasize=npy.shape(procdata)
+        if len(datasize)>2:
+            raise ValueError('data passed to plotmodel has more than 2 dimensions; check that column vectors are rank-1')
+    
+    #process NaN's if any
+    nanfill=options.getfieldvalue('nan',-9999)
+    if npy.any(npy.isnan(procdata)):
+    	lb=npy.min(data[~npy.isnan(data)])
+    	ub=npy.max(data[~npy.isnan(data)])
+    	if lb==ub:
+    	    lb=lb-0.5
+    	    ub=ub+0.5
+    	    nanfill=lb-1
+    	procdata[npy.isnan(procdata)]=nanfill
+    	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"
+    
+    #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')
+    
+    #non-patch processing 
+    
+    #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?
+    
+    	#log?
+    
+    #node data
+    if datasize[0]==md.mesh.numberofvertices and datasize[1]==1:
+    	datatype=2
+    
+    #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?
+    
+    	#log?
+    
+    #layer projection?
+    
+    #control arrow density if quiver plot
+    
+    #convert rank-2 array to rank-1
+    if npy.ndim(procdata)==2 and npy.shape(procdata)[1]==1:
+    	procdata=procdata.reshape(-1,)
+    
+    #if datatype is still zero, error out
+    if datatype==0:
+    	raise ValueError("processdata error: data provided not recognized or not supported")
+    else:
+    	return procdata, datatype

Modified: issm/trunk/src/m/plot/quiver_colorbar.m
===================================================================
--- issm/trunk/src/m/plot/quiver_colorbar.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/plot/quiver_colorbar.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -6,8 +6,11 @@
 
 if  strcmpi(getfieldvalue(options,'colorbar','on'),'on'),
 
+	%Create colorbar
+	hcb=colorbar('peer',gca,'location','EastOutside');
+	caxis([1 quivers.numcolors+1]);
+
 	%build ticks
-	hcb=colorbar('peer',gca,'location','EastOutside');
 	ticklabel=cell(1,length(quivers.levels));
 	for i=1:length(quivers.levels),
 		ticklabel{i}=num2str(round_ice(quivers.levels(i),3));
@@ -23,6 +26,7 @@
 
 	%draw colorbar
 	set(hcb,'YTickLabel',ticklabel,'YTick',tickpos);
+
 	%position
 	if exist(options,'colorbarpos'),
 		set(hcb,'Position',getfieldvalue(options,'colorbarpos'));

Modified: issm/trunk/src/m/plot/radarpower.m
===================================================================
--- issm/trunk/src/m/plot/radarpower.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/plot/radarpower.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -33,9 +33,9 @@
 x0=min(xlim); x1=max(xlim);
 y0=min(ylim); y1=max(ylim);
 
-%figure out if we should go look for Greenland or Antarctica geotiff, or if user provided one.
-if ~exist(options,'overlay_image'),
-	if md.mesh.epsg==3413,
+if ~exist(options,'overlay_image'), % no image provided, go look into ModelData for one!{{{
+	if md.mesh.epsg==3413,   %Greenland 
+		%old code {{{ 
 		%if ~exist(['/u/astrid-r1b/ModelData/MOG/mog150_greenland_map.jpg']),
 		%	error(['radarpower error message: file ' '/u/astrid-r1b/ModelData/MOG/mog150_greenland_map.jpg not found.']);
 		%end
@@ -67,7 +67,7 @@
 		%im=im(firstrow:firstrow+numrows-1,firstcol:firstcol+numcols-1);
 		%md.radaroverlay.pwr=double(flipud(im(1:pixelskip:end,1:pixelskip:end)));
 		%md.radaroverlay.x=(xmin:(xmax-xmin)/(size(md.radaroverlay.pwr,2)-1):xmax);
-		%md.radaroverlay.y=(ymin:(ymax-ymin)/(size(md.radaroverlay.pwr,1)-1):ymax);
+		%md.radaroverlay.y=(ymin:(ymax-ymin)/(size(md.radaroverlay.pwr,1)-1):ymax); % }}}
 		if ~exist(options,'geotiff_name'),
 			if highres,
 				if ~exist(['/u/astrid-r1b/ModelData/MOG/mog100_r2_hp1.tif']),
@@ -102,10 +102,11 @@
 		md.radaroverlay.x=(x0:(x1-x0)/(size(md.radaroverlay.pwr,2)-1):x1);
 		md.radaroverlay.y=(y0:(y1-y0)/(size(md.radaroverlay.pwr,1)-1):y1);
 
-		%Erase image
-		system('rm -rf ./temp.tif');
-
-	elseif md.mesh.epsg==3031,
+		%Erase image or keep it?
+		if ~getfieldvalue(options,'keep_image',0),
+			system('rm -rf ./temp.tif');
+		end
+	elseif md.mesh.epsg==3031, %Antarctica 
 		if ~exist(options,'geotiff_name'),
 			if highres,
 				if ~exist(['/u/astrid-r1b/ModelData/MosaicTiffRsat/amm125m_v2_200m.tif']),
@@ -133,13 +134,37 @@
 		md.radaroverlay.x=(x0:(x1-x0)/(size(md.radaroverlay.pwr,2)-1):x1);
 		md.radaroverlay.y=(y0:(y1-y0)/(size(md.radaroverlay.pwr,1)-1):y1);
 
-		%Erase image
-		system('rm -rf ./temp.tif');
+		%Erase image or keep it?
+		if ~getfieldvalue(options,'keep_image',0),
+			system('rm -rf ./temp.tif');
+		end
 
+
 	else
-		error('EPSG code not supported yet (ex: 3413 for UPS Greenland, 3031 for UPS Antarctica)');
-	end
-else
+		if ~exist(options,'geotiff_name'), 
+			error('Need a geotiff for areas outside of Greenland and Antarctica');
+		end
+		
+		%Name of image
+		inputname='./temp.tif';
+		eval(['!gdal_translate -quiet -projwin ' num2str(x0) ' ' num2str(y1) ' ' num2str(x1) ' ' num2str(y0) ' ' geotiff_name ' ' inputname ]);
+
+		%Read in temp.tif:
+		im=imread('temp.tif','TIFF');
+		%adjust contrast and brightness
+		%im=imadjust(im,[a b],[c d]);
+		pixelskip=max(1,ceil(posting/((x1-x0)/(size(im,2)))));
+		md.radaroverlay.pwr=double(flipud(im(1:pixelskip:end,1:pixelskip:end)));
+		md.radaroverlay.x=(x0:(x1-x0)/(size(md.radaroverlay.pwr,2)-1):x1);
+		md.radaroverlay.y=(y0:(y1-y0)/(size(md.radaroverlay.pwr,1)-1):y1);
+
+		%Erase image or keep it?
+		if ~getfieldvalue(options,'keep_image',0),
+			system('rm -rf ./temp.tif');
+		end
+	end 
+	%}}}
+else %user provided image {{{
 	%user provided an image. check we also have overlay_xlim and overlay_ylim  options, to know what range of coordinates the image covers.
 	if (~exist(options,'overlay_xlim') | ~exist(options,'overlay_xlim')| ~exist(options,'overlay_xposting')| ~exist(options,'overlay_yposting')),
 		error('radarpower error message: please provide overlay_xlim, overlay_ylim, overlay_xposting and overlay_yposting options together with overlay_image option');
@@ -164,4 +189,41 @@
 	md.radaroverlay.pwr=double(flipud(im));
 	md.radaroverlay.x=(x0:(x1-x0)/(size(md.radaroverlay.pwr,2)-1):x1);
 	md.radaroverlay.y=(y0:(y1-y0)/(size(md.radaroverlay.pwr,1)-1):y1);
-end
+end %}}}
+
+%Was a triangulation requested for the area of the image that is not covered by the mesh? %{{{
+if strcmpi(getfieldvalue(options,'outertriangulation','no'),'yes'),
+
+	%create expfile that is a box controlled by xlim and ylim, with a hole defined by the mesh outer segments.
+	box.name='';
+	
+	%box: 
+	box.x=[xlim(1) xlim(2) xlim(2) xlim(1) xlim(1)];
+	box.y=[ylim(1) ylim(1) ylim(2) ylim(2) ylim(1)];
+	box.density=1;
+
+	%inner hole from mesh segments: 
+	box(2).x=md.mesh.x(md.mesh.segments(:,1));
+	box(2).x=[box(2).x; box(2).x(1)];
+	box(2).y=md.mesh.y(md.mesh.segments(:,1)); 
+	box(2).y=[box(2).y; box(2).y(1)];
+
+	if strcmpi(getfieldvalue(options,'outertriangulationflip','no'),'yes'),
+		box(2).x=flipud(box(2).x);
+		box(2).y=flipud(box(2).y);
+	end
+
+	%write contour to file
+	expwrite(box,'./outertriangulation.exp');
+
+	%mesh: 
+	maxarea=max(GetAreas(md.mesh.elements,md.mesh.x,md.mesh.y));
+	outermd=triangle(model(),'./outertriangulation.exp',sqrt(maxarea));
+	%outermd=bamg(model(),'domain','./outertriangulation.exp','hmin',sqrt(maxarea));
+	
+	%save the triangulation: 
+	md.radaroverlay.outerindex=outermd.mesh.elements;
+	md.radaroverlay.outerx=outermd.mesh.x;
+	md.radaroverlay.outery=outermd.mesh.y;
+
+end %}}}

Modified: issm/trunk/src/m/qmu/dakota_in_params.m
===================================================================
--- issm/trunk/src/m/qmu/dakota_in_params.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/qmu/dakota_in_params.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -104,9 +104,14 @@
     params.evaluation_self_scheduling=false;
 end
 if ~isfield(params,'evaluation_static_scheduling')
-    params.evaluation_static_scheduling=true;
+	params.evaluation_static_scheduling=true;
 end
-
+if ~isfield(params,'evaluation_scheduling')
+	params.evaluation_scheduling=false;
+end
+if ~isfield(params,'processors_per_evaluation')
+	params.processors_per_evaluation=false;
+end
 if ~isfield(params,'analysis_servers')
     params.analysis_servers=false;
 end

Modified: issm/trunk/src/m/qmu/dakota_in_write.m
===================================================================
--- issm/trunk/src/m/qmu/dakota_in_write.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/qmu/dakota_in_write.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -82,7 +82,11 @@
 
 %  write the strategy section
 
-strategy_write(fidi,params);
+if IssmConfig('_DAKOTA_VERSION_') < 6,
+	strategy_write(fidi,params);
+else
+	environment_write(fidi,params);
+end
 
 %  write the method section
 
@@ -116,7 +120,7 @@
 display('Writing strategy section of Dakota input file.');
 
 fprintf(fidi,'strategy,\n');
-fprintf(fidi,'\tsingle_method\n');
+fprintf(fidi,'\tsingle_method\n\n');
 param_write(fidi,'\t  ','graphics','','\n',params);
 param_write(fidi,'\t  ','tabular_graphics_data','','\n',params);
 param_write(fidi,'\t  ','tabular_graphics_file',' ''','''\n',params);
@@ -124,6 +128,20 @@
 
 end
 
+%%  function to write the environment section of the file
+
+function []=environment_write(fidi,params)
+
+	display('Writing environment section of Dakota input file.');
+
+	fprintf(fidi,'environment,\n');
+	param_write(fidi,'\t  ','graphics','','\n',params);
+	param_write(fidi,'\t  ','tabular_graphics_data','','\n',params);
+	param_write(fidi,'\t  ','tabular_graphics_file',' ''','''\n',params);
+	fprintf(fidi,'\n');
+
+end
+
 %%  function to write the method section of the file
 
 function []=method_write(fidi,dmeth,dresp,params)
@@ -228,10 +246,16 @@
     param_write(fidi,'\t  ','file_save','','\n',params);
 elseif params.direct
 %  Error: asynchronous capability not yet supported in direct interfaces.
+%  Update: it is now possible to run in parallel in direct interfaces.
     param_write(fidi,'\t','algebraic_mappings',' = ','\n',params);
     param_write(fidi,'\t','direct','','\n',params);
     param_write(fidi,'\t  ','analysis_driver','     = ''','''\n',params);
-    param_write(fidi,'\t  ','evaluation_static_scheduling','','\n',params);
+    if IssmConfig('_DAKOTA_VERSION_') < 6,
+		param_write(fidi,'\t  ','evaluation_static_scheduling','','\n',params);
+	else
+		param_write(fidi,'\t  ','evaluation_scheduling',' ','\n',params);
+		param_write(fidi,'\t  ','processors_per_evaluation',' = ','\n',params);
+	end
     if ~isempty(params.analysis_components)
         [pathstr,name,ext] = fileparts(params.analysis_components);
         if isempty(ext)

Modified: issm/trunk/src/m/qmu/dakota_out_parse.m
===================================================================
--- issm/trunk/src/m/qmu/dakota_out_parse.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/qmu/dakota_out_parse.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -80,14 +80,15 @@
 
 [fline]=findline(fidi,'methodName = ');
 if ~ischar(fline)
-    return
+	%do nothing
+else
+	% display(['  ' deblank(fline)]);
+
+	[ntokens,tokens]=fltokens(fline);
+	method=tokens{1}{3};
+	display(sprintf('Dakota methodName=''%s''.',method));
 end
-% display(['  ' deblank(fline)]);
 
-[ntokens,tokens]=fltokens(fline);
-method=tokens{1}{3};
-display(sprintf('Dakota methodName=''%s''.',method));
-
 dresp=struct([]);
 scm =struct([]);
 pcm =struct([]);
@@ -166,14 +167,21 @@
 %  process column headings of matrix (skipping eval_id)
 
 [ntokens,tokens]=fltokens(fline);
-desc=cell (1,ntokens-1);
-data=zeros(1,ntokens-1);
 
-for i=1:ntokens-1
-    desc(1,i)=cellstr(tokens{1}{i+1});
+% New file DAKOTA versions>6
+if strncmpi(fline,'%eval_id interface',18)
+	offset=2;
+else %DAKOTA versions<6
+	offset=1;
 end
-display(sprintf('Number of columns (Dakota V+R)=%d.',ntokens-1));
+desc=cell (1,ntokens-offset);
+data=zeros(1,ntokens-offset);
 
+for i=1:ntokens-offset
+    desc(1,i)=cellstr(tokens{1}{i+offset});
+end
+display(sprintf('Number of columns (Dakota V+R)=%d.',ntokens-2));
+
 %  process rows of matrix
 
 nrow=0;
@@ -187,8 +195,8 @@
 %  add row values to matrix (skipping eval_id)
 
     nrow=nrow+1;
-    for i=1:ntokens-1
-        data(nrow,i)=tokens{1}{i+1};
+    for i=1:ntokens-offset
+        data(nrow,i)=tokens{1}{i+offset};
     end
 end
 display(sprintf('Number of rows (Dakota func evals)=%d.',nrow));

Modified: issm/trunk/src/m/qmu/postqmu.m
===================================================================
--- issm/trunk/src/m/qmu/postqmu.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/qmu/postqmu.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -18,9 +18,6 @@
        error(['Dakota returned error in ''' qmuerrfile ' file.  ''' qmudir ''' directory retained.'])
     end
     status=fclose(fide);
-else
-   cd ../
-   error(['Dakota did not generate ''' qmuerrfile ' file.  ''' qmudir ''' directory retained.'])
 end
 
 %parse inputs and results from dakota

Modified: issm/trunk/src/m/shp/shp2exp.py
===================================================================
--- issm/trunk/src/m/shp/shp2exp.py	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/shp/shp2exp.py	2016-04-13 04:32:01 UTC (rev 20500)
@@ -32,24 +32,19 @@
 	for i in range(len(shp.shapes())):
 		geom=shp.shapes()[i].shapeType
 		if geom==5: # polygon
-			x=[p[0] for p in shp.shapes()[i].points]
-			y=[q[1] for q in shp.shapes()[i].points]
-			expdict['x']=x
-			expdict['y']=y
-			expdict['nods']=len(x)
+			tmpx=[p[0] for p in shp.shapes()[i].points]
+			tmpy=[q[1] for q in shp.shapes()[i].points]
+			x.append(tmpx)
+			y.append(tmpy)
 		elif geom==3: # line
-			x=[p[0] for p in shp.shapes()[i].points]
-			y=[q[1] for q in shp.shapes()[i].points]
-			x.append(x[0])
-			y.append(y[0])
-			expdict['x']=x
-			expdict['y']=y
-			expdict['nods']=len(x)
+			tmpx=[p[0] for p in shp.shapes()[i].points]
+			tmpy=[q[1] for q in shp.shapes()[i].points]
+			x.append(tmpx)
+			y.append(tmpy)
 		elif geom==1: # point
 			x.append(shp.shapes()[i].points[0][0])
 			y.append(shp.shapes()[i].points[0][1])
-			expdict['x']=x
-			expdict['y']=y
-			expdict['nods']=len(x)
 
-	expwrite([expdict],expfile)
+	expdict['x']=x
+	expdict['y']=y
+	expwrite(expdict,expfile)

Modified: issm/trunk/src/m/shp/shpread.m
===================================================================
--- issm/trunk/src/m/shp/shpread.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/shp/shpread.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -54,7 +54,31 @@
 			end
 		end
 	end
+	
+	if strcmpi(shp(i).Geometry,'Line'),
+		x=shp(i).X'; y=shp(i).Y';
+		ids=find(isnan(x));
+		x(ids)=[]; y(ids)=[];
 
+		Struct(end+1).x=x;
+		Struct(end).y=y;
+		Struct(end).nods=length(x);
+		Struct(end).density=1;
+		Struct(end).closed=1;
+		if isfield(shp,'id'),
+			Struct(end).name=num2str(shp(i).id);
+		else
+			Struct(end).name='';
+		end
+		for j=1:length(fields),
+			field=fields{j};
+			if ~(strcmpi(field,'X') | strcmpi(field,'Y') | strcmpi(field,'id')),
+				Struct(end).(field)=shp(i).(field);
+			end
+		end
+	end
+
+
 	if strcmpi(shp(i).Geometry,'Point'),
 		x=shp(i).X'; y=shp(i).Y';
 		ids=find(isnan(x));

Modified: issm/trunk/src/m/solve/loadresultsfromcluster.m
===================================================================
--- issm/trunk/src/m/solve/loadresultsfromcluster.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/solve/loadresultsfromcluster.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -37,7 +37,7 @@
 	delete([md.miscellaneous.name '.outlog']);
 	delete([md.miscellaneous.name '.errlog']);
 	delete([md.miscellaneous.name '.outbin']);
-	if ~ispc(),
+	if exist([md.private.runtimename '.tar.gz']) & ~ispc(),
 		delete([md.private.runtimename '.tar.gz']);
 	end
 end

Modified: issm/trunk/src/m/solve/loadresultsfromcluster.py
===================================================================
--- issm/trunk/src/m/solve/loadresultsfromcluster.py	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/solve/loadresultsfromcluster.py	2016-04-13 04:32:01 UTC (rev 20500)
@@ -1,6 +1,6 @@
 import os
 import socket
-import MatlabFuncs as m
+import platform
 from loadresultsfromdisk import loadresultsfromdisk
 
 def loadresultsfromcluster(md,runtimename=False):
@@ -34,28 +34,36 @@
 
 	#erase the log and output files
 	if md.qmu.isdakota:
-		os.remove(os.path.join('qmu'+str(os.getpid()),md.miscellaneous.name+'.outlog'))
-		os.remove(os.path.join('qmu'+str(os.getpid()),md.miscellaneous.name+'.errlog'))
+		filename=os.path.join('qmu'+str(os.getpid()),md.miscellaneous.name)
 	else:
-		os.remove(md.miscellaneous.name+'.outlog')
-		os.remove(md.miscellaneous.name+'.errlog')
-		os.remove(md.miscellaneous.name+'.outbin')
-		if not m.ispc():
-			os.remove(md.private.runtimename+'.tar.gz')
+		filename=md.miscellaneous.name
+		TryRem('.outbin',filename)
+		if not platform.system()=='Windows':
+			TryRem('.tar.gz',md.private.runtimename)
 
+	TryRem('.errlog',filename)
+	TryRem('.outlog',filename)
+	
 	#erase input file if run was carried out on same platform.
 	hostname=socket.gethostname()
-	if m.strcmpi(hostname,cluster.name):
+	if hostname==cluster.name:
 		if md.qmu.isdakota:
-			os.remove(os.path.join('qmu'+str(os.getpid()),md.miscellaneous.name+'.bin'))
-			os.remove(os.path.join('qmu'+str(os.getpid()),md.miscellaneous.name+'.queue'))
+			filename=os.path.join('qmu'+str(os.getpid()),md.miscellaneous.name)
+			TryRem('.queue',filename)
 		else:
-			os.remove(md.miscellaneous.name+'.bin')
-			os.remove(md.miscellaneous.name+'.toolkits')
-			if not m.ispc():
-				os.remove(md.miscellaneous.name+'.queue')
+			filename=md.miscellaneous.name
+			TryRem('.toolkits',filename)
+			if not platform.system()=='Windows':
+				TryRem('.queue',filename)
 			else:
-				os.remove(md.miscellaneous.name+'.bat')
+				TryRem('.bat',filename)
 
+		TryRem('.bin',filename)
+
 	return md
 
+def TryRem(extension,filename):
+	try:	
+		os.remove(filename+extension)
+	except OSError:
+		print 'WARNING, no '+extension+'  is present for run '+filename

Modified: issm/trunk/src/m/solve/parseresultsfromdisk.m
===================================================================
--- issm/trunk/src/m/solve/parseresultsfromdisk.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/solve/parseresultsfromdisk.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -27,10 +27,18 @@
 %Read fields until the end of the file.
 result  = ReadData(fid);
 if isempty(result), error(['no results found in binary file ' filename]); end
+check_nomoresteps=0;
 counter = 1;
 step    = result.step;
 while ~isempty(result), 
 
+	if check_nomoresteps,
+		%check that the new result does not add a step, which would be an error: 
+		if result.step>=1,
+			error('parsing results for a steady-state core, which incorporates transient results!');
+		end
+	end
+
 	%Check step, increase counter if this is a new step
 	if(step~=result.step & result.step>1)
 		counter = counter + 1;
@@ -38,16 +46,22 @@
 	end
 
 	%Add result
-	if(result.step==1),
+	if(result.step==0),
+		%if we have a step = 0, this is a steady state solutoin, don't expect more steps. 
 		index = 1;
+		check_nomoresteps=1;
+	elseif(result.step==1),
+		index = 1;
 	else
 		index = counter;
 	end
-	results(index).step=result.step;
-	if result.time~=-9999,
-		results(index).time=result.time; 
+	results(index).(result.fieldname)=result.field;
+	if(result.step~=-9999),
+		results(index).step=result.step;
 	end
-	results(index).(result.fieldname)=result.field;
+	if(result.time~=-9999),
+		results(index).time=result.time;
+	end
 
 	%read next result
 	try,
@@ -163,8 +177,6 @@
 	yts=365.0*24.0*3600.0;
 	if strcmp(fieldname,'BalancethicknessThickeningRate'),
 		field = field*yts;
-	elseif strcmp(fieldname,'Time'),
-		field = field/yts;
 	elseif strcmp(fieldname,'HydrologyWaterVx'),
 		field = field*yts;
 	elseif strcmp(fieldname,'HydrologyWaterVy'),
@@ -179,16 +191,35 @@
 		field = field*yts;
 	elseif strcmp(fieldname,'BasalforcingsGroundediceMeltingRate'),
 		field = field*yts;
+	elseif strcmp(fieldname,'BasalforcingsFloatingiceMeltingRate'),
+		field = field*yts;
+	elseif strcmp(fieldname,'TotalFloatingBmb'),
+		field = field/10.^12*yts; %(GigaTon/year)
+	elseif strcmp(fieldname,'TotalGroundedBmb'),
+		field = field/10.^12*yts; %(GigaTon/year)
 	elseif strcmp(fieldname,'TotalSmb'),
 		field = field/10.^12*yts; %(GigaTon/year)
-	elseif strcmp(fieldname,'SurfaceforcingsMassBalance'),
+	elseif strcmp(fieldname,'SmbMassBalance'),
 		field = field*yts;
+	elseif strcmp(fieldname,'SmbPrecipitation'),
+		field = field*yts;
+	elseif strcmp(fieldname,'SmbRunoff'),
+		field = field*yts;
+	elseif strcmp(fieldname,'SmbCondensation'),
+		field = field*yts;
+	elseif strcmp(fieldname,'SmbAccumulation'),
+		field = field*yts;
+	elseif strcmp(fieldname,'SmbMelt'),
+		field = field*yts;
 	elseif strcmp(fieldname,'CalvingCalvingrate'),
 		field = field*yts;
 	end
 
 	result.fieldname=fieldname;
 	result.time=time;
+	if result.time~=-9999,
+		result.time=time/yts;
+	end
 	result.step=step;
 	result.field=field;
 

Modified: issm/trunk/src/m/solve/parseresultsfromdisk.py
===================================================================
--- issm/trunk/src/m/solve/parseresultsfromdisk.py	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/solve/parseresultsfromdisk.py	2016-04-13 04:32:01 UTC (rev 20500)
@@ -33,26 +33,60 @@
 	except IOError as e:
 		raise IOError("loadresultsfromdisk error message: could not open '%s' for binary reading." % filename)
 
+	#initialize results: 
 	results=[]
+	results.append(None)
 
 	#Read fields until the end of the file.
 	result=ReadData(fid)
+
+	counter=0
+	check_nomoresteps=0
+	step=result['step']
+
 	while result:
-		if   result['step'] > len(results):
-			for i in xrange(len(results),result['step']-1):
+
+		if check_nomoresteps:
+			#check that the new result does not add a step, which would be an error: 
+			if result['step']>=1:
+				raise TypeError("parsing results for a steady-state core, which incorporates transient results!")
+
+		#Check step, increase counter if this is a new step
+		if(step!=result['step'] and result['step']>1):
+			counter = counter + 1
+			step    = result['step']
+
+		#Add result
+		if result['step']==0:
+			#if we have a step = 0, this is a steady state solution, don't expect more steps. 
+			index = 0;
+			check_nomoresteps=1
+	
+		elif result['step']==1:
+			index = 0
+		else:
+			index = counter;
+	
+		if index > len(results)-1:
+			for i in xrange(len(results)-1,index-1):
 				results.append(None)
 			results.append(resultsclass.results())
-		elif results[result['step']-1] is None:
-			results[result['step']-1]=resultsclass.results()
+		
+		elif results[index] is None:
+			results[index]=resultsclass.results()
+
+			
 		#Get time and step
-		setattr(results[result['step']-1],'step',result['step'])
-		setattr(results[result['step']-1],'time',result['time']) 
+		if result['step'] != -9999.:
+			setattr(results[index],'step',result['step'])
+		if result['time'] != -9999.:
+			setattr(results[index],'time',result['time']) 
 	
 		#Add result
-		if hasattr(results[result['step']-1],result['fieldname']) and not m.strcmp(result['fieldname'],'SolutionType'):
-			setattr(results[result['step']-1],result['fieldname'],numpy.vstack((getattr(results[result['step']-1],result['fieldname']),result['field'])))
+		if hasattr(results[index],result['fieldname']) and not m.strcmp(result['fieldname'],'SolutionType'):
+			setattr(results[index],result['fieldname'],numpy.vstack((getattr(results[index],result['fieldname']),result['field'])))
 		else:
-			setattr(results[result['step']-1],result['fieldname'],result['field'])
+			setattr(results[index],result['fieldname'],result['field'])
 
 		#read next result
 		result=ReadData(fid)
@@ -179,9 +213,13 @@
 			field = field*yts
 		elif m.strcmp(fieldname,'BasalforcingsGroundediceMeltingRate'):
 			field = field*yts
+		elif m.strcmp(fieldname,'TotalFloatingBmb'):
+			field = field/10.**12.*yts #(GigaTon/year)
+		elif m.strcmp(fieldname,'TotalGroundedBmb'):
+			field = field/10.**12.*yts #(GigaTon/year)
 		elif m.strcmp(fieldname,'TotalSmb'):
 			field = field/10.**12.*yts #(GigaTon/year)
-		elif m.strcmp(fieldname,'SurfaceforcingsMassBalance'):
+		elif m.strcmp(fieldname,'SmbMassBalance'):
 			field = field*yts
 		elif m.strcmp(fieldname,'CalvingCalvingrate'):
 			field = field*yts

Modified: issm/trunk/src/m/solve/solve.m
===================================================================
--- issm/trunk/src/m/solve/solve.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/solve/solve.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -21,6 +21,7 @@
 %      - 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) where the restart file is located.
 %
 %   Examples:
 %      md=solve(md,StressbalanceSolutionEnum);
@@ -34,6 +35,7 @@
 %recover some fields
 md.private.solution=solutionenum;
 cluster=md.cluster;
+if strcmpi(getfieldvalue(options,'batch','no'),'yes') batch=1; else batch=0; end
 
 %check model consistency
 if strcmpi(getfieldvalue(options,'checkconsistency','yes'),'yes'),
@@ -52,12 +54,20 @@
 	end
 end
 
+%If we are restarting, actually use the provided runtime name:
+restart=getfieldvalue(options,'restart','');
 %First, build a runtime name that is unique
-if getfieldvalue(options,'runtimename',true),
-	c=clock;
-	md.private.runtimename=sprintf('%s-%02i-%02i-%04i-%02i-%02i-%02i-%i',md.miscellaneous.name,c(2),c(3),c(1),c(4),c(5),floor(c(6)),feature('GetPid'));
+if restart==1 
+	%Leave the runtimename as is
 else
-	md.private.runtimename=md.miscellaneous.name;
+	if ~isempty(restart),
+		md.private.runtimename=restart;
+	elseif getfieldvalue(options,'runtimename',true),
+		c=clock;
+		md.private.runtimename=sprintf('%s-%02i-%02i-%04i-%02i-%02i-%02i-%i',md.miscellaneous.name,c(2),c(3),c(1),c(4),c(5),floor(c(6)),feature('GetPid'));
+	else
+		md.private.runtimename=md.miscellaneous.name;
+	end
 end
 
 %if running qmu analysis, some preprocessing of dakota files using models
@@ -87,18 +97,9 @@
 %Write all input files
 marshall(md);                                          % bin file
 ToolkitsFile(md.toolkits,[md.miscellaneous.name '.toolkits']); % toolkits file
-BuildQueueScript(cluster,md.private.runtimename,md.miscellaneous.name,md.private.solution,md.settings.io_gather,md.debug.valgrind,md.debug.gprof); % queue file
+BuildQueueScript(cluster,md.private.runtimename,md.miscellaneous.name,md.private.solution,md.settings.io_gather,md.debug.valgrind,md.debug.gprof,md.qmu.isdakota); % queue file
 
-%Stop here if batch mode
-if strcmpi(getfieldvalue(options,'batch','no'),'yes')
-	if md.verbose.solution,
-		disp('batch mode requested: not launching job interactively');
-		disp('launch solution sequence on remote cluster by hand');
-	end
-	return;
-end
-
-%Launch job
+%Upload all required files
 modelname = md.miscellaneous.name;
 filelist  = {[modelname '.bin '] [modelname '.toolkits ']};
 if ispc,
@@ -110,8 +111,22 @@
 if md.qmu.isdakota,
 	filelist{end+1} = [modelname '.qmu.in'];
 end
-LaunchQueueJob(cluster,md.miscellaneous.name,md.private.runtimename,filelist);
 
+if isempty(restart),
+	UploadQueueJob(cluster,md.miscellaneous.name,md.private.runtimename,filelist);
+end
+
+%launch queue job: 
+LaunchQueueJob(cluster,md.miscellaneous.name,md.private.runtimename,filelist,restart,batch);
+
+%return if batch: 
+if batch,
+	if md.verbose.solution,
+		disp('batch mode requested: not launching job interactively');
+		disp('launch solution sequence on remote cluster by hand');
+	end
+	return;
+end
 %wait on lock
 if isnan(md.settings.waitonlock),
 	%load when user enters 'y'

Modified: issm/trunk/src/m/solve/solve.py
===================================================================
--- issm/trunk/src/m/solve/solve.py	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/solve/solve.py	2016-04-13 04:32:01 UTC (rev 20500)
@@ -33,6 +33,7 @@
 	   extra options:
 	      - loadonly : does not solve. only load results
 		  - 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.
  
 	   Examples:
 	      md=solve(md,StressbalanceSolutionEnum);
@@ -45,7 +46,11 @@
 
 	#recover some fields
 	md.private.solution=solutionenum
-	cluster=md.cluster
+	cluster=md.cluster 
+	if m.strcmpi(options.getfieldvalue('batch','no'),'yes'):
+		batch=1
+	else:
+		batch=0;
 
 	#check model consistency
 	if m.strcmpi(options.getfieldvalue('checkconsistency','yes'),'yes'):
@@ -60,8 +65,18 @@
 			ismodelselfconsistent(md)
 
 	#First, build a runtime name that is unique
-	c=datetime.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())
+	restart=options.getfieldvalue('restart','')
+	if restart == 1:
+		pass #do nothing
+	else:
+		if restart:
+			md.private.runtimename=restart
+		else:
+			if options.getfieldvalue('runtimename',True):
+				c=datetime.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())
+			else:
+				md.private.runtimename=md.miscellaneous.name 
 
 	#if running qmu analysis, some preprocessing of dakota files using models
 	#fields needs to be carried out. 
@@ -79,10 +94,11 @@
 		md=loadresultsfromcluster(md)
 		return md
 
+
 	#Write all input files
 	marshall(md)                                           # bin file
 	md.toolkits.ToolkitsFile(md.miscellaneous.name+'.toolkits')    # toolkits file
-	cluster.BuildQueueScript(md.private.runtimename,md.miscellaneous.name,md.private.solution,md.settings.io_gather,md.debug.valgrind,md.debug.gprof)    # queue file
+	cluster.BuildQueueScript(md.private.runtimename,md.miscellaneous.name,md.private.solution,md.settings.io_gather,md.debug.valgrind,md.debug.gprof,md.qmu.isdakota)    # queue file
 
 	#Stop here if batch mode
 	if m.strcmpi(options.getfieldvalue('batch','no'),'yes'):
@@ -90,13 +106,18 @@
 		print 'launch solution sequence on remote cluster by hand'
 		return md
 
-	#Launch job
+	#Upload all required files: 
 	modelname = md.miscellaneous.name
 	filelist  = [modelname+'.bin ',modelname+'.toolkits ',modelname+'.queue ']
 	if md.qmu.isdakota:
 		filelist.append(modelname+'.qmu.in')
-	cluster.LaunchQueueJob(md.miscellaneous.name,md.private.runtimename,filelist)
 
+	if not restart:
+		cluster.UploadQueueJob(md.miscellaneous.name,md.private.runtimename,filelist)
+	
+	#Launch job
+	cluster.LaunchQueueJob(md.miscellaneous.name,md.private.runtimename,filelist,restart,batch)
+
 	#wait on lock
 	if md.settings.waitonlock>0:
 		#we wait for the done file

Modified: issm/trunk/src/m/solvers/issmgslsolver.py
===================================================================
--- issm/trunk/src/m/solvers/issmgslsolver.py	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/solvers/issmgslsolver.py	2016-04-13 04:32:01 UTC (rev 20500)
@@ -1,3 +1,4 @@
+from collections import OrderedDict
 import pairoptions
 
 def issmgslsolver(*args):
@@ -9,7 +10,11 @@
 	#retrieve options provided in varargin
 	arguments=pairoptions.pairoptions(*args) 
 	
-	options=[['toolkit','issm'],['mat_type','dense'],['vec_type','seq'],['solver_type','gsl']];
+	options=OrderedDict()
+	options['toolkit'] = 'issm'
+	options['mat_type'] = 'dense'
+	options['vec_type'] = 'seq'
+	options['solver_type'] = 'gsl'
 
 	#now, go through our arguments, and write over default options.
 	for i in range(len(arguments.list)):

Modified: issm/trunk/src/m/solvers/issmmumpssolver.py
===================================================================
--- issm/trunk/src/m/solvers/issmmumpssolver.py	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/solvers/issmmumpssolver.py	2016-04-13 04:32:01 UTC (rev 20500)
@@ -1,3 +1,4 @@
+from collections import OrderedDict
 import pairoptions
 
 def issmmumpssolver(*args):
@@ -9,7 +10,11 @@
 	#retrieve options provided in varargin
 	arguments=pairoptions.pairoptions(*args) 
 	
-	options=[['toolkit','issm'],['mat_type','mpidense'],['vec_type','mpi'],['solver_type','mumps']];
+	options=OrderedDict()
+	options['toolkit'] = 'issm'
+	options['mat_type'] = 'mpidense'
+	options['vec_type'] = 'mpi'
+	options['solver_type'] = 'mumps'
 
 	#now, go through our arguments, and write over default options.
 	for i in range(len(arguments.list)):

Modified: issm/trunk/src/m/string/strsplit_strict.m
===================================================================
--- issm/trunk/src/m/string/strsplit_strict.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/m/string/strsplit_strict.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -1,5 +1,5 @@
-function splittedstring = strsplit(inpstr,delimiter)
-%STRSPLIT - split a tring of delimiter separated values
+function splittedstring = strsplit_strict(inpstr,delimiter)
+%STRSPLIT_STRICT - split a string of delimiter separated values
 %
 %   Usage:
 %      output = strsplit_strict(inpstr,delimiter)

Modified: issm/trunk/src/wrappers/ContourToMesh/ContourToMesh.cpp
===================================================================
--- issm/trunk/src/wrappers/ContourToMesh/ContourToMesh.cpp	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/wrappers/ContourToMesh/ContourToMesh.cpp	2016-04-13 04:32:01 UTC (rev 20500)
@@ -89,8 +89,8 @@
 	xDelete<double>(y);
 	xDelete<char>(interptype);
 	delete contours;
-	delete in_nod;
-	delete in_elem;
+	xDelete<double>(in_nod);
+	xDelete<double>(in_elem);
 	/*end module: */
 	MODULEEND();
 }

Modified: issm/trunk/src/wrappers/ContourToMesh/ContourToMesh.h
===================================================================
--- issm/trunk/src/wrappers/ContourToMesh/ContourToMesh.h	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/wrappers/ContourToMesh/ContourToMesh.h	2016-04-13 04:32:01 UTC (rev 20500)
@@ -54,6 +54,21 @@
 #define PLHS1 output,1
 #endif
 
+#ifdef _HAVE_JAVASCRIPT_MODULES_
+/* serial input macros: */
+#define INDEX       indexin,nelin,3
+#define X           xin,nodsin,1
+#define Y           yin,nodsin,1
+#define CONTOUR     contourx,contoury,contour_nods
+#define INTERPTYPE  interptypein
+#define EDGEVALUE   valuein
+#define WRAPPER(modulename) extern "C" { int  ContourToMeshModule(double** pin_nod, double** pin_nel, double* indexin, double* xin, double* yin, double* contourx, double* contoury, char* interptypein, int nelin, int nodsin, int contour_nods, double valuein)
+/* serial output macros: */
+#define PLHS0 pin_nod,NULL
+#define PLHS1 pin_nel,NULL
+#define nrhs 6
+#endif
+
 /* serial arg counts: */
 #undef NLHS
 #define NLHS  2

Modified: issm/trunk/src/wrappers/ContourToNodes/ContourToNodes.cpp
===================================================================
--- issm/trunk/src/wrappers/ContourToNodes/ContourToNodes.cpp	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/wrappers/ContourToNodes/ContourToNodes.cpp	2016-04-13 04:32:01 UTC (rev 20500)
@@ -49,6 +49,7 @@
 	xDelete<double>(y);
 	xDelete<char>(contourname);
 	delete contours;
+	xDelete<double>(flags);
 
 	/*end module: */
 	MODULEEND();

Modified: issm/trunk/src/wrappers/ElementConnectivity/ElementConnectivity.cpp
===================================================================
--- issm/trunk/src/wrappers/ElementConnectivity/ElementConnectivity.cpp	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/wrappers/ElementConnectivity/ElementConnectivity.cpp	2016-04-13 04:32:01 UTC (rev 20500)
@@ -37,6 +37,7 @@
 	WriteData(ELEMENTCONNECTIVITY,elementconnectivity,nels,3);
 
 	/*Clean up*/
+	xDelete<int>(elements);
 	xDelete<int>(nodeconnectivity);
 	xDelete<int>(elementconnectivity);
 

Modified: issm/trunk/src/wrappers/ElementConnectivity/ElementConnectivity.h
===================================================================
--- issm/trunk/src/wrappers/ElementConnectivity/ElementConnectivity.h	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/wrappers/ElementConnectivity/ElementConnectivity.h	2016-04-13 04:32:01 UTC (rev 20500)
@@ -44,6 +44,15 @@
 #define ELEMENTCONNECTIVITY output,0
 #endif
 
+#ifdef _HAVE_JAVASCRIPT_MODULES_
+/* serial input macros: */
+#define ELEMENTS         elementsin, nelsin,3
+#define NODECONNECTIVITY nodeconnectivityin, nodsin, widthin
+/* serial output macros: */
+#define ELEMENTCONNECTIVITY pelementconnectivity,NULL,NULL
+#define WRAPPER(modulename) extern "C" { int  ElementConnectivityModule(double** pelementconnectivity, int* elementsin, int* nodeconnectivityin, int nelsin, int nodsin, int widthin)
+#endif
+
 /* serial arg counts: */
 #undef NLHS
 #define NLHS  1

Modified: issm/trunk/src/wrappers/EnumToString/EnumToString.cpp
===================================================================
--- issm/trunk/src/wrappers/EnumToString/EnumToString.cpp	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/wrappers/EnumToString/EnumToString.cpp	2016-04-13 04:32:01 UTC (rev 20500)
@@ -11,8 +11,8 @@
 }/*}}}*/
 WRAPPER(EnumToString){
 
-	char    *name    = NULL;
-	int      enum_in;
+	char *name = NULL;
+	int   enum_in;
 
 	/*Boot module: */
 	MODULEBOOT();

Modified: issm/trunk/src/wrappers/EnumToString/EnumToString.h
===================================================================
--- issm/trunk/src/wrappers/EnumToString/EnumToString.h	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/wrappers/EnumToString/EnumToString.h	2016-04-13 04:32:01 UTC (rev 20500)
@@ -39,6 +39,15 @@
 #define NAME output,0
 #endif
 
+#ifdef _HAVE_JAVASCRIPT_MODULES_
+/* serial input macros: */
+#define ENUMIN enumin
+/* serial output macros: */
+#define NAME pstring
+#define WRAPPER(modulename) extern "C" { int  EnumToStringModule(char** pstring, int enumin)
+#endif
+
+
 /* serial arg counts: */
 #undef NLHS
 #define NLHS  1

Modified: issm/trunk/src/wrappers/ExpSimplify/ExpSimplify.cpp
===================================================================
--- issm/trunk/src/wrappers/ExpSimplify/ExpSimplify.cpp	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/wrappers/ExpSimplify/ExpSimplify.cpp	2016-04-13 04:32:01 UTC (rev 20500)
@@ -215,6 +215,8 @@
 	/*Clean-up*/
 	xDelete<char>(expfile);
 	delete options;
+	delete oldcontours;
+	delete newcontours;
 
 	/*end module: */
 	MODULEEND();

Modified: issm/trunk/src/wrappers/ExpToLevelSet/ExpToLevelSet.cpp
===================================================================
--- issm/trunk/src/wrappers/ExpToLevelSet/ExpToLevelSet.cpp	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/wrappers/ExpToLevelSet/ExpToLevelSet.cpp	2016-04-13 04:32:01 UTC (rev 20500)
@@ -26,11 +26,11 @@
 
 	/* required input: */
 	int       nods;
-	double   *x           = NULL;
-	double   *y           = NULL;
-	char     *interptype  = NULL;
-	double *flags = NULL;
-	Contours *contours    = NULL;
+	double   *x          = NULL;
+	double   *y          = NULL;
+	char     *interptype = NULL;
+	double   *flags      = NULL;
+	Contours *contours   = NULL;
 
 	/* output: */
 	double *distance  = NULL;
@@ -68,8 +68,10 @@
 	/*Clean up*/
 	xDelete<double>(x);
 	xDelete<double>(y);
+	xDelete<char>(interptype);
 	delete contours;
-	delete distance;
+	xDelete<double>(distance);
+	xDelete<double>(flags);
 	
 	/*end module: */
 	MODULEEND();

Modified: issm/trunk/src/wrappers/InterpFromGridToMesh/InterpFromGridToMesh.cpp
===================================================================
--- issm/trunk/src/wrappers/InterpFromGridToMesh/InterpFromGridToMesh.cpp	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/wrappers/InterpFromGridToMesh/InterpFromGridToMesh.cpp	2016-04-13 04:32:01 UTC (rev 20500)
@@ -47,12 +47,10 @@
 	MODULEBOOT();
 
 	/*checks on arguments on the matlab side: */
-	#ifdef _HAVE_MATLAB_MODULES_
-	if((nlhs!=NLHS) || (nrhs!=6 && nrhs!=7)){
+	if(nrhs!=6 && nrhs!=7){
 		InterpFromGridToMeshUsage();
-		_error_("usage. See above");
+		_error_("Wrong usage. See above");
 	}
-	#endif
 
 	/*Input datasets: */
 	FetchData(&x,&x_rows,NULL,XHANDLE);
@@ -75,5 +73,10 @@
 	WriteData(DATAMESH,data_mesh);
 
 	/*end module: */
+	xDelete<double>(x);
+	xDelete<double>(y);
+	xDelete<double>(data);
+	xDelete<double>(x_mesh);
+	xDelete<double>(y_mesh);
 	MODULEEND();
 }

Modified: issm/trunk/src/wrappers/InterpFromMesh2d/InterpFromMesh2d.cpp
===================================================================
--- issm/trunk/src/wrappers/InterpFromMesh2d/InterpFromMesh2d.cpp	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/wrappers/InterpFromMesh2d/InterpFromMesh2d.cpp	2016-04-13 04:32:01 UTC (rev 20500)
@@ -138,5 +138,14 @@
 	WriteData(DATAPRIME,data_prime);
 
 	/*end module: */
+	xDelete<double>(index_data);
+	xDelete<double>(x_data);
+	xDelete<double>(y_data);
+	xDelete<double>(data);
+	xDelete<double>(x_prime);
+	xDelete<double>(y_prime);
+	xDelete<double>(default_values);
+
+	/*end module: */
 	MODULEEND();
 }

Modified: issm/trunk/src/wrappers/InterpFromMeshToGrid/InterpFromMeshToGrid.cpp
===================================================================
--- issm/trunk/src/wrappers/InterpFromMeshToGrid/InterpFromMeshToGrid.cpp	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/wrappers/InterpFromMeshToGrid/InterpFromMeshToGrid.cpp	2016-04-13 04:32:01 UTC (rev 20500)
@@ -71,7 +71,13 @@
 	WriteData(GRIDDATA,griddata,nlines,ncols);
 
 	/*Free ressources: */
-	//let matlab do this.
+	xDelete<double>(index);
+	xDelete<double>(x);
+	xDelete<double>(y);
+	xDelete<double>(meshdata);
+	xDelete<double>(griddata);
+	xDelete<double>(x_m);
+	xDelete<double>(y_m);
 
 	/*end module: */
 	MODULEEND();

Modified: issm/trunk/src/wrappers/InterpFromMeshToMesh2d/InterpFromMeshToMesh2d.cpp
===================================================================
--- issm/trunk/src/wrappers/InterpFromMeshToMesh2d/InterpFromMeshToMesh2d.cpp	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/wrappers/InterpFromMeshToMesh2d/InterpFromMeshToMesh2d.cpp	2016-04-13 04:32:01 UTC (rev 20500)
@@ -19,7 +19,7 @@
 	_printf0_("      x_interp,y_interp : coordinates of the points onto which we interpolate.\n");
 	_printf0_("      data_interp       : vector of mesh interpolated data.\n");
 	_printf0_("      Available options :\n");
-	_printf0_("         - 'default' : default value if point is outsite of triangulation (instead of linear interolation)\n");
+	_printf0_("         - 'default' : default value if point is outsite of triangulation (instead of linear interpolation)\n");
 	_printf0_("\n");
 	_printf0_("   Example:\n");
 	_printf0_("      load('temperature.mat');\n");

Modified: issm/trunk/src/wrappers/InterpFromMeshToMesh2d/InterpFromMeshToMesh2d.h
===================================================================
--- issm/trunk/src/wrappers/InterpFromMeshToMesh2d/InterpFromMeshToMesh2d.h	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/wrappers/InterpFromMeshToMesh2d/InterpFromMeshToMesh2d.h	2016-04-13 04:32:01 UTC (rev 20500)
@@ -54,6 +54,21 @@
 #define DATAINTERP output,0
 #endif
 
+#ifdef _HAVE_JAVASCRIPT_MODULES_
+/* serial input macros: */
+#define INDEX          indexin,nelin,3
+#define X              xin,nodsin
+#define Y              yin,nodsin
+#define DATA           datain,nodsin,1
+#define XINTERP        x_interpin, nods_interpin
+#define YINTERP        y_interpin, nods_interpin
+#define ARGUMENTS "default_value",default_value
+/* serial output macros: */
+#define DATAINTERP pdata_interp,NULL,NULL
+#define WRAPPER(modulename) extern "C" { int  InterpFromMeshToMesh2dModule(double** pdata_interp,int* indexin,double* xin,double* yin,double* datain,double* x_interpin,double* y_interpin,int nelin,int nodsin,int nods_interpin,double default_value)
+#define nrhs  6
+#endif
+
 /* serial arg counts: */
 #undef NLHS
 #define NLHS  1

Modified: issm/trunk/src/wrappers/InterpFromMeshToMesh3d/InterpFromMeshToMesh3d.cpp
===================================================================
--- issm/trunk/src/wrappers/InterpFromMeshToMesh3d/InterpFromMeshToMesh3d.cpp	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/wrappers/InterpFromMeshToMesh3d/InterpFromMeshToMesh3d.cpp	2016-04-13 04:32:01 UTC (rev 20500)
@@ -99,5 +99,16 @@
 	WriteData(DATAPRIME,data_prime);
 
 	/*end module: */
+	xDelete<double>(index_data);
+	xDelete<double>(x_data);
+	xDelete<double>(y_data);
+	xDelete<double>(z_data);
+	xDelete<double>(data);
+	xDelete<double>(x_prime);
+	xDelete<double>(y_prime);
+	xDelete<double>(z_prime);
+	delete data_prime;
+
+	/*end module: */
 	MODULEEND();
 }

Modified: issm/trunk/src/wrappers/IssmConfig/IssmConfig.cpp
===================================================================
--- issm/trunk/src/wrappers/IssmConfig/IssmConfig.cpp	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/wrappers/IssmConfig/IssmConfig.cpp	2016-04-13 04:32:01 UTC (rev 20500)
@@ -20,7 +20,7 @@
 	/*input/output*/
 	char       *name     = NULL;
 	bool        isstring = false;
-	IssmDouble  value   = 0.;
+	IssmDouble  value    = 0.;
 	char       *svalue   = NULL;
 
 	/*Boot module: */
@@ -38,6 +38,11 @@
 		value = 1.;
 		#endif
 	}
+	else if(strcmp(name,"_HAVE_PETSC_MPI_")==0){
+		#ifdef _HAVE_PETSC_MPI_
+		value = 1.;
+		#endif
+	}
 	else if(strcmp(name,"_HAVE_DAKOTA_")==0){
 		#ifdef _HAVE_DAKOTA_
 		value = 1.;
@@ -152,7 +157,7 @@
 
 	/* output: */
 	if(isstring)
-	 WriteData(VALUE,svalue);
+	 WriteData(SVALUE,svalue);
 	else
 	 WriteData(VALUE,value);
 

Modified: issm/trunk/src/wrappers/IssmConfig/IssmConfig.h
===================================================================
--- issm/trunk/src/wrappers/IssmConfig/IssmConfig.h	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/wrappers/IssmConfig/IssmConfig.h	2016-04-13 04:32:01 UTC (rev 20500)
@@ -30,6 +30,7 @@
 #define NAME (mxArray*)prhs[0]
 /* serial output macros: */
 #define VALUE (mxArray**)&plhs[0]
+#define SVALUE (mxArray**)&plhs[0]
 #endif
 
 #ifdef _HAVE_PYTHON_MODULES_
@@ -37,8 +38,19 @@
 #define NAME PyTuple_GetItem(args,0)
 /* serial output macros: */
 #define VALUE output,0
+#define SVALUE output,0
 #endif
 
+
+#ifdef _HAVE_JAVASCRIPT_MODULES_
+/* serial input macros: */
+#define NAME string
+/* serial output macros: */
+#define VALUE pvalue
+#define SVALUE psvalue
+#define WRAPPER(modulename) extern "C" { int  IssmConfigModule(double* pvalue, char** psvalue, char* string)
+#endif
+
 /* serial arg counts: */
 #undef NLHS
 #define NLHS  1

Modified: issm/trunk/src/wrappers/Ll2xy/Ll2xy.cpp
===================================================================
--- issm/trunk/src/wrappers/Ll2xy/Ll2xy.cpp	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/wrappers/Ll2xy/Ll2xy.cpp	2016-04-13 04:32:01 UTC (rev 20500)
@@ -90,6 +90,10 @@
 	WriteData(Y_OUT,y,ncoord);
 
 	/*Clean-up*/
+	xDelete<double>(lat);
+	xDelete<double>(lon);
+	xDelete<double>(x);
+	xDelete<double>(y);
 	delete options;
 
 	/*end module: */

Modified: issm/trunk/src/wrappers/M1qn3/M1qn3.cpp
===================================================================
--- issm/trunk/src/wrappers/M1qn3/M1qn3.cpp	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/wrappers/M1qn3/M1qn3.cpp	2016-04-13 04:32:01 UTC (rev 20500)
@@ -153,6 +153,12 @@
 	WriteData(XOUT,X_out,n);
 
 	/*end module: */
+	xDelete<double>(Xs);
+	xDelete<double>(Gs);
+	xDelete<double>(Js);
+	xDelete<double>(X_out);
+	xDelete<double>(G);
+	xDelete<double>(X);
 	MODULEEND();
 	#else
 	_error_("m1qn3 is not installed");

Modified: issm/trunk/src/wrappers/Makefile.am
===================================================================
--- issm/trunk/src/wrappers/Makefile.am	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/wrappers/Makefile.am	2016-04-13 04:32:01 UTC (rev 20500)
@@ -5,6 +5,10 @@
 SUBDIRS += matlab
 endif
 
+if JAVASCRIPT
+SUBDIRS += javascript
+endif
+
 if PYTHON
 SUBDIRS += python
 endif

Modified: issm/trunk/src/wrappers/MeshPartition/MeshPartition.cpp
===================================================================
--- issm/trunk/src/wrappers/MeshPartition/MeshPartition.cpp	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/wrappers/MeshPartition/MeshPartition.cpp	2016-04-13 04:32:01 UTC (rev 20500)
@@ -88,7 +88,12 @@
 	WriteData(NODEPARTITIONING,node_partitioning,numberofvertices);
 
 	/*Free ressources:*/
-	//don't! let matlab do it.
+	xDelete<int>(elements);
+	xDelete<int>( elements2d);
+	xDelete<int>(int_element_partitioning);
+	xDelete<int>(int_node_partitioning);
+	xDelete<double>(element_partitioning);
+	xDelete<double>(node_partitioning);
 
 	/*end module: */
 	MODULEEND();

Modified: issm/trunk/src/wrappers/MeshProfileIntersection/MeshProfileIntersection.cpp
===================================================================
--- issm/trunk/src/wrappers/MeshProfileIntersection/MeshProfileIntersection.cpp	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/wrappers/MeshProfileIntersection/MeshProfileIntersection.cpp	2016-04-13 04:32:01 UTC (rev 20500)
@@ -88,6 +88,13 @@
 	WriteData(SEGMENTS,segments,numsegs,5);
 
 	/*end module: */
+	xDelete<double>(double_index);
+	xDelete<int>(index);
+	xDelete<double>(x);
+	xDelete<double>(y);
+	delete domain;
+	delete contouri;
+	xDelete<double>(segments);
 	MODULEEND();
 
 }

Modified: issm/trunk/src/wrappers/NodeConnectivity/NodeConnectivity.cpp
===================================================================
--- issm/trunk/src/wrappers/NodeConnectivity/NodeConnectivity.cpp	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/wrappers/NodeConnectivity/NodeConnectivity.cpp	2016-04-13 04:32:01 UTC (rev 20500)
@@ -37,5 +37,7 @@
 	WriteData(CONNECTIVITY,connectivity,nods,width);
 
 	/*end module: */
+	xDelete<int>(elements);
+	xDelete<int>(connectivity);
 	MODULEEND();
 }

Modified: issm/trunk/src/wrappers/NodeConnectivity/NodeConnectivity.h
===================================================================
--- issm/trunk/src/wrappers/NodeConnectivity/NodeConnectivity.h	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/wrappers/NodeConnectivity/NodeConnectivity.h	2016-04-13 04:32:01 UTC (rev 20500)
@@ -44,6 +44,15 @@
 #define CONNECTIVITY output,0
 #endif
 
+#ifdef _HAVE_JAVASCRIPT_MODULES_
+/* serial input macros: */
+#define ELEMENTS elementsin, nelsin,3
+#define NUMNODES nodsin
+/* serial output macros: */
+#define CONNECTIVITY pconnectivity,pnods,pwidth
+#define WRAPPER(modulename) extern "C" { int  NodeConnectivityModule(double** pconnectivity, int* pnods, int *pwidth, int* elementsin, int nelsin, int nodsin)
+#endif
+
 /* serial arg counts: */
 #undef NLHS
 #define NLHS  1

Modified: issm/trunk/src/wrappers/PointCloudFindNeighbors/PointCloudFindNeighbors.cpp
===================================================================
--- issm/trunk/src/wrappers/PointCloudFindNeighbors/PointCloudFindNeighbors.cpp	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/wrappers/PointCloudFindNeighbors/PointCloudFindNeighbors.cpp	2016-04-13 04:32:01 UTC (rev 20500)
@@ -47,5 +47,9 @@
 	WriteData(FLAGS,flags);
 
 	/*end module: */
+	xDelete<double>(x);
+	xDelete<double>(y);
+
+	/*end module: */
 	MODULEEND();
 }

Modified: issm/trunk/src/wrappers/PropagateFlagsFromConnectivity/PropagateFlagsFromConnectivity.cpp
===================================================================
--- issm/trunk/src/wrappers/PropagateFlagsFromConnectivity/PropagateFlagsFromConnectivity.cpp	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/wrappers/PropagateFlagsFromConnectivity/PropagateFlagsFromConnectivity.cpp	2016-04-13 04:32:01 UTC (rev 20500)
@@ -39,6 +39,7 @@
 
 	/*Free ressources: */
 	xDelete<double>(connectivity);
+	xDelete<double>(pool);
 	xDelete<double>(flags);
 
 	/*end module: */

Modified: issm/trunk/src/wrappers/StringToEnum/StringToEnum.cpp
===================================================================
--- issm/trunk/src/wrappers/StringToEnum/StringToEnum.cpp	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/wrappers/StringToEnum/StringToEnum.cpp	2016-04-13 04:32:01 UTC (rev 20500)
@@ -11,8 +11,8 @@
 }/*}}}*/
 WRAPPER(StringToEnum){
 
-	char    *name    = NULL;
-	int      enum_out;
+	char *name = NULL;
+	int   enum_out;
 
 	/*Boot module: */
 	MODULEBOOT();
@@ -30,5 +30,6 @@
 	WriteData(ENUMOUT,enum_out);
 
 	/*end module: */
+	xDelete<char>(name);
 	MODULEEND();
 }

Modified: issm/trunk/src/wrappers/StringToEnum/StringToEnum.h
===================================================================
--- issm/trunk/src/wrappers/StringToEnum/StringToEnum.h	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/wrappers/StringToEnum/StringToEnum.h	2016-04-13 04:32:01 UTC (rev 20500)
@@ -39,6 +39,14 @@
 #define ENUMOUT output,0
 #endif
 
+#ifdef _HAVE_JAVASCRIPT_MODULES_
+/* serial input macros: */
+#define NAME string
+/* serial output macros: */
+#define ENUMOUT penum
+#define WRAPPER(modulename) extern "C" { int  StringToEnumModule(double* penum, char* string)
+#endif
+
 /* serial arg counts: */
 #undef NLHS
 #define NLHS  1

Modified: issm/trunk/src/wrappers/TriMesh/TriMesh.cpp
===================================================================
--- issm/trunk/src/wrappers/TriMesh/TriMesh.cpp	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/wrappers/TriMesh/TriMesh.cpp	2016-04-13 04:32:01 UTC (rev 20500)
@@ -14,7 +14,7 @@
 	_printf_("\n");
 }/*}}}*/
 WRAPPER(TriMesh){
-
+	
 	/*intermediary: */
 	double    area;
 	Contours *domain = NULL;
@@ -26,7 +26,7 @@
 	double *y                 = NULL;
 	int    *segments          = NULL;
 	int    *segmentmarkerlist = NULL;
-	int     nels,nods,nsegs;
+	int     nel,nods,nsegs;
 
 	/*Boot module: */
 	MODULEBOOT();
@@ -40,10 +40,10 @@
 	FetchData(&area,AREA);
 
 	/*call x core: */
-	TriMeshx(&index,&x,&y,&segments,&segmentmarkerlist,&nels,&nods,&nsegs,domain,rifts,area);
+	TriMeshx(&index,&x,&y,&segments,&segmentmarkerlist,&nel,&nods,&nsegs,domain,rifts,area);
 
 	/*write outputs: */
-	WriteData(INDEX,index,nels,3);
+	WriteData(INDEX,index,nel,3);
 	WriteData(X,x,nods);
 	WriteData(Y,y,nods);
 	WriteData(SEGMENTS,segments,nsegs,3);

Modified: issm/trunk/src/wrappers/TriMesh/TriMesh.h
===================================================================
--- issm/trunk/src/wrappers/TriMesh/TriMesh.h	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/wrappers/TriMesh/TriMesh.h	2016-04-13 04:32:01 UTC (rev 20500)
@@ -16,6 +16,11 @@
 #define PY_ARRAY_UNIQUE_SYMBOL PythonIOSymbol
 #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"
@@ -54,6 +59,22 @@
 #define SEGMENTMARKERLIST output,4
 #endif
 
+#ifdef _HAVE_JAVASCRIPT_MODULES_
+/* serial input macros: */
+#define DOMAINOUTLINE domainx,domainy,domainnods
+#define RIFTSOUTLINE  NULL,NULL,0
+#define AREA          areain
+/* serial output macros: */
+#define INDEX             pindex,pnel
+#define X                 px,pnods
+#define Y                 py,pnods
+#define SEGMENTS          psegments,pnsegs
+#define SEGMENTMARKERLIST psegmentmarkers,pnsegs
+#define WRAPPER(modulename) extern "C" { int  TriMeshModule(double** pindex, double** px, double** py, int* pnel, int* pnods, double** psegments, double** psegmentmarkers, int* pnsegs, double* domainx, double* domainy, int domainnods, double areain)
+#define _DO_NOT_LOAD_GLOBALS_//we only load globals for TriMeshModule.js, not other modules!
+#endif
+
+
 /* serial arg counts: */
 #undef NLHS
 #define NLHS  5

Modified: issm/trunk/src/wrappers/TriMeshProcessRifts/TriMeshProcessRifts.cpp
===================================================================
--- issm/trunk/src/wrappers/TriMeshProcessRifts/TriMeshProcessRifts.cpp	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/wrappers/TriMeshProcessRifts/TriMeshProcessRifts.cpp	2016-04-13 04:32:01 UTC (rev 20500)
@@ -49,5 +49,11 @@
 	WriteData(RIFTSTRUCT,riftstruct);
 
 	/*end module: */
+	delete riftstruct;
+	xDelete<int>(index);
+	xDelete<double>(x);
+	xDelete<double>(y);
+	xDelete<int>(segments);
+	xDelete<int>(segmentmarkers );
 	MODULEEND();
 }

Modified: issm/trunk/src/wrappers/TriaSearch/TriaSearch.cpp
===================================================================
--- issm/trunk/src/wrappers/TriaSearch/TriaSearch.cpp	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/wrappers/TriaSearch/TriaSearch.cpp	2016-04-13 04:32:01 UTC (rev 20500)
@@ -55,6 +55,14 @@
 	/*Write data: */
 	WriteData(TRIA,tria,numberofnodes);
 
+	/*Cleanup*/
+	xDelete<int>(index);
+	xDelete<double>(x);
+	xDelete<double>(y);
+	xDelete<double>(x0);
+	xDelete<double>(y0);
+	xDelete<double>(tria);
+
 	/*end module: */
 	MODULEEND();
 }

Modified: issm/trunk/src/wrappers/Xy2ll/Xy2ll.cpp
===================================================================
--- issm/trunk/src/wrappers/Xy2ll/Xy2ll.cpp	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/wrappers/Xy2ll/Xy2ll.cpp	2016-04-13 04:32:01 UTC (rev 20500)
@@ -89,6 +89,10 @@
 	WriteData(LON_OUT,lon,ncoord);
 
 	/*Clean-up*/
+	xDelete<double>(lat);
+	xDelete<double>(lon);
+	xDelete<double>(x);
+	xDelete<double>(y);
 	delete options;
 
 	/*end module: */

Modified: issm/trunk/src/wrappers/bindings.h
===================================================================
--- issm/trunk/src/wrappers/bindings.h	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/wrappers/bindings.h	2016-04-13 04:32:01 UTC (rev 20500)
@@ -19,4 +19,11 @@
 #include "./matlab/io/matlabio.h"
 #endif
 
+#ifdef  _HAVE_JAVASCRIPT_MODULES_
+#include "./javascript/include/javascriptincludes.h"
+#include "./javascript/include/wrapper_macros.h"
+#include "./javascript/io/javascriptio.h"
 #endif
+
+
+#endif


Property changes on: issm/trunk/src/wrappers/javascript
___________________________________________________________________
Added: svn:ignore
   + .libs
*.obj
Makefile
*.lib
*.manifest
*.exp
.deps
Makefile.in


Modified: issm/trunk/src/wrappers/matlab/Makefile.am
===================================================================
--- issm/trunk/src/wrappers/matlab/Makefile.am	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/wrappers/matlab/Makefile.am	2016-04-13 04:32:01 UTC (rev 20500)
@@ -7,7 +7,12 @@
 AM_CPPFLAGS+=  -DISSM_PREFIX='"$(prefix)"'
 
 #matlab io{{{
+if !WINDOWS
 lib_LTLIBRARIES = libISSMMatlab.la
+else
+noinst_LTLIBRARIES = libISSMMatlab.la
+lib_LTLIBRARIES = 
+endif
 
 io_sources= ./io/CheckNumMatlabArguments.cpp\
 				./io/WriteMatlabData.cpp\
@@ -19,7 +24,11 @@
 libISSMMatlab_la_CXXFLAGS= $(ALLCXXFLAGS)
 #}}}
 #api io{{{
+if !WINDOWS
 lib_LTLIBRARIES += libISSMApi.la
+else
+noinst_LTLIBRARIES += libISSMApi.la
+endif
 
 api_sources= ./io/ApiPrintf.cpp
 
@@ -32,6 +41,7 @@
 						 BamgTriangulate.la\
 						 ContourToMesh.la\
 						 ContourToNodes.la\
+						 DistanceToMaskBoundary.la\
 						 ElementConnectivity.la\
 						 EnumToString.la\
 						 ExpSimplify.la\
@@ -54,9 +64,11 @@
 						 TriMesh.la\
 						 TriMeshProcessRifts.la\
 						 Scotch.la\
-						 Xy2ll.la\
-						 Chaco.la
+						 Xy2ll.la
 
+if CHACO
+lib_LTLIBRARIES += Chaco.la
+endif
 if KRIGING
 lib_LTLIBRARIES +=  Kriging.la
 endif
@@ -78,7 +90,7 @@
 AM_CXXFLAGS =  -DTRILIBRARY -DANSI_DECLARATORS -DNO_TIMER -D_WRAPPERS_
 
 #Matlab part
-AM_LDFLAGS = -module $(MEXLINK) -shrext ${EXEEXT} --export-dynamic -rdynamic
+AM_LDFLAGS = -module $(MEXLINK) -shrext ${EXEEXT} --export-dynamic -rdynamic -no-undefined
 if VERSION
 AM_LDFLAGS +=
 else
@@ -93,6 +105,10 @@
 
 deps += ./libISSMMatlab.la ../../c/libISSMModules.la ../../c/libISSMCore.la ./libISSMApi.la
 
+if WINDOWS
+deps += $(METISLIB)
+endif
+
 if ADOLC
 deps += $(ADOLCLIB)
 endif
@@ -108,13 +124,18 @@
 AM_CXXFLAGS += $(CXXOPTFLAGS) 
 #}}}
 # Module sources and dependencies {{{
-libISSMMatlab_la_LIBADD = ./../../c/libISSMCore.la ./../../c/libISSMModules.la $(MPILIB) $(PETSCLIB) $(GSLLIB) $(PROJ4LIB) $(MATHLIB) $(MEXLIB) 
+if !WINDOWS
+libISSMMatlab_la_LIBADD = ./../../c/libISSMCore.la ./../../c/libISSMModules.la $(MPILIB) $(PETSCLIB) $(MKLLIB) $(GSLLIB) $(PROJ4LIB) $(MATHLIB) $(MEXLIB) 
+endif
 
 if STANDALONE_LIBRARIES
 libISSMMatlab_la_LDFLAGS = -static 
+deps += $(PETSCLIB) $(TAOLIB) $(M1QN3LIB) $(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 = $(MPILIB) $(PETSCLIB) $(GSLLIB) $(PROJ4LIB) $(MATHLIB) $(MEXLIB)
+endif
 
 if STANDALONE_LIBRARIES
 libISSMApi_la_LDFLAGS = -static 
@@ -129,8 +150,10 @@
 BamgTriangulate_la_SOURCES = ../BamgTriangulate/BamgTriangulate.cpp
 BamgTriangulate_la_LIBADD = ${deps} $(MPILIB) $(PETSCLIB) $(GSLLIB) $(PROJ4LIB)
 
+if CHACO
 Chaco_la_SOURCES = ../Chaco/Chaco.cpp
 Chaco_la_LIBADD = ${deps} $(MPILIB) $(CHACOLIB) $(GSLLIB) $(PROJ4LIB) $(PETSCLIB)
+endif
 
 ContourToMesh_la_SOURCES = ../ContourToMesh/ContourToMesh.cpp
 ContourToMesh_la_LIBADD = ${deps} $(MPILIB) $(PETSCLIB) $(MULTITHREADINGLIB) $(GSLLIB) $(PROJ4LIB)
@@ -142,6 +165,9 @@
 ContourToNodes_la_SOURCES = ../ContourToNodes/ContourToNodes.cpp
 ContourToNodes_la_LIBADD = ${deps} $(MPILIB) $(PETSCLIB) $(GSLLIB) $(PROJ4LIB)
 
+DistanceToMaskBoundary_la_SOURCES = ../DistanceToMaskBoundary/DistanceToMaskBoundary.cpp
+DistanceToMaskBoundary_la_LIBADD = ${deps} $(MPILIB) $(PETSCLIB) $(GSLLIB) $(PROJ4LIB)
+
 ElementConnectivity_la_SOURCES = ../ElementConnectivity/ElementConnectivity.cpp
 ElementConnectivity_la_LIBADD = ${deps} $(MPILIB) $(PETSCLIB) $(GSLLIB) $(PROJ4LIB)
 
@@ -215,7 +241,7 @@
 PropagateFlagsFromConnectivity_la_LIBADD = ${deps} $(MPILIB) $(PETSCLIB) $(GSLLIB) $(PROJ4LIB)
 
 Scotch_la_SOURCES = ../Scotch/Scotch.cpp
-Scotch_la_LIBADD = ${deps} $(SCOTCHLIB) $(MPILIB) $(BLASLAPACKLIB)
+Scotch_la_LIBADD = ${deps} $(SCOTCHLIB) $(MPILIB) $(PETSCLIB) $(BLASLAPACKLIB)
 
 ShpRead_la_SOURCES = ../ShpRead/ShpRead.cpp
 ShpRead_la_LIBADD = ${deps} $(SHAPELIBLIB) $(MPILIB) $(PETSCLIB) $(GSLLIB) $(PROJ4LIB)

Modified: issm/trunk/src/wrappers/matlab/include/wrapper_macros.h
===================================================================
--- issm/trunk/src/wrappers/matlab/include/wrapper_macros.h	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/wrappers/matlab/include/wrapper_macros.h	2016-04-13 04:32:01 UTC (rev 20500)
@@ -22,7 +22,7 @@
 
 #define MODULEEND(); }\
 	catch(ErrorException &exception){\
-		mexErrMsgTxt(exception.MatlabReport()); \
+		mexErrMsgTxt(exception.WrapperReport()); \
 	}\
 	catch (exception &e){\
 		mexErrMsgTxt(e.what());\

Modified: issm/trunk/src/wrappers/python/include/pythonincludes.h
===================================================================
--- issm/trunk/src/wrappers/python/include/pythonincludes.h	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/wrappers/python/include/pythonincludes.h	2016-04-13 04:32:01 UTC (rev 20500)
@@ -10,7 +10,7 @@
 
 #ifdef _HAVE_PYTHON_
 
-#if _PYTHON_MAJOR_ == 2
+#if _PYTHON_MAJOR_ >= 2
 #undef NPY_NO_DEPRECATED_API
 #define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION
 #else

Modified: issm/trunk/src/wrappers/python/include/wrapper_macros.h
===================================================================
--- issm/trunk/src/wrappers/python/include/wrapper_macros.h	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/wrappers/python/include/wrapper_macros.h	2016-04-13 04:32:01 UTC (rev 20500)
@@ -26,7 +26,7 @@
 
 #define MODULEEND(); }\
   catch(ErrorException &exception){\
-	  PyErr_SetString(PyExc_TypeError,exception.PythonReport()); \
+	  PyErr_SetString(PyExc_TypeError,exception.WrapperReport()); \
 	  return NULL;\
   } \
 	catch (exception &e){\

Modified: issm/trunk/src/wrappers/python/io/FetchPythonData.cpp
===================================================================
--- issm/trunk/src/wrappers/python/io/FetchPythonData.cpp	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/wrappers/python/io/FetchPythonData.cpp	2016-04-13 04:32:01 UTC (rev 20500)
@@ -23,10 +23,15 @@
 	/*return internal value: */
 	if      (PyFloat_Check(py_float))
 		dscalar=PyFloat_AsDouble(py_float);
+	else if (PyLong_Check(py_float)){
+		#if _PYTHON_MAJOR_ == 3
+		dscalar=(double)PyLong_AsLong(py_float);
+		#else
+		dscalar=PyLong_AsDouble(py_float);
+		#endif
+	}
 	else if (PyInt_Check(py_float))
-		dscalar=(double)PyInt_AsLong(py_float);
-	else if (PyLong_Check(py_float))
-		dscalar=PyLong_AsDouble(py_float);
+	 dscalar=(double)PyInt_AsLong(py_float);
 	else if (PyBool_Check(py_float))
 		dscalar=(double)PyLong_AsLong(py_float);
 	else if (PyTuple_Check(py_float) && (int)PyTuple_Size(py_float)==1)
@@ -46,10 +51,10 @@
 	int iscalar;
 
 	/*return internal value: */
-	if      (PyInt_Check(py_long))
+	if      (PyLong_Check(py_long))
+		iscalar=(int)PyLong_AsLong(py_long);
+	else if (PyInt_Check(py_long))
 		iscalar=(int)PyInt_AsLong(py_long);
-	else if (PyLong_Check(py_long))
-		iscalar=(int)PyLong_AsLong(py_long);
 	else if (PyFloat_Check(py_long))
 		iscalar=(int)PyFloat_AsDouble(py_long);
 	else if (PyBool_Check(py_long))
@@ -73,10 +78,12 @@
 	/*return internal value: */
 	if      (PyBool_Check(py_boolean))
 		bscalar=(bool)PyLong_AsLong(py_boolean);
+	else if (PyLong_Check(py_boolean))
+		bscalar=(bool)PyLong_AsLong(py_boolean);
+	else if (PyLong_Check(py_boolean))
+		bscalar=(bool)PyLong_AsLong(py_boolean);
 	else if (PyInt_Check(py_boolean))
 		bscalar=(bool)PyInt_AsLong(py_boolean);
-	else if (PyLong_Check(py_boolean))
-		bscalar=(bool)PyLong_AsLong(py_boolean);
 	else if (PyTuple_Check(py_boolean) && (int)PyTuple_Size(py_boolean)==1)
 		FetchData(&bscalar,PyTuple_GetItem(py_boolean,(Py_ssize_t)0));
 	else if (PyList_Check(py_boolean) && (int)PyList_Size(py_boolean)==1)
@@ -150,6 +157,7 @@
 //						}
 //					}
 //				}
+			
 			}
 
 			else if (PyArray_TYPE((PyArrayObject*)py_matrix) == NPY_LONG) {
@@ -173,8 +181,7 @@
 			else
 				_error_("unrecognized double pyarray type in input!");
 
-			if (py_matrix2)
-				delete(py_matrix2);
+			//if (py_matrix2) delete(py_matrix2); Not doing this for now, seems to  be creating a segfault!
 		}
 		else
 			matrix=NULL;
@@ -723,7 +730,11 @@
 
 	/*Fetch all options*/
 	for (int i=istart; i<nrhs; i=i+2){
+		#if _PYTHON_MAJOR_ >= 3
+		if (!PyUnicode_Check(PyTuple_GetItem(py_tuple,(Py_ssize_t)i))) _error_("Argument " << i+1 << " must be name of option");
+		#else
 		if (!PyString_Check(PyTuple_GetItem(py_tuple,(Py_ssize_t)i))) _error_("Argument " << i+1 << " must be name of option");
+		#endif
 
 		FetchData(&name,PyTuple_GetItem(py_tuple,(Py_ssize_t)i));
 		if(i+1 == nrhs) _error_("Argument " << i+2 << " must exist and be value of option \"" << name << "\".");
@@ -749,10 +760,17 @@
 	PyObject        *py_dicti    = NULL;
 	PyObject        *py_item     = NULL;
 
+	#if _PYTHON_MAJOR_ >= 3
+	if (PyUnicode_Check(py_list)){
+		FetchData(&contourname,py_list);
+		contours=ExpRead<double>(contourname);
+	}
+	#else
 	if (PyString_Check(py_list)){
 		FetchData(&contourname,py_list);
 		contours=ExpRead<double>(contourname);
 	}
+	#endif
 	else if(PyList_Check(py_list)){
 
 		contours=new Contours();
@@ -804,7 +822,9 @@
 	/*convert from bytes to string: */
 	string=PyBytes_AS_STRING(py_bytes);
 
-	*pstring=string;
+	/*copy string (note strlen does not include trailing NULL): */
+	*pstring=xNew<char>(strlen(string)+1);
+	memcpy(*pstring,string,(strlen(string)+1)*sizeof(char));
 }
 /*}}}*/
 #else

Modified: issm/trunk/src/wrappers/python/io/WritePythonData.cpp
===================================================================
--- issm/trunk/src/wrappers/python/io/WritePythonData.cpp	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/src/wrappers/python/io/WritePythonData.cpp	2016-04-13 04:32:01 UTC (rev 20500)
@@ -19,7 +19,11 @@
 /*FUNCTION WriteData(PyObject* py_tuple,int index,int integer){{{*/
 void WriteData(PyObject* py_tuple, int index, int integer){
 
+	#if _PYTHON_MAJOR_ >= 3
+	PyTuple_SetItem(py_tuple, index, PyLong_FromSsize_t((Py_ssize_t)integer));
+	#else
 	PyTuple_SetItem(py_tuple, index, PyInt_FromSsize_t((Py_ssize_t)integer));
+	#endif
 
 }/*}}}*/
 /*FUNCTION WriteData(PyObject* py_tuple,int index,char* string){{{*/
@@ -211,13 +215,23 @@
 	for (i=0; i<riftstruct->numrifts; i++) {
 		dict=PyDict_New();
 
+		#if _PYTHON_MAJOR_ >= 3
+		PyDict_SetItemString(dict,"numsegs"          ,PyLong_FromSsize_t((Py_ssize_t)riftstruct->riftsnumsegments[i]));
+		#else
 		PyDict_SetItemString(dict,"numsegs"          ,PyInt_FromSsize_t((Py_ssize_t)riftstruct->riftsnumsegments[i]));
+		#endif
+
 		PyDict_SetItemString(dict,"segments"         ,PyArrayFromCopiedData(riftstruct->riftsnumsegments[i]    ,3,riftstruct->riftssegments[i]));
 		PyDict_SetItemString(dict,"pairs"            ,PyArrayFromCopiedData(riftstruct->riftsnumpairs[i]       ,2,riftstruct->riftspairs[i]));
 		PyDict_SetItemString(dict,"tips"             ,PyArrayFromCopiedData(1                                  ,2,&riftstruct->riftstips[2*i]));
 		PyDict_SetItemString(dict,"penaltypairs"     ,PyArrayFromCopiedData(riftstruct->riftsnumpenaltypairs[i],7,riftstruct->riftspenaltypairs[i]));
+		#if _PYTHON_MAJOR_ >= 3
+		PyDict_SetItemString(dict,"fill"             ,PyLong_FromSsize_t((Py_ssize_t)IceEnum));
+		PyDict_SetItemString(dict,"friction"         ,PyLong_FromSsize_t((Py_ssize_t)0));
+		#else
 		PyDict_SetItemString(dict,"fill"             ,PyInt_FromSsize_t((Py_ssize_t)IceEnum));
 		PyDict_SetItemString(dict,"friction"         ,PyInt_FromSsize_t((Py_ssize_t)0));
+		#endif
 		PyDict_SetItemString(dict,"fraction"         ,PyFloat_FromDouble(0.));
 		PyDict_SetItemString(dict,"fractionincrement",PyFloat_FromDouble(0.1));
 		PyDict_SetItemString(dict,"state"            ,PyArrayFromCopiedData(riftstruct->riftsnumpenaltypairs[i],1,riftstruct->state[i]));


Property changes on: issm/trunk/test
___________________________________________________________________
Modified: svn:mergeinfo
   - /issm/branches/trunk-jpl-damage/test:11427-13118
/issm/trunk-jpl/test:10936-11994,11996-12326,12333-12336,12338-12703,12705-12707,12710-13393,13396-13974,13976-14066,14068-14308,14311-15394,15397-16135,16138-16554,16561,16565-17804,17807-17986,17990-18299,18302-19103
   + /issm/branches/trunk-jpl-damage/test:11427-13118
/issm/trunk-jpl/test:10936-11994,11996-12326,12333-12336,12338-12703,12705-12707,12710-13393,13396-13974,13976-14066,14068-14308,14311-15394,15397-16135,16138-16554,16561,16565-17804,17807-17986,17990-18299,18302-20496

Modified: issm/trunk/test/Archives/Archive108.nc
===================================================================
(Binary files differ)

Modified: issm/trunk/test/Archives/Archive109.nc
===================================================================
(Binary files differ)

Modified: issm/trunk/test/Archives/Archive111.nc
===================================================================
(Binary files differ)

Modified: issm/trunk/test/Archives/Archive120.nc
===================================================================
(Binary files differ)

Modified: issm/trunk/test/Archives/Archive121.nc
===================================================================
(Binary files differ)

Modified: issm/trunk/test/Archives/Archive122.nc
===================================================================
(Binary files differ)

Modified: issm/trunk/test/Archives/Archive124.nc
===================================================================
(Binary files differ)

Modified: issm/trunk/test/Archives/Archive206.nc
===================================================================
(Binary files differ)

Modified: issm/trunk/test/Archives/Archive207.nc
===================================================================
(Binary files differ)

Modified: issm/trunk/test/Archives/Archive208.nc
===================================================================
(Binary files differ)

Modified: issm/trunk/test/Archives/Archive209.nc
===================================================================
(Binary files differ)

Modified: issm/trunk/test/Archives/Archive210.nc
===================================================================
(Binary files differ)

Modified: issm/trunk/test/Archives/Archive211.nc
===================================================================
(Binary files differ)

Modified: issm/trunk/test/Archives/Archive214.nc
===================================================================
(Binary files differ)

Modified: issm/trunk/test/Archives/Archive224.nc
===================================================================
(Binary files differ)

Modified: issm/trunk/test/Archives/Archive225.nc
===================================================================
(Binary files differ)

Modified: issm/trunk/test/Archives/Archive226.nc
===================================================================
(Binary files differ)

Modified: issm/trunk/test/Archives/Archive227.nc
===================================================================
(Binary files differ)

Modified: issm/trunk/test/Archives/Archive232.nc
===================================================================
(Binary files differ)

Modified: issm/trunk/test/Archives/Archive233.nc
===================================================================
(Binary files differ)

Modified: issm/trunk/test/Archives/Archive236.nc
===================================================================
(Binary files differ)

Modified: issm/trunk/test/Archives/Archive237.nc
===================================================================
(Binary files differ)

Modified: issm/trunk/test/Archives/Archive238.nc
===================================================================
(Binary files differ)

Modified: issm/trunk/test/Archives/Archive239.nc
===================================================================
(Binary files differ)

Modified: issm/trunk/test/Archives/Archive285.nc
===================================================================
(Binary files differ)

Modified: issm/trunk/test/Archives/Archive3008.nc
===================================================================
(Binary files differ)

Modified: issm/trunk/test/Archives/Archive3009.nc
===================================================================
(Binary files differ)

Modified: issm/trunk/test/Archives/Archive302.nc
===================================================================
(Binary files differ)

Modified: issm/trunk/test/Archives/Archive303.nc
===================================================================
(Binary files differ)

Modified: issm/trunk/test/Archives/Archive306.nc
===================================================================
(Binary files differ)

Modified: issm/trunk/test/Archives/Archive3108.nc
===================================================================
(Binary files differ)

Modified: issm/trunk/test/Archives/Archive3109.nc
===================================================================
(Binary files differ)

Modified: issm/trunk/test/Archives/Archive312.nc
===================================================================
(Binary files differ)

Modified: issm/trunk/test/Archives/Archive313.nc
===================================================================
(Binary files differ)

Modified: issm/trunk/test/Archives/Archive314.nc
===================================================================
(Binary files differ)

Modified: issm/trunk/test/Archives/Archive315.nc
===================================================================
(Binary files differ)

Modified: issm/trunk/test/Archives/Archive316.nc
===================================================================
(Binary files differ)

Modified: issm/trunk/test/Archives/Archive317.nc
===================================================================
(Binary files differ)

Modified: issm/trunk/test/Archives/Archive318.nc
===================================================================
(Binary files differ)

Modified: issm/trunk/test/Archives/Archive323.nc
===================================================================
(Binary files differ)

Modified: issm/trunk/test/Archives/Archive324.nc
===================================================================
(Binary files differ)

Modified: issm/trunk/test/Archives/Archive325.nc
===================================================================
(Binary files differ)

Modified: issm/trunk/test/Archives/Archive326.nc
===================================================================
(Binary files differ)

Modified: issm/trunk/test/Archives/Archive327.nc
===================================================================
(Binary files differ)

Modified: issm/trunk/test/Archives/Archive329.nc
===================================================================
(Binary files differ)

Modified: issm/trunk/test/Archives/Archive406.nc
===================================================================
(Binary files differ)

Modified: issm/trunk/test/Archives/Archive407.nc
===================================================================
(Binary files differ)

Modified: issm/trunk/test/Archives/Archive408.nc
===================================================================
(Binary files differ)

Modified: issm/trunk/test/Archives/Archive409.nc
===================================================================
(Binary files differ)

Modified: issm/trunk/test/Archives/Archive410.nc
===================================================================
(Binary files differ)

Modified: issm/trunk/test/Archives/Archive411.nc
===================================================================
(Binary files differ)

Modified: issm/trunk/test/Archives/Archive415.nc
===================================================================
(Binary files differ)

Modified: issm/trunk/test/Archives/Archive416.nc
===================================================================
(Binary files differ)

Modified: issm/trunk/test/Archives/Archive426.nc
===================================================================
(Binary files differ)

Modified: issm/trunk/test/Archives/Archive427.nc
===================================================================
(Binary files differ)

Modified: issm/trunk/test/Archives/Archive431.nc
===================================================================
(Binary files differ)

Modified: issm/trunk/test/Archives/Archive432.nc
===================================================================
(Binary files differ)

Modified: issm/trunk/test/Archives/Archive436.nc
===================================================================
(Binary files differ)

Modified: issm/trunk/test/Archives/Archive437.nc
===================================================================
(Binary files differ)

Modified: issm/trunk/test/Archives/Archive438.nc
===================================================================
(Binary files differ)

Modified: issm/trunk/test/Archives/Archive439.nc
===================================================================
(Binary files differ)

Modified: issm/trunk/test/Archives/Archive455.nc
===================================================================
(Binary files differ)

Modified: issm/trunk/test/Archives/Archive505.nc
===================================================================
(Binary files differ)

Modified: issm/trunk/test/Archives/Archive506.nc
===================================================================
(Binary files differ)

Modified: issm/trunk/test/Archives/Archive507.nc
===================================================================
(Binary files differ)

Modified: issm/trunk/test/Archives/Archive508.nc
===================================================================
(Binary files differ)

Modified: issm/trunk/test/Archives/Archive509.nc
===================================================================
(Binary files differ)

Modified: issm/trunk/test/Archives/Archive510.nc
===================================================================
(Binary files differ)

Modified: issm/trunk/test/Archives/Archive513.nc
===================================================================
(Binary files differ)

Modified: issm/trunk/test/Archives/Archive515.nc
===================================================================
(Binary files differ)

Modified: issm/trunk/test/Archives/Archive516.nc
===================================================================
(Binary files differ)

Modified: issm/trunk/test/Archives/Archive802.nc
===================================================================
(Binary files differ)

Modified: issm/trunk/test/Archives/Archive803.nc
===================================================================
(Binary files differ)

Modified: issm/trunk/test/Archives/Archive804.nc
===================================================================
(Binary files differ)

Modified: issm/trunk/test/Archives/Archive805.nc
===================================================================
(Binary files differ)

Modified: issm/trunk/test/Archives/Archive806.nc
===================================================================
(Binary files differ)

Modified: issm/trunk/test/Data/delta18o.data
===================================================================
--- issm/trunk/test/Data/delta18o.data	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/Data/delta18o.data	2016-04-13 04:32:01 UTC (rev 20500)
@@ -1,2 +1,2 @@
-  -3.9010000e-02  -3.9180000e-02  -3.9280000e-02  -3.9320000e-02  -3.9050000e-02  -3.8880000e-02  -3.8680000e-02  -3.8560000e-02  -3.8500000e-02  -3.8520000e-02  -3.8560000e-02
+  -3.9010000e1  -3.9180000e1  -3.9280000e1  -3.9320000e1  -3.9050000e1  -3.8880000e1  -3.8680000e1  -3.8560000e1  -3.8500000e1  -3.8520000e1  -3.8560000e1
    0.0000000e+00   2.0000000e+01   4.0000000e+01   6.0000000e+01   8.0000000e+01   1.0000000e+02   1.2000000e+02   1.4000000e+02   1.6000000e+02   1.8000000e+02   2.0000000e+02

Modified: issm/trunk/test/NightlyRun/IdFromString.m
===================================================================
--- issm/trunk/test/NightlyRun/IdFromString.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/NightlyRun/IdFromString.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -7,6 +7,7 @@
 %   Examples:
 %      ids=IdFromString('Parallel');
 %      ids=IdFromString('79North');
+%      ids=IdFromString('*');          %Print all tests
 
 %Check input
 if ~ischar(string)
@@ -17,7 +18,11 @@
 ids=[];
 
 %Grep string
-[dummy ids_raw]=system(['find ./ -name "test[0-9]*.m" | xargs grep "%Test Name:" | grep ' string ' | sed -e "s/test/ /g" -e "s/\.m:/ /g" | awk {''print $2''}']);
+if strcmp(string,'*'),
+	[dummy ids_raw]=system(['find ./ -name "test[0-9]*.m" | xargs grep "%Test Name:" | sed -e "s/test/ /g" -e "s/\.m:/ /g" | awk {''print $2''}']);
+else
+	[dummy ids_raw]=system(['find ./ -name "test[0-9]*.m" | xargs grep "%Test Name:" | grep ' string ' | sed -e "s/test/ /g" -e "s/\.m:/ /g" | awk {''print $2''}']);
+end
 
 %return if no test found
 if isempty(ids_raw),
@@ -26,11 +31,12 @@
 end
 
 %Process string (delete return carriage);
-ids_raw=strsplit(ids_raw,char(10));
+ids_raw=strsplit_strict(ids_raw,char(10));
 ids_raw=ids_raw(1:end-1);
 for i=1:length(ids_raw),
 	eval(['ids=[ids ' ids_raw{i} '];']); 
 end
+ids=sort(ids);
 
 %Display names
 disp([ num2str(length(ids)) ' tests match ''' string '''']);

Modified: issm/trunk/test/NightlyRun/runme.m
===================================================================
--- issm/trunk/test/NightlyRun/runme.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/NightlyRun/runme.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -18,7 +18,7 @@
 %                      'thermal': validation of thermal tests
 %                      'mesh'   : validation of mesh tests
 %                      'adolc'   : validation of adolc tests
-%                      'gia'   : validation of gia tests
+%                      'slr'   : validation of slr tests
 %                      'qmu'   : validation of dakota tests
 %                      ...
 %      'procedure'     'check' :   run the test (default)
@@ -48,7 +48,7 @@
 %Process options
 %GET benchmark {{{
 benchmark=getfieldvalue(options,'benchmark','nightly');
-if ~ismember(benchmark,{'all','nightly','ismip','eismint','thermal','mesh','validation','tranforcing','adolc','gia','qmu'})
+if ~ismember(benchmark,{'all','nightly','ismip','eismint','thermal','mesh','validation','tranforcing','adolc','slr','qmu'})
 	disp('runme warning: benchmark not supported, defaulting to test ''nightly''')
 	benchmark='nightly';
 end
@@ -116,8 +116,8 @@
 	test_ids=intersect(test_ids,[1501:1502]);
 elseif strcmpi(benchmark,'referential'),
 	test_ids=intersect(test_ids,[1601:1602]);
-elseif strcmpi(benchmark,'gia'),
-	test_ids=intersect(test_ids,[2001:2100]);
+elseif strcmpi(benchmark,'slr'),
+	test_ids=intersect(test_ids,[2001:2500]);
 elseif strcmpi(benchmark,'adolc'),
 	test_ids=intersect(test_ids,[3001:3200]);
 elseif strcmpi(benchmark,'qmu'),
@@ -219,7 +219,7 @@
 					error_diff=full(max(abs(archive(:)-field(:)))/(max(abs(archive))+eps));
 
 					%disp test result
-					if (error_diff>tolerance);
+					if (error_diff>tolerance | isnan(error_diff));
 						disp(sprintf(['ERROR   difference: %-7.2g > %7.2g test id: %i test name: %s field: %s'],...
 							error_diff,tolerance,id,id_string,fieldname));
 						if(getfieldvalue(options,'stoponerror',0)), disp('STOP'); return; end

Modified: issm/trunk/test/NightlyRun/runme.py
===================================================================
--- issm/trunk/test/NightlyRun/runme.py	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/NightlyRun/runme.py	2016-04-13 04:32:01 UTC (rev 20500)
@@ -1,10 +1,11 @@
-#! /usr/bin/env python
+#!/usr/bin/env python
 import os
 import glob
 import socket
 import numpy
 import netCDF4
 import sys
+import traceback
 
 def runme(id=None,exclude=None,benchmark='nightly',procedure='check',output='none',rank=1,numprocs=1):
 	"""
@@ -27,7 +28,7 @@
 	                       'thermal': validation of thermal tests
 	                       'mesh'   : validation of mesh tests
 						   'adolc'   : validation of adolc tests
-                           'gia'   : validation of gia tests
+                           'slr'   : validation of slr tests
 
 	                       ...
 	       'procedure'     'check' : run the test (default)
@@ -52,7 +53,7 @@
 
 	#Process options
 	#GET benchmark {{{
-	if not ismember(benchmark,['all','nightly','ismip','eismint','thermal','mesh','validation','tranforcing','adolc','gia']):
+	if not ismember(benchmark,['all','nightly','ismip','eismint','thermal','mesh','validation','tranforcing','adolc','slr']):
 		print "runme warning: benchmark '%s' not supported, defaulting to test 'nightly'." % benchmark
 		benchmark='nightly'
 	# }}}
@@ -62,7 +63,7 @@
 		procedure='check'
 	# }}}
 	#GET output {{{
-	if not ismember(output,['nightly','daily','none']):
+	if not ismember(output,['nightly','none']):
 		print "runme warning: output '%s' not supported, defaulting to test 'none'." % output
 		output='none'
 	# }}}
@@ -115,8 +116,8 @@
 		test_ids=test_ids.intersection(set(range(1501,1503)))
 	elif strcmpi(benchmark,'referential'):
 		test_ids=test_ids.intersection(set(range(1601,1603)))
-	elif strcmpi(benchmark,'gia'):
-		test_ids=test_ids.intersection(set(range(2001,2100)))
+	elif strcmpi(benchmark,'slr'):
+		test_ids=test_ids.intersection(set(range(2001,2500)))
 	elif strcmpi(benchmark,'adolc'):
 		test_ids=test_ids.intersection(set(range(3001,3200)))
 	#print 'test_ids after benchmark =',test_ids
@@ -191,56 +192,44 @@
 								   (numpy.amax(numpy.abs(archive),axis=0)+sys.float_info.epsilon)
 
 						#disp test result
-						if (numpy.any(error_diff>tolerance)):
+						if (numpy.any(error_diff>tolerance) or numpy.isnan(error_diff)):
 							print 'ERROR   difference: %-7.2g > %7.2g test id: %i test name: %s field: %s' % \
 								(error_diff,tolerance,id,id_string,fieldname)
 						else:
 							print 'SUCCESS difference: %-7.2g < %7.2g test id: %i test name: %s field: %s' % \
 								(error_diff,tolerance,id,id_string,fieldname)
 
-					except Exception as me2:
+					except Exception as message:
 
 						#something went wrong, print failure message:
+						print traceback.format_exc()
 						directory=os.getcwd().split('/')    #  not used?
-						message=me2
 						if   strcmpi(output,'nightly'):
 							fid=open(os.path.join(ISSM_DIR,'nightlylog','pythonerror.log'), 'a')
 							fid.write('%s' % message)
 							fid.write('\n------------------------------------------------------------------\n')
 							fid.close()
 							print 'FAILURE difference: N/A test id: %i test name: %s field: %s' % (id,id_string,fieldname)
-						elif strcmpi(output,'daily'):
-							fid=open(os.path.join(ISSM_DIR,'dailylog','pythonerror.log'), 'a')
-							fid.write('%s' % message)
-							fid.write('\n------------------------------------------------------------------\n')
-							fid.close()
-							print 'FAILURE difference: N/A test id: %i test name: %s field: %s' % (id,id_string,fieldname)
 						else:
 							print 'FAILURE difference: N/A test id: %i test name: %s field: %s' % (id,id_string,fieldname)
-							raise RuntimeError(me2)
+							raise RuntimeError(message)
 
 				f.close()
 
-		except Exception as me:
+		except Exception as message:
 
 			#something went wrong, print failure message:
+			print traceback.format_exc()
 			directory=os.getcwd().split('/')    #  not used?
-			message=me
 			if   strcmpi(output,'nightly'):
 				fid=open(os.path.join(ISSM_DIR,'nightlylog','pythonerror.log'), 'a')
 				fid.write('%s' % message)
 				fid.write('\n------------------------------------------------------------------\n')
 				fid.close()
 				print 'FAILURE difference: N/A test id: %i test name: %s field: %s' % (id,id_string,'N/A')
-			elif strcmpi(output,'daily'):
-				fid=open(os.path.join(ISSM_DIR,'dailylog','pythonerror.log'), 'a')
-				fid.write('%s' % message)
-				fid.write('\n------------------------------------------------------------------\n')
-				fid.close()
-				print 'FAILURE difference: N/A test id: %i test name: %s field: %s' % (id,id_string,'N/A')
 			else:
 				print 'FAILURE difference: N/A test id: %i test name: %s field: %s' % (id,id_string,'N/A')
-				raise RuntimeError(me)
+				raise RuntimeError(message)
 
 		print "----------------finished:%i-----------------------" % id
 	return

Modified: issm/trunk/test/NightlyRun/test109.m
===================================================================
--- issm/trunk/test/NightlyRun/test109.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/NightlyRun/test109.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -7,6 +7,7 @@
 md.cluster=generic('name',oshostname(),'np',3);
 md.transient.isstressbalance=0;
 md.transient.ismasstransport=0;
+md.transient.issmb=1;
 md.transient.isthermal=1;
 md.transient.isgroundingline=0;
 md=solve(md,TransientSolutionEnum());

Modified: issm/trunk/test/NightlyRun/test109.py
===================================================================
--- issm/trunk/test/NightlyRun/test109.py	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/NightlyRun/test109.py	2016-04-13 04:32:01 UTC (rev 20500)
@@ -16,6 +16,7 @@
 md.cluster=generic('name',oshostname(),'np',3)
 md.transient.isstressbalance=False
 md.transient.ismasstransport=False
+md.transient.issmb=True
 md.transient.isthermal=True
 md.transient.isgroundingline=False
 md=solve(md,TransientSolutionEnum())

Modified: issm/trunk/test/NightlyRun/test120.m
===================================================================
--- issm/trunk/test/NightlyRun/test120.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/NightlyRun/test120.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -15,7 +15,7 @@
 
 %Fields and tolerances to track changes
 field_names     ={'Enthalpy','Waterfraction','Temperature'};
-field_tolerances={1e-13,2e-10,1e-13};
+field_tolerances={1e-13,3e-10,1e-13};
 field_values={...
 	(md.results.ThermalSolution.Enthalpy),...
 	(md.results.ThermalSolution.Waterfraction),...

Modified: issm/trunk/test/NightlyRun/test1201.m
===================================================================
--- issm/trunk/test/NightlyRun/test1201.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/NightlyRun/test1201.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -9,7 +9,7 @@
 	md=bamg(model(),'domain','../Exp/SquareEISMINT.exp','hmax',3000.);
 	md=setmask(md,'all','');
 	md=parameterize(md,'../Par/SquareEISMINT.par');
-	md.surfaceforcings.mass_balance(:)=0.;
+	md.smb.mass_balance(:)=0.;
 	md=setflowequation(md,'SSA','all');
 	md.cluster=generic('name',oshostname(),'np',8);
 

Modified: issm/trunk/test/NightlyRun/test1201.py
===================================================================
--- issm/trunk/test/NightlyRun/test1201.py	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/NightlyRun/test1201.py	2016-04-13 04:32:01 UTC (rev 20500)
@@ -22,7 +22,7 @@
 	md=bamg(model(),'domain','../Exp/SquareEISMINT.exp','hmax',3000.)
 	md=setmask(md,'all','')
 	md=parameterize(md,'../Par/SquareEISMINT.py')
-	md.surfaceforcings.mass_balance[:]=0.
+	md.smb.mass_balance[:]=0.
 	md=setflowequation(md,'SSA','all')
 	md.cluster=generic('name',oshostname(),'np',8)
 

Modified: issm/trunk/test/NightlyRun/test121.m
===================================================================
--- issm/trunk/test/NightlyRun/test121.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/NightlyRun/test121.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -9,6 +9,7 @@
 md.initialization.watercolumn=zeros(md.mesh.numberofvertices,1);
 md.transient.isstressbalance=0;
 md.transient.ismasstransport=0;
+md.transient.issmb=1;
 md.transient.isthermal=1;
 md.transient.isgroundingline=0;
 md.thermal.isenthalpy=1;

Modified: issm/trunk/test/NightlyRun/test121.py
===================================================================
--- issm/trunk/test/NightlyRun/test121.py	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/NightlyRun/test121.py	2016-04-13 04:32:01 UTC (rev 20500)
@@ -18,6 +18,7 @@
 md.initialization.watercolumn=numpy.zeros((md.mesh.numberofvertices,1))
 md.transient.isstressbalance=False
 md.transient.ismasstransport=False
+md.transient.issmb=True
 md.transient.isthermal=True
 md.transient.isgroundingline=False
 md.thermal.isenthalpy=1

Modified: issm/trunk/test/NightlyRun/test124.m
===================================================================
--- issm/trunk/test/NightlyRun/test124.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/NightlyRun/test124.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -20,9 +20,9 @@
 	'Vx2','Vy2','Vel2','Pressure2','Bed2','Surface2','Thickness2',...
 	'Vx3','Vy3','Vel3','Pressure3','Bed3','Surface3','Thickness3'};
 field_tolerances={...
-	1e-09,3e-10,3e-10,1e-10,1e-13,1e-13,1e-13,...
-	1e-09,3e-10,3e-10,1e-10,1e-10,1e-10,1e-10,...
-	1e-09,3e-10,3e-10,1e-10,1e-10,1e-10,1e-10};
+	2e-09,3.0e-9,3.0e-9,1e-10,1e-13,1e-12,1e-12,...
+	1e-09,3e-10,8e-10,1e-10,1e-10,1e-10,1e-10,...
+	1e-09,3e-10,8e-10,1e-10,1e-10,1e-10,1e-10};
 field_values={...
 	(md.results.TransientSolution(1).Vx),...
 	(md.results.TransientSolution(1).Vy),...

Modified: issm/trunk/test/NightlyRun/test1501.m
===================================================================
--- issm/trunk/test/NightlyRun/test1501.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/NightlyRun/test1501.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -14,33 +14,33 @@
 
 %Solve for thinning rate -> -1 * surface mass balance
 smb= 2.*ones(md.mesh.numberofvertices,1);
-md.surfaceforcings.mass_balance= smb;
+md.smb.mass_balance= smb;
 md.basalforcings.groundedice_melting_rate= smb;
 
 md=solve(md,MasstransportSolutionEnum());
 
 for i=1:10
 	 md=solve(md,MasstransportSolutionEnum());
-	 md.surfaceforcings.mass_balance= md.surfaceforcings.mass_balance - ((md.results.MasstransportSolution.Thickness)-md.geometry.thickness);
+	 md.smb.mass_balance= md.smb.mass_balance - ((md.results.MasstransportSolution.Thickness)-md.geometry.thickness);
 end
 
 %Set up transient
-smb = md.surfaceforcings.mass_balance;
+smb = md.smb.mass_balance;
 
 tooth= [ [ones(400,1)*(smb') - 10.]' [ones(400,1)*(smb')]' ];
 smb=[ [ones(399,1)*(smb')]' smb  tooth tooth];
 
-md.surfaceforcings.mass_balance= smb;
-md.surfaceforcings.mass_balance(end+1,:)=[1.:2000.];
+md.smb.mass_balance= smb;
+md.smb.mass_balance(end+1,:)=[1.:2000.];
 
 md=solve(md,TransientSolutionEnum());
 
 %Fields and tolerances to track changes
-field_names={'Vx1','Vy1','Vel1','Pressure1','Bed1','Surface1','Thickness1','SurfaceforcingsMassBalance1', ...
-	'Vx2','Vy2','Vel2','Pressure2','Bed2','Surface2','Thickness2','SurfaceforcingsMassBalance2', ...
-	'Vx3','Vy3','Vel3','Pressure3','Bed3','Surface3','Thickness3','SurfaceforcingsMassBalance3', ...
-	'Vx4','Vy4','Vel4','Pressure4','Bed4','Surface4','Thickness4','SurfaceforcingsMassBalance4', ...
-	'Vx5','Vy5','Vel5','Pressure5','Bed5','Surface5','Thickness5','SurfaceforcingsMassBalance5'};
+field_names={'Vx1','Vy1','Vel1','Pressure1','Bed1','Surface1','Thickness1','SmbMassBalance1', ...
+	'Vx2','Vy2','Vel2','Pressure2','Bed2','Surface2','Thickness2','SmbMassBalance2', ...
+	'Vx3','Vy3','Vel3','Pressure3','Bed3','Surface3','Thickness3','SmbMassBalance3', ...
+	'Vx4','Vy4','Vel4','Pressure4','Bed4','Surface4','Thickness4','SmbMassBalance4', ...
+	'Vx5','Vy5','Vel5','Pressure5','Bed5','Surface5','Thickness5','SmbMassBalance5'};
 field_tolerances={1e-09,1e-09,1e-09,1e-10,1e-10,1e-10,1e-10,1e-10,...
 	1e-09,1e-09,1e-09,1e-10,1e-10,1e-10,1e-10,1e-10,...
 	1e-09,1e-09,1e-09,1e-10,1e-10,1e-10,1e-10,1e-10,...
@@ -54,7 +54,7 @@
 	(md.results.TransientSolution(400).Base),...
 	(md.results.TransientSolution(400).Surface),...
 	(md.results.TransientSolution(400).Thickness),...
-	(md.results.TransientSolution(400).SurfaceforcingsMassBalance),...
+	(md.results.TransientSolution(400).SmbMassBalance),...
 	(md.results.TransientSolution(800).Vx),...
 	(md.results.TransientSolution(800).Vy),...
 	(md.results.TransientSolution(800).Vel),...
@@ -62,7 +62,7 @@
 	(md.results.TransientSolution(800).Base),...
 	(md.results.TransientSolution(800).Surface),...
 	(md.results.TransientSolution(800).Thickness),...
-	(md.results.TransientSolution(800).SurfaceforcingsMassBalance),...
+	(md.results.TransientSolution(800).SmbMassBalance),...
 	(md.results.TransientSolution(1200).Vx),...
 	(md.results.TransientSolution(1200).Vy),...
 	(md.results.TransientSolution(1200).Vel),...
@@ -70,7 +70,7 @@
 	(md.results.TransientSolution(1200).Base),...
 	(md.results.TransientSolution(1200).Surface),...
 	(md.results.TransientSolution(1200).Thickness),...
-	(md.results.TransientSolution(1200).SurfaceforcingsMassBalance),...
+	(md.results.TransientSolution(1200).SmbMassBalance),...
 	(md.results.TransientSolution(1600).Vx),...
 	(md.results.TransientSolution(1600).Vy),...
 	(md.results.TransientSolution(1600).Vel),...
@@ -78,7 +78,7 @@
 	(md.results.TransientSolution(1600).Base),...
 	(md.results.TransientSolution(1600).Surface),...
 	(md.results.TransientSolution(1600).Thickness),...
-	(md.results.TransientSolution(1600).SurfaceforcingsMassBalance),...
+	(md.results.TransientSolution(1600).SmbMassBalance),...
 	(md.results.TransientSolution(2000).Vx),...
 	(md.results.TransientSolution(2000).Vy),...
 	(md.results.TransientSolution(2000).Vel),...
@@ -86,7 +86,7 @@
 	(md.results.TransientSolution(2000).Base),...
 	(md.results.TransientSolution(2000).Surface),...
 	(md.results.TransientSolution(2000).Thickness),...
-	(md.results.TransientSolution(2000).SurfaceforcingsMassBalance),...
+	(md.results.TransientSolution(2000).SmbMassBalance),...
 	};
 
 if printingflag,
@@ -108,7 +108,7 @@
 	for t=starttime:endtime
 		thickness = [thickness (md.results.TransientSolution(t).Thickness)];
 		volume = [volume mean(md.results.TransientSolution(t).Thickness.value,2).*areas];
-		massbal = [massbal (md.results.TransientSolution(t).SurfaceforcingsMassBalance)];
+		massbal = [massbal (md.results.TransientSolution(t).SmbMassBalance)];
 		velocity = [velocity (md.results.TransientSolution(t).Vel)];
 	end
 

Modified: issm/trunk/test/NightlyRun/test1501.py
===================================================================
--- issm/trunk/test/NightlyRun/test1501.py	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/NightlyRun/test1501.py	2016-04-13 04:32:01 UTC (rev 20500)
@@ -25,35 +25,35 @@
 
 #Solve for thinning rate -> -1 * surface mass balance
 smb= 2.*numpy.ones((md.mesh.numberofvertices,1))
-md.surfaceforcings.mass_balance= smb
+md.smb.mass_balance= smb
 md.basalforcings.groundedice_melting_rate= smb
 
 md=solve(md,MasstransportSolutionEnum())
 
 for i in xrange(1,11):
 	 md=solve(md,MasstransportSolutionEnum())
-	 md.surfaceforcings.mass_balance= md.surfaceforcings.mass_balance - ((md.results.MasstransportSolution.Thickness)-md.geometry.thickness)
+	 md.smb.mass_balance= md.smb.mass_balance - ((md.results.MasstransportSolution.Thickness)-md.geometry.thickness)
 
 #Set up transient
-smb = md.surfaceforcings.mass_balance
+smb = md.smb.mass_balance
 
 #tooth= [ [ones(400,1)*(smb') - 10.]' [ones(400,1)*(smb')]' ];
 tooth=numpy.hstack((numpy.tile(smb-10.,(1,400)),numpy.tile(smb,(1,400))))
 #smb=[ [ones(399,1)*(smb')]' smb  tooth tooth];
 smb=numpy.hstack((numpy.tile(smb,(1,399)),smb,tooth,tooth))
 
-#md.surfaceforcings.mass_balance= smb;
-#md.surfaceforcings.mass_balance(end+1,:)=[1.:2000.];
-md.surfaceforcings.mass_balance=numpy.vstack((smb,numpy.arange(1,2001)))
+#md.smb.mass_balance= smb;
+#md.smb.mass_balance(end+1,:)=[1.:2000.];
+md.smb.mass_balance=numpy.vstack((smb,numpy.arange(1,2001)))
 
 md=solve(md,TransientSolutionEnum())
 
 #Fields and tolerances to track changes
-field_names=['Vx1','Vy1','Vel1','Pressure1','Bed1','Surface1','Thickness1','SurfaceforcingsMassBalance1', \
-	'Vx2','Vy2','Vel2','Pressure2','Bed2','Surface2','Thickness2','SurfaceforcingsMassBalance2', \
-	'Vx3','Vy3','Vel3','Pressure3','Bed3','Surface3','Thickness3','SurfaceforcingsMassBalance3', \
-	'Vx4','Vy4','Vel4','Pressure4','Bed4','Surface4','Thickness4','SurfaceforcingsMassBalance4', \
-	'Vx5','Vy5','Vel5','Pressure5','Bed5','Surface5','Thickness5','SurfaceforcingsMassBalance5']
+field_names=['Vx1','Vy1','Vel1','Pressure1','Bed1','Surface1','Thickness1','SmbMassBalance1', \
+	'Vx2','Vy2','Vel2','Pressure2','Bed2','Surface2','Thickness2','SmbMassBalance2', \
+	'Vx3','Vy3','Vel3','Pressure3','Bed3','Surface3','Thickness3','SmbMassBalance3', \
+	'Vx4','Vy4','Vel4','Pressure4','Bed4','Surface4','Thickness4','SmbMassBalance4', \
+	'Vx5','Vy5','Vel5','Pressure5','Bed5','Surface5','Thickness5','SmbMassBalance5']
 field_tolerances=[1e-09,1e-09,1e-09,1e-10,1e-10,1e-10,1e-10,1e-10,\
 	1e-09,1e-09,1e-09,1e-10,1e-10,1e-10,1e-10,1e-10,\
 	1e-09,1e-09,1e-09,1e-10,1e-10,1e-10,1e-10,1e-10,\
@@ -67,7 +67,7 @@
 	md.results.TransientSolution[400-1].Base,\
 	md.results.TransientSolution[400-1].Surface,\
 	md.results.TransientSolution[400-1].Thickness,\
-	md.results.TransientSolution[400-1].SurfaceforcingsMassBalance,\
+	md.results.TransientSolution[400-1].SmbMassBalance,\
 	md.results.TransientSolution[800-1].Vx,\
 	md.results.TransientSolution[800-1].Vy,\
 	md.results.TransientSolution[800-1].Vel,\
@@ -75,7 +75,7 @@
 	md.results.TransientSolution[800-1].Base,\
 	md.results.TransientSolution[800-1].Surface,\
 	md.results.TransientSolution[800-1].Thickness,\
-	md.results.TransientSolution[800-1].SurfaceforcingsMassBalance,\
+	md.results.TransientSolution[800-1].SmbMassBalance,\
 	md.results.TransientSolution[1200-1].Vx,\
 	md.results.TransientSolution[1200-1].Vy,\
 	md.results.TransientSolution[1200-1].Vel,\
@@ -83,7 +83,7 @@
 	md.results.TransientSolution[1200-1].Base,\
 	md.results.TransientSolution[1200-1].Surface,\
 	md.results.TransientSolution[1200-1].Thickness,\
-	md.results.TransientSolution[1200-1].SurfaceforcingsMassBalance,\
+	md.results.TransientSolution[1200-1].SmbMassBalance,\
 	md.results.TransientSolution[1600-1].Vx,\
 	md.results.TransientSolution[1600-1].Vy,\
 	md.results.TransientSolution[1600-1].Vel,\
@@ -91,7 +91,7 @@
 	md.results.TransientSolution[1600-1].Base,\
 	md.results.TransientSolution[1600-1].Surface,\
 	md.results.TransientSolution[1600-1].Thickness,\
-	md.results.TransientSolution[1600-1].SurfaceforcingsMassBalance,\
+	md.results.TransientSolution[1600-1].SmbMassBalance,\
 	md.results.TransientSolution[2000-1].Vx,\
 	md.results.TransientSolution[2000-1].Vy,\
 	md.results.TransientSolution[2000-1].Vel,\
@@ -99,7 +99,7 @@
 	md.results.TransientSolution[2000-1].Base,\
 	md.results.TransientSolution[2000-1].Surface,\
 	md.results.TransientSolution[2000-1].Thickness,\
-	md.results.TransientSolution[2000-1].SurfaceforcingsMassBalance,\
+	md.results.TransientSolution[2000-1].SmbMassBalance,\
 	]
 
 if printingflag:
@@ -123,7 +123,7 @@
 	for t=starttime:endtime
 		thickness = [thickness (md.results.TransientSolution(t).Thickness)];
 		volume = [volume mean(md.results.TransientSolution(t).Thickness.value,2).*areas];
-		massbal = [massbal (md.results.TransientSolution(t).SurfaceforcingsMassBalance)];
+		massbal = [massbal (md.results.TransientSolution(t).SmbMassBalance)];
 		velocity = [velocity (md.results.TransientSolution(t).Vel)];
 	end
 

Modified: issm/trunk/test/NightlyRun/test1502.m
===================================================================
--- issm/trunk/test/NightlyRun/test1502.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/NightlyRun/test1502.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -15,33 +15,33 @@
 
 %Solve for thinning rate -> -1 * surface mass balance
 smb= 2.*ones(md.mesh.numberofvertices,1);
-md.surfaceforcings.mass_balance= smb;
+md.smb.mass_balance= smb;
 md.basalforcings.groundedice_melting_rate= smb;
 
 md=solve(md,MasstransportSolutionEnum());
 
 for i=1:10
 	 md=solve(md,MasstransportSolutionEnum());
-	 md.surfaceforcings.mass_balance= md.surfaceforcings.mass_balance - ((md.results.MasstransportSolution.Thickness)-md.geometry.thickness);
+	 md.smb.mass_balance= md.smb.mass_balance - ((md.results.MasstransportSolution.Thickness)-md.geometry.thickness);
 end
 
 %Set up transient
-smb = md.surfaceforcings.mass_balance;
+smb = md.smb.mass_balance;
 
 tooth= [ [ones(400,1)*(smb') - 10.]' [ones(400,1)*(smb')]' ];
 smb=[ [ones(399,1)*(smb')]' smb  tooth tooth];
 
-md.surfaceforcings.mass_balance= smb;
-md.surfaceforcings.mass_balance(end+1,:)=[1.:2000.];
+md.smb.mass_balance= smb;
+md.smb.mass_balance(end+1,:)=[1.:2000.];
 
 md=solve(md,TransientSolutionEnum());
 
 %Fields and tolerances to track changes
-field_names={'Vx1','Vy1','Vz1','Vel1','Pressure1','Bed1','Surface1','Thickness1','SurfaceforcingsMassBalance1', ...
-	'Vx2','Vy2','Vz2','Vel2','Pressure2','Bed2','Surface2','Thickness2','SurfaceforcingsMassBalance2', ...
-	'Vx3','Vy3','Vz3','Vel3','Pressure3','Bed3','Surface3','Thickness3','SurfaceforcingsMassBalance3', ...
-	'Vx4','Vy4','Vz4','Vel4','Pressure4','Bed4','Surface4','Thickness4','SurfaceforcingsMassBalance4', ...
-	'Vx5','Vy5','Vz5','Vel5','Pressure5','Bed5','Surface5','Thickness5','SurfaceforcingsMassBalance5'};
+field_names={'Vx1','Vy1','Vz1','Vel1','Pressure1','Bed1','Surface1','Thickness1','SmbMassBalance1', ...
+	'Vx2','Vy2','Vz2','Vel2','Pressure2','Bed2','Surface2','Thickness2','SmbMassBalance2', ...
+	'Vx3','Vy3','Vz3','Vel3','Pressure3','Bed3','Surface3','Thickness3','SmbMassBalance3', ...
+	'Vx4','Vy4','Vz4','Vel4','Pressure4','Bed4','Surface4','Thickness4','SmbMassBalance4', ...
+	'Vx5','Vy5','Vz5','Vel5','Pressure5','Bed5','Surface5','Thickness5','SmbMassBalance5'};
 field_tolerances={1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,...
 	1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,...
 	1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,...
@@ -56,7 +56,7 @@
 	(md.results.TransientSolution(400).Base),...
 	(md.results.TransientSolution(400).Surface),...
 	(md.results.TransientSolution(400).Thickness),...
-	(md.results.TransientSolution(400).SurfaceforcingsMassBalance),...
+	(md.results.TransientSolution(400).SmbMassBalance),...
 	(md.results.TransientSolution(800).Vx),...
 	(md.results.TransientSolution(800).Vy),...
 	(md.results.TransientSolution(800).Vz),...
@@ -65,7 +65,7 @@
 	(md.results.TransientSolution(800).Base),...
 	(md.results.TransientSolution(800).Surface),...
 	(md.results.TransientSolution(800).Thickness),...
-	(md.results.TransientSolution(800).SurfaceforcingsMassBalance),...
+	(md.results.TransientSolution(800).SmbMassBalance),...
 	(md.results.TransientSolution(1200).Vx),...
 	(md.results.TransientSolution(1200).Vy),...
 	(md.results.TransientSolution(1200).Vz),...
@@ -74,7 +74,7 @@
 	(md.results.TransientSolution(1200).Base),...
 	(md.results.TransientSolution(1200).Surface),...
 	(md.results.TransientSolution(1200).Thickness),...
-	(md.results.TransientSolution(1200).SurfaceforcingsMassBalance),...
+	(md.results.TransientSolution(1200).SmbMassBalance),...
 	(md.results.TransientSolution(1600).Vx),...
 	(md.results.TransientSolution(1600).Vy),...
 	(md.results.TransientSolution(1600).Vz),...
@@ -83,7 +83,7 @@
 	(md.results.TransientSolution(1600).Base),...
 	(md.results.TransientSolution(1600).Surface),...
 	(md.results.TransientSolution(1600).Thickness),...
-	(md.results.TransientSolution(1600).SurfaceforcingsMassBalance),...
+	(md.results.TransientSolution(1600).SmbMassBalance),...
 	(md.results.TransientSolution(2000).Vx),...
 	(md.results.TransientSolution(2000).Vy),...
 	(md.results.TransientSolution(2000).Vz),...
@@ -92,7 +92,7 @@
 	(md.results.TransientSolution(2000).Base),...
 	(md.results.TransientSolution(2000).Surface),...
 	(md.results.TransientSolution(2000).Thickness),...
-	(md.results.TransientSolution(2000).SurfaceforcingsMassBalance),...
+	(md.results.TransientSolution(2000).SmbMassBalance),...
 	};
 
 if printingflag,
@@ -114,7 +114,7 @@
 	for t=starttime:endtime
 		thickness = [thickness (md.results.TransientSolution(t).Thickness)];
 		volume = [volume mean(md.results.TransientSolution(t).Thickness.value,2).*areas];
-		massbal = [massbal (md.results.TransientSolution(t).SurfaceforcingsMassBalance)];
+		massbal = [massbal (md.results.TransientSolution(t).SmbMassBalance)];
 		velocity = [velocity (md.results.TransientSolution(t).Vel)];
 	end
 

Modified: issm/trunk/test/NightlyRun/test1502.py
===================================================================
--- issm/trunk/test/NightlyRun/test1502.py	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/NightlyRun/test1502.py	2016-04-13 04:32:01 UTC (rev 20500)
@@ -26,35 +26,35 @@
 
 #Solve for thinning rate -> -1 * surface mass balance
 smb= 2.*numpy.ones((md.mesh.numberofvertices,1))
-md.surfaceforcings.mass_balance= smb
+md.smb.mass_balance= smb
 md.basalforcings.groundedice_melting_rate= smb
 
 md=solve(md,MasstransportSolutionEnum())
 
 for i in xrange(1,11):
 	 md=solve(md,MasstransportSolutionEnum())
-	 md.surfaceforcings.mass_balance= md.surfaceforcings.mass_balance - ((md.results.MasstransportSolution.Thickness)-md.geometry.thickness)
+	 md.smb.mass_balance= md.smb.mass_balance - ((md.results.MasstransportSolution.Thickness)-md.geometry.thickness)
 
 #Set up transient
-smb = md.surfaceforcings.mass_balance
+smb = md.smb.mass_balance
 
 #tooth= [ [ones(400,1)*(smb') - 10.]' [ones(400,1)*(smb')]' ];
 tooth=numpy.hstack((numpy.tile(smb-10.,(1,400)),numpy.tile(smb,(1,400))))
 #smb=[ [ones(399,1)*(smb')]' smb  tooth tooth];
 smb=numpy.hstack((numpy.tile(smb,(1,399)),smb,tooth,tooth))
 
-#md.surfaceforcings.mass_balance= smb;
-#md.surfaceforcings.mass_balance(end+1,:)=[1.:2000.];
-md.surfaceforcings.mass_balance=numpy.vstack((smb,numpy.arange(1,2001)))
+#md.smb.mass_balance= smb;
+#md.smb.mass_balance(end+1,:)=[1.:2000.];
+md.smb.mass_balance=numpy.vstack((smb,numpy.arange(1,2001)))
 
 md=solve(md,TransientSolutionEnum())
 
 #Fields and tolerances to track changes
-field_names=['Vx1','Vy1','Vz1','Vel1','Pressure1','Bed1','Surface1','Thickness1','SurfaceforcingsMassBalance1', \
-	'Vx2','Vy2','Vz2','Vel2','Pressure2','Bed2','Surface2','Thickness2','SurfaceforcingsMassBalance2', \
-	'Vx3','Vy3','Vz3','Vel3','Pressure3','Bed3','Surface3','Thickness3','SurfaceforcingsMassBalance3', \
-	'Vx4','Vy4','Vz4','Vel4','Pressure4','Bed4','Surface4','Thickness4','SurfaceforcingsMassBalance4', \
-	'Vx5','Vy5','Vz5','Vel5','Pressure5','Bed5','Surface5','Thickness5','SurfaceforcingsMassBalance5']
+field_names=['Vx1','Vy1','Vz1','Vel1','Pressure1','Bed1','Surface1','Thickness1','SmbMassBalance1', \
+	'Vx2','Vy2','Vz2','Vel2','Pressure2','Bed2','Surface2','Thickness2','SmbMassBalance2', \
+	'Vx3','Vy3','Vz3','Vel3','Pressure3','Bed3','Surface3','Thickness3','SmbMassBalance3', \
+	'Vx4','Vy4','Vz4','Vel4','Pressure4','Bed4','Surface4','Thickness4','SmbMassBalance4', \
+	'Vx5','Vy5','Vz5','Vel5','Pressure5','Bed5','Surface5','Thickness5','SmbMassBalance5']
 field_tolerances=[1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,\
 	1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,\
 	1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,\
@@ -69,7 +69,7 @@
 	md.results.TransientSolution[400-1].Base,\
 	md.results.TransientSolution[400-1].Surface,\
 	md.results.TransientSolution[400-1].Thickness,\
-	md.results.TransientSolution[400-1].SurfaceforcingsMassBalance,\
+	md.results.TransientSolution[400-1].SmbMassBalance,\
 	md.results.TransientSolution[800-1].Vx,\
 	md.results.TransientSolution[800-1].Vy,\
 	md.results.TransientSolution[800-1].Vz,\
@@ -78,7 +78,7 @@
 	md.results.TransientSolution[800-1].Base,\
 	md.results.TransientSolution[800-1].Surface,\
 	md.results.TransientSolution[800-1].Thickness,\
-	md.results.TransientSolution[800-1].SurfaceforcingsMassBalance,\
+	md.results.TransientSolution[800-1].SmbMassBalance,\
 	md.results.TransientSolution[1200-1].Vx,\
 	md.results.TransientSolution[1200-1].Vy,\
 	md.results.TransientSolution[1200-1].Vz,\
@@ -87,7 +87,7 @@
 	md.results.TransientSolution[1200-1].Base,\
 	md.results.TransientSolution[1200-1].Surface,\
 	md.results.TransientSolution[1200-1].Thickness,\
-	md.results.TransientSolution[1200-1].SurfaceforcingsMassBalance,\
+	md.results.TransientSolution[1200-1].SmbMassBalance,\
 	md.results.TransientSolution[1600-1].Vx,\
 	md.results.TransientSolution[1600-1].Vy,\
 	md.results.TransientSolution[1600-1].Vz,\
@@ -96,7 +96,7 @@
 	md.results.TransientSolution[1600-1].Base,\
 	md.results.TransientSolution[1600-1].Surface,\
 	md.results.TransientSolution[1600-1].Thickness,\
-	md.results.TransientSolution[1600-1].SurfaceforcingsMassBalance,\
+	md.results.TransientSolution[1600-1].SmbMassBalance,\
 	md.results.TransientSolution[2000-1].Vx,\
 	md.results.TransientSolution[2000-1].Vy,\
 	md.results.TransientSolution[2000-1].Vz,\
@@ -105,7 +105,7 @@
 	md.results.TransientSolution[2000-1].Base,\
 	md.results.TransientSolution[2000-1].Surface,\
 	md.results.TransientSolution[2000-1].Thickness,\
-	md.results.TransientSolution[2000-1].SurfaceforcingsMassBalance,\
+	md.results.TransientSolution[2000-1].SmbMassBalance,\
 	]
 
 if printingflag:
@@ -129,7 +129,7 @@
 	for t=starttime:endtime
 		thickness = [thickness (md.results.TransientSolution(t).Thickness)];
 		volume = [volume mean(md.results.TransientSolution(t).Thickness.value,2).*areas];
-		massbal = [massbal (md.results.TransientSolution(t).SurfaceforcingsMassBalance)];
+		massbal = [massbal (md.results.TransientSolution(t).SmbMassBalance)];
 		velocity = [velocity (md.results.TransientSolution(t).Vel)];
 	end
 

Modified: issm/trunk/test/NightlyRun/test2001.py
===================================================================
--- issm/trunk/test/NightlyRun/test2001.py	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/NightlyRun/test2001.py	2016-04-13 04:32:01 UTC (rev 20500)
@@ -22,17 +22,16 @@
 #Define loading history (see test2001.m for the description)
 md.timestepping.start_time=2400000 # 2,400 kyr
 md.timestepping.final_time=2500000 # 2,500 kyr
-md.geometry.thickness=[\
-	[md.geometry.thickness*0.0; 0.0],\
-	[md.geometry.thickness/2.0; 0.1],\
-	[md.geometry.thickness; 0.2],\
-	[md.geometry.thickness; 1.0],\
-	[md.geometry.thickness; md.timestepping.start_time],\
-	]
+md.geometry.thickness=numpy.hstack((\
+		numpy.vstack((md.geometry.thickness*0.0, 0.0)),\
+		numpy.vstack((md.geometry.thickness/2.0, 0.1)),\
+		numpy.vstack((md.geometry.thickness, 0.2)),\
+		numpy.vstack((md.geometry.thickness, 1.0)),\
+		numpy.vstack((md.geometry.thickness, md.timestepping.start_time)),\
+		))
 
 #Solve for GIA deflection 
 md.cluster=generic('name',oshostname(),'np',3)
-md.verbose=verbose('1111111')
 md=solve(md,GiaSolutionEnum())
 
 #Fields and tolerances to track changes

Modified: issm/trunk/test/NightlyRun/test207.m
===================================================================
--- issm/trunk/test/NightlyRun/test207.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/NightlyRun/test207.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -7,6 +7,7 @@
 md.cluster=generic('name',oshostname(),'np',3);
 md.transient.isstressbalance=0;
 md.transient.ismasstransport=0;
+md.transient.issmb=1;
 md.transient.isthermal=1;
 md.transient.isgroundingline=0;
 md=solve(md,TransientSolutionEnum());

Modified: issm/trunk/test/NightlyRun/test207.py
===================================================================
--- issm/trunk/test/NightlyRun/test207.py	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/NightlyRun/test207.py	2016-04-13 04:32:01 UTC (rev 20500)
@@ -18,6 +18,7 @@
 md.cluster=generic('name',oshostname(),'np',3)
 md.transient.isstressbalance=False
 md.transient.ismasstransport=False
+md.transient.issmb=True
 md.transient.isthermal=True
 md.transient.isgroundingline=False
 md=solve(md,TransientSolutionEnum())

Modified: issm/trunk/test/NightlyRun/test208.m
===================================================================
--- issm/trunk/test/NightlyRun/test208.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/NightlyRun/test208.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -4,11 +4,17 @@
 md=parameterize(md,'../Par/SquareShelf.par');
 md=setflowequation(md,'SSA','all');
 md.cluster=generic('name',oshostname(),'np',3);
+md.transient.requested_outputs={'default','FloatingArea','GroundedArea','TotalGroundedBmb','TotalFloatingBmb'};
+md.basalforcings.floatingice_melting_rate(:)=1;
 md=solve(md,TransientSolutionEnum());
 
 %Fields and tolerances to track changes
-field_names     ={'Vx1','Vy1','Vel1','Pressure1','Bed1','Surface1','Thickness1','Vx2','Vy2','Vel2','Pressure2','Bed2','Surface2','Thickness2','Vx3','Vy3','Vel3','Pressure3','Bed3','Surface3','Thickness3'};
-field_tolerances={1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13};
+field_names     ={'Vx1','Vy1','Vel1','Pressure1','Bed1','Surface1','Thickness1','TotalGroundedBmb1','TotalFloatingBmb1',...
+	'Vx2','Vy2','Vel2','Pressure2','Bed2','Surface2','Thickness2','TotalGroundedBmb2','TotalFloatingBmb2',...
+	'Vx3','Vy3','Vel3','Pressure3','Bed3','Surface3','Thickness3','TotalGroundedBmb3','TotalFloatingBmb3'};
+field_tolerances={1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,...
+	1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,...
+	1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13};
 field_values={...
 	(md.results.TransientSolution(1).Vx),...
 	(md.results.TransientSolution(1).Vy),...
@@ -17,6 +23,8 @@
 	(md.results.TransientSolution(1).Base),...
 	(md.results.TransientSolution(1).Surface),...
 	(md.results.TransientSolution(1).Thickness),...
+	(md.results.TransientSolution(1).TotalGroundedBmb),...
+	(md.results.TransientSolution(1).TotalFloatingBmb),...
 	(md.results.TransientSolution(2).Vx),...
 	(md.results.TransientSolution(2).Vy),...
 	(md.results.TransientSolution(2).Vel),...
@@ -24,6 +32,8 @@
 	(md.results.TransientSolution(2).Base),...
 	(md.results.TransientSolution(2).Surface),...
 	(md.results.TransientSolution(2).Thickness),...
+	(md.results.TransientSolution(2).TotalGroundedBmb),...
+	(md.results.TransientSolution(2).TotalFloatingBmb),...
 	(md.results.TransientSolution(3).Vx),...
 	(md.results.TransientSolution(3).Vy),...
 	(md.results.TransientSolution(3).Vel),...
@@ -31,4 +41,6 @@
 	(md.results.TransientSolution(3).Base),...
 	(md.results.TransientSolution(3).Surface),...
 	(md.results.TransientSolution(3).Thickness),...
+	(md.results.TransientSolution(3).TotalGroundedBmb),...
+	(md.results.TransientSolution(3).TotalFloatingBmb),...
 	};

Modified: issm/trunk/test/NightlyRun/test208.py
===================================================================
--- issm/trunk/test/NightlyRun/test208.py	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/NightlyRun/test208.py	2016-04-13 04:32:01 UTC (rev 20500)
@@ -13,15 +13,17 @@
 md=triangle(model(),'../Exp/Square.exp',150000)
 md=setmask(md,'all','')
 md=parameterize(md,'../Par/SquareShelf.py')
+md.basalforcings.floatingice_melting_rate[:]=1.
 md=setflowequation(md,'SSA','all')
 md.cluster=generic('name',oshostname(),'np',3)
+md.transient.requested_outputs=['default','FloatingArea','GroundedArea','TotalFloatingBmb','TotalGroundedBmb']
 md=solve(md,TransientSolutionEnum())
 
 
 # Fields and tolerances to track changes
 
-field_names     =['Vx1','Vy1','Vel1','Pressure1','Bed1','Surface1','Thickness1','Vx2','Vy2','Vel2','Pressure2','Bed2','Surface2','Thickness2','Vx3','Vy3','Vel3','Pressure3','Bed3','Surface3','Thickness3']
-field_tolerances=[1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13]
+field_names     =['Vx1','Vy1','Vel1','Pressure1','Bed1','Surface1','Thickness1','TotalGroundedBmb1','TotalFloatingBmb1','Vx2','Vy2','Vel2','Pressure2','Bed2','Surface2','Thickness2','TotalGroundedBmb2','TotalFloatingBmb2','Vx3','Vy3','Vel3','Pressure3','Bed3','Surface3','Thickness3','TotalGroundedBmb3','TotalFloatingBmb3']
+field_tolerances=[1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13]
 field_values=[\
 	md.results.TransientSolution[0].Vx,\
 	md.results.TransientSolution[0].Vy,\
@@ -30,6 +32,8 @@
 	md.results.TransientSolution[0].Base,\
 	md.results.TransientSolution[0].Surface,\
 	md.results.TransientSolution[0].Thickness,\
+	md.results.TransientSolution[0].TotalGroundedBmb,\
+	md.results.TransientSolution[0].TotalFloatingBmb,\
 	md.results.TransientSolution[1].Vx,\
 	md.results.TransientSolution[1].Vy,\
 	md.results.TransientSolution[1].Vel,\
@@ -37,6 +41,8 @@
 	md.results.TransientSolution[1].Base,\
 	md.results.TransientSolution[1].Surface,\
 	md.results.TransientSolution[1].Thickness,\
+	md.results.TransientSolution[1].TotalGroundedBmb,\
+	md.results.TransientSolution[1].TotalFloatingBmb,\
 	md.results.TransientSolution[2].Vx,\
 	md.results.TransientSolution[2].Vy,\
 	md.results.TransientSolution[2].Vel,\
@@ -44,4 +50,6 @@
 	md.results.TransientSolution[2].Base,\
 	md.results.TransientSolution[2].Surface,\
 	md.results.TransientSolution[2].Thickness,\
+	md.results.TransientSolution[2].TotalGroundedBmb,\
+	md.results.TransientSolution[2].TotalFloatingBmb,\
 	]

Modified: issm/trunk/test/NightlyRun/test210.m
===================================================================
--- issm/trunk/test/NightlyRun/test210.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/NightlyRun/test210.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -5,6 +5,7 @@
 md=extrude(md,3,1.);
 md=setflowequation(md,'HO','all');
 md.cluster=generic('name',oshostname(),'np',3);
+md.transient.requested_outputs={'default','GroundedArea'};
 md=solve(md,TransientSolutionEnum());
 
 %Fields and tolerances to track changes

Modified: issm/trunk/test/NightlyRun/test211.m
===================================================================
--- issm/trunk/test/NightlyRun/test211.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/NightlyRun/test211.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -14,8 +14,8 @@
 	'Vx2','Vy2','Vz2','Vel2','Pressure2','Bed2','Surface2','Thickness2','Temperature2','BasalforcingsGroundediceMeltingRate2', ...
 	'Vx3','Vy3','Vz3','Vel3','Pressure3','Bed3','Surface3','Thickness3','Temperature3','BasalforcingsGroundediceMeltingRate3'};
 field_tolerances={...
-	2e-08,2e-08,1e-06,2e-08,1e-08,1e-08,1e-08,1e-08,1e-08,1e-08,...
-	5e-07,5e-07,5e-05,1e-07,1e-08,1e-08,1e-08,1e-08,5e-08,2e-06,...
+	2e-08,2e-08,2e-06,2e-08,1e-08,1e-08,1e-08,1e-08,1e-08,1e-08,...
+	5e-07,5e-07,5e-05,2e-07,1e-08,1e-08,1e-08,1e-08,6e-08,2e-06,...
 	5e-06,5e-06,5e-05,5e-06,5e-07,5e-07,5e-07,5e-07,5e-06,5e-05};
 field_values={...
 	(md.results.TransientSolution(1).Vx),...

Modified: issm/trunk/test/NightlyRun/test215.m
===================================================================
--- issm/trunk/test/NightlyRun/test215.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/NightlyRun/test215.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -23,7 +23,7 @@
 
 %Fields and tolerances to track changes
 field_names     ={'Gradient','Misfits','MaterialsRheologyBbar','Pressure','Vel','Vx','Vy'};
-field_tolerances={1e-08,1e-09,2e-09,1e-09,2e-09,5e-09,2e-09};
+field_tolerances={4.6e-08,1e-08,2e-08,1e-09,2e-09,5e-09,2e-09};
 field_values={...
 	(md.results.StressbalanceSolution.Gradient1),...
 	(md.results.StressbalanceSolution.J),...

Modified: issm/trunk/test/NightlyRun/test215.py
===================================================================
--- issm/trunk/test/NightlyRun/test215.py	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/NightlyRun/test215.py	2016-04-13 04:32:01 UTC (rev 20500)
@@ -40,7 +40,7 @@
 # Fields and tolerances to track changes
 
 field_names     =['Gradient','Misfits','MaterialsRheologyBbar','Pressure','Vel','Vx','Vy']
-field_tolerances=[1e-08,1e-09,2e-09,1e-09,2e-09,5e-09,2e-09]
+field_tolerances=[4.6e-08,1e-08,2e-09,1e-08,2e-09,5e-09,2e-09]
 field_values=[\
 	md.results.StressbalanceSolution.Gradient1,\
 	md.results.StressbalanceSolution.J,\

Modified: issm/trunk/test/NightlyRun/test218.m
===================================================================
--- issm/trunk/test/NightlyRun/test218.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/NightlyRun/test218.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -54,6 +54,10 @@
 md.qmu.partition=md.qmu.partition-1;
 
 %Dakota options
+
+%dakota version
+version=IssmConfig('_DAKOTA_VERSION_'); version=version(1:3); version=str2num(version);
+
 %variables
 md.qmu.variables.rheology_B=normal_uncertain('scaled_MaterialsRheologyB',1,.05);
 
@@ -65,10 +69,17 @@
 
 %parameters
 md.qmu.params.direct=true;
-md.qmu.params.analysis_driver='stressbalance';
-md.qmu.params.evaluation_concurrency=1;
 md.qmu.params.interval_type='forward';
 
+if version>=6,
+	md.qmu.params.analysis_driver='matlab';
+	md.qmu.params.evaluation_scheduling='master';
+	md.qmu.params.processors_per_evaluation=2;
+else
+	md.qmu.params.analysis_driver='stressbalance';
+	md.qmu.params.evaluation_concurrency=1;
+end
+
 %imperative! 
 md.stressbalance.reltol=10^-10; %tighten for qmu analysese
 md.qmu.isdakota=1;

Modified: issm/trunk/test/NightlyRun/test226.m
===================================================================
--- issm/trunk/test/NightlyRun/test226.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/NightlyRun/test226.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -5,7 +5,7 @@
 md=setflowequation(md,'SSA','all');
 md.cluster=generic('name',oshostname(),'np',3);
 md.timestepping.time_adapt=1.;
-md.timestepping.final_time=10.;
+md.timestepping.final_time=15.;
 md=solve(md,TransientSolutionEnum());
 
 %Fields and tolerances to track changes

Modified: issm/trunk/test/NightlyRun/test226.py
===================================================================
--- issm/trunk/test/NightlyRun/test226.py	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/NightlyRun/test226.py	2016-04-13 04:32:01 UTC (rev 20500)
@@ -14,7 +14,7 @@
 md=setflowequation(md,'SSA','all')
 md.cluster=generic('name',oshostname(),'np',3)
 md.timestepping.time_adapt=1.
-md.timestepping.final_time=10.
+md.timestepping.final_time=15.
 md=solve(md,TransientSolutionEnum())
 
 #Fields and tolerances to track changes

Modified: issm/trunk/test/NightlyRun/test227.m
===================================================================
--- issm/trunk/test/NightlyRun/test227.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/NightlyRun/test227.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -6,7 +6,7 @@
 md=setflowequation(md,'HO','all');
 md.cluster=generic('name',oshostname(),'np',3);
 md.timestepping.time_adapt=1.;
-md.timestepping.final_time=15.;
+md.timestepping.final_time=20.;
 md=solve(md,TransientSolutionEnum());
 
 %Fields and tolerances to track changes
@@ -14,7 +14,7 @@
 	'Vx2','Vy2','Vz2','Vel2','Pressure2','Bed2','Surface2','Thickness2','Temperature2','BasalforcingsGroundediceMeltingRate2', ...
 	'Vx3','Vy3','Vz3','Vel3','Pressure3','Bed3','Surface3','Thickness3','Temperature3','BasalforcingsGroundediceMeltingRate3'};
 field_tolerances={...
-	1e-09,1e-09,1e-09,1e-09,1e-09,1e-09,1e-09,1e-09,1e-09,1e-09,...
+	1e-08,1e-09,1e-09,1e-09,1e-09,1e-09,1e-09,1e-09,1e-09,1e-09,...
 	1e-09,1e-09,1e-08,1e-09,1e-09,1e-09,1e-09,1e-09,1e-09,1e-06,...
 	1e-08,1e-08,1e-08,1e-08,1e-09,1e-09,1e-09,1e-09,1e-09,1e-05};
 field_values={...

Modified: issm/trunk/test/NightlyRun/test227.py
===================================================================
--- issm/trunk/test/NightlyRun/test227.py	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/NightlyRun/test227.py	2016-04-13 04:32:01 UTC (rev 20500)
@@ -15,7 +15,7 @@
 md=setflowequation(md,'HO','all')
 md.cluster=generic('name',oshostname(),'np',3)
 md.timestepping.time_adapt=1.
-md.timestepping.final_time=15.
+md.timestepping.final_time=20.
 md=solve(md,TransientSolutionEnum())
 
 #Fields and tolerances to track changes
@@ -23,7 +23,7 @@
 	'Vx2','Vy2','Vz2','Vel2','Pressure2','Bed2','Surface2','Thickness2','Temperature2','BasalforcingsGroundediceMeltingRate2', \
 	'Vx3','Vy3','Vz3','Vel3','Pressure3','Bed3','Surface3','Thickness3','Temperature3','BasalforcingsGroundediceMeltingRate3']
 field_tolerances=[\
-	1e-09,1e-09,1e-09,1e-09,1e-09,1e-09,1e-09,1e-09,1e-09,1e-09,\
+	1e-08,1e-09,1e-09,1e-09,1e-09,1e-09,1e-09,1e-09,1e-09,1e-09,\
 	1e-09,1e-09,1e-08,1e-09,1e-09,1e-09,1e-09,1e-09,1e-09,1e-06,\
 	1e-08,1e-08,1e-08,1e-08,1e-09,1e-09,1e-09,1e-09,1e-09,1e-05]
 field_values=[\

Modified: issm/trunk/test/NightlyRun/test228.m
===================================================================
--- issm/trunk/test/NightlyRun/test228.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/NightlyRun/test228.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -13,17 +13,17 @@
 smb=ones(md.mesh.numberofvertices,1)*3.6;
 smb=[ smb smb*-1. ];
 
-md.surfaceforcings.mass_balance=smb;
-md.surfaceforcings.mass_balance(end+1,:)=[1.5 3.];
+md.smb.mass_balance=smb;
+md.smb.mass_balance(end+1,:)=[1.5 3.];
 md.transient.isthermal=0;
 
 md=solve(md,TransientSolutionEnum());
 
 %Fields and tolerances to track changes
-field_names={'Vx1','Vy1','Vel1','Pressure1','Bed1','Surface1','Thickness1','SurfaceforcingsMassBalance1', ...
-	'Vx2','Vy2','Vel2','Pressure2','Bed2','Surface2','Thickness2','SurfaceforcingsMassBalance2', ...
-	'Vx3','Vy3','Vel3','Pressure3','Bed3','Surface3','Thickness3','SurfaceforcingsMassBalance3', ...
-	'Vx4','Vy4','Vel4','Pressure4','Bed4','Surface4','Thickness4','SurfaceforcingsMassBalance4'};
+field_names={'Vx1','Vy1','Vel1','Pressure1','Bed1','Surface1','Thickness1','SmbMassBalance1', ...
+	'Vx2','Vy2','Vel2','Pressure2','Bed2','Surface2','Thickness2','SmbMassBalance2', ...
+	'Vx3','Vy3','Vel3','Pressure3','Bed3','Surface3','Thickness3','SmbMassBalance3', ...
+	'Vx4','Vy4','Vel4','Pressure4','Bed4','Surface4','Thickness4','SmbMassBalance4'};
 field_tolerances={1e-09,1e-09,1e-10,1e-10,1e-10,1e-10,1e-10,1e-10,...
 	1e-09,1e-09,1e-10,1e-10,1e-10,1e-10,1e-10,1e-10,...
 	1e-09,1e-09,1e-10,1e-10,1e-10,1e-10,1e-10,1e-10,...
@@ -36,7 +36,7 @@
 	(md.results.TransientSolution(1).Base),...
 	(md.results.TransientSolution(1).Surface),...
 	(md.results.TransientSolution(1).Thickness),...
-	(md.results.TransientSolution(1).SurfaceforcingsMassBalance),...
+	(md.results.TransientSolution(1).SmbMassBalance),...
 	(md.results.TransientSolution(2).Vx),...
 	(md.results.TransientSolution(2).Vy),...
 	(md.results.TransientSolution(2).Vel),...
@@ -44,7 +44,7 @@
 	(md.results.TransientSolution(2).Base),...
 	(md.results.TransientSolution(2).Surface),...
 	(md.results.TransientSolution(2).Thickness),...
-	(md.results.TransientSolution(2).SurfaceforcingsMassBalance),...
+	(md.results.TransientSolution(2).SmbMassBalance),...
 	(md.results.TransientSolution(3).Vx),...
 	(md.results.TransientSolution(3).Vy),...
 	(md.results.TransientSolution(3).Vel),...
@@ -52,7 +52,7 @@
 	(md.results.TransientSolution(3).Base),...
 	(md.results.TransientSolution(3).Surface),...
 	(md.results.TransientSolution(3).Thickness),...
-	(md.results.TransientSolution(3).SurfaceforcingsMassBalance),...
+	(md.results.TransientSolution(3).SmbMassBalance),...
 	(md.results.TransientSolution(4).Vx),...
 	(md.results.TransientSolution(4).Vy),...
 	(md.results.TransientSolution(4).Vel),...
@@ -60,5 +60,5 @@
 	(md.results.TransientSolution(4).Base),...
 	(md.results.TransientSolution(4).Surface),...
 	(md.results.TransientSolution(4).Thickness),...
-	(md.results.TransientSolution(4).SurfaceforcingsMassBalance),...
+	(md.results.TransientSolution(4).SmbMassBalance),...
 	};

Modified: issm/trunk/test/NightlyRun/test228.py
===================================================================
--- issm/trunk/test/NightlyRun/test228.py	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/NightlyRun/test228.py	2016-04-13 04:32:01 UTC (rev 20500)
@@ -23,16 +23,16 @@
 smb=numpy.ones((md.mesh.numberofvertices,1))*3.6
 smb=numpy.hstack((smb,smb*-1.))
 
-md.surfaceforcings.mass_balance=numpy.vstack((smb,[1.5,3.]))
+md.smb.mass_balance=numpy.vstack((smb,[1.5,3.]))
 md.transient.isthermal=False
 
 md=solve(md,TransientSolutionEnum())
 
 #Fields and tolerances to track changes
-field_names=['Vx1','Vy1','Vel1','Pressure1','Bed1','Surface1','Thickness1','SurfaceforcingsMassBalance1', \
-	'Vx2','Vy2','Vel2','Pressure2','Bed2','Surface2','Thickness2','SurfaceforcingsMassBalance2', \
-	'Vx3','Vy3','Vel3','Pressure3','Bed3','Surface3','Thickness3','SurfaceforcingsMassBalance3', \
-	'Vx4','Vy4','Vel4','Pressure4','Bed4','Surface4','Thickness4','SurfaceforcingsMassBalance4']
+field_names=['Vx1','Vy1','Vel1','Pressure1','Bed1','Surface1','Thickness1','SmbMassBalance1', \
+	'Vx2','Vy2','Vel2','Pressure2','Bed2','Surface2','Thickness2','SmbMassBalance2', \
+	'Vx3','Vy3','Vel3','Pressure3','Bed3','Surface3','Thickness3','SmbMassBalance3', \
+	'Vx4','Vy4','Vel4','Pressure4','Bed4','Surface4','Thickness4','SmbMassBalance4']
 field_tolerances=[1e-09,1e-09,1e-10,1e-10,1e-10,1e-10,1e-10,1e-10,\
 	1e-09,1e-09,1e-10,1e-10,1e-10,1e-10,1e-10,1e-10,\
 	1e-09,1e-09,1e-10,1e-10,1e-10,1e-10,1e-10,1e-10,\
@@ -45,7 +45,7 @@
 	md.results.TransientSolution[0].Base,\
 	md.results.TransientSolution[0].Surface,\
 	md.results.TransientSolution[0].Thickness,\
-	md.results.TransientSolution[0].SurfaceforcingsMassBalance,\
+	md.results.TransientSolution[0].SmbMassBalance,\
 	md.results.TransientSolution[1].Vx,\
 	md.results.TransientSolution[1].Vy,\
 	md.results.TransientSolution[1].Vel,\
@@ -53,7 +53,7 @@
 	md.results.TransientSolution[1].Base,\
 	md.results.TransientSolution[1].Surface,\
 	md.results.TransientSolution[1].Thickness,\
-	md.results.TransientSolution[1].SurfaceforcingsMassBalance,\
+	md.results.TransientSolution[1].SmbMassBalance,\
 	md.results.TransientSolution[2].Vx,\
 	md.results.TransientSolution[2].Vy,\
 	md.results.TransientSolution[2].Vel,\
@@ -61,7 +61,7 @@
 	md.results.TransientSolution[2].Base,\
 	md.results.TransientSolution[2].Surface,\
 	md.results.TransientSolution[2].Thickness,\
-	md.results.TransientSolution[2].SurfaceforcingsMassBalance,\
+	md.results.TransientSolution[2].SmbMassBalance,\
 	md.results.TransientSolution[3].Vx,\
 	md.results.TransientSolution[3].Vy,\
 	md.results.TransientSolution[3].Vel,\
@@ -69,5 +69,5 @@
 	md.results.TransientSolution[3].Base,\
 	md.results.TransientSolution[3].Surface,\
 	md.results.TransientSolution[3].Thickness,\
-	md.results.TransientSolution[3].SurfaceforcingsMassBalance,\
+	md.results.TransientSolution[3].SmbMassBalance,\
 	]

Modified: issm/trunk/test/NightlyRun/test229.m
===================================================================
--- issm/trunk/test/NightlyRun/test229.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/NightlyRun/test229.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -13,17 +13,17 @@
 smb=ones(md.mesh.numberofvertices,1)*3.6;
 smb=[ smb smb*2. ];
 
-md.surfaceforcings.mass_balance=smb;
-md.surfaceforcings.mass_balance(end+1,:)=[1.5 3.];
+md.smb.mass_balance=smb;
+md.smb.mass_balance(end+1,:)=[1.5 3.];
 md.transient.isthermal=0;
 
 md=solve(md,TransientSolutionEnum());
 
 %Fields and tolerances to track changes
-field_names={'Vx1','Vy1','Vel1','Pressure1','Bed1','Surface1','Thickness1','SurfaceforcingsMassBalance1', ...
-	'Vx2','Vy2','Vel2','Pressure2','Bed2','Surface2','Thickness2','SurfaceforcingsMassBalance2', ...
-	'Vx3','Vy3','Vel3','Pressure3','Bed3','Surface3','Thickness3','SurfaceforcingsMassBalance3', ...
-	'Vx4','Vy4','Vel4','Pressure4','Bed4','Surface4','Thickness4','SurfaceforcingsMassBalance4'};
+field_names={'Vx1','Vy1','Vel1','Pressure1','Bed1','Surface1','Thickness1','SmbMassBalance1', ...
+	'Vx2','Vy2','Vel2','Pressure2','Bed2','Surface2','Thickness2','SmbMassBalance2', ...
+	'Vx3','Vy3','Vel3','Pressure3','Bed3','Surface3','Thickness3','SmbMassBalance3', ...
+	'Vx4','Vy4','Vel4','Pressure4','Bed4','Surface4','Thickness4','SmbMassBalance4'};
 field_tolerances={1e-09,1e-09,1e-10,1e-10,1e-10,1e-10,1e-10,1e-10,...
 	1e-09,1e-09,1e-10,1e-10,1e-10,1e-10,1e-10,1e-10,...
 	1e-09,1e-09,1e-10,1e-10,1e-10,1e-10,1e-10,1e-10,...
@@ -36,7 +36,7 @@
 	(md.results.TransientSolution(1).Base),...
 	(md.results.TransientSolution(1).Surface),...
 	(md.results.TransientSolution(1).Thickness),...
-	(md.results.TransientSolution(1).SurfaceforcingsMassBalance),...
+	(md.results.TransientSolution(1).SmbMassBalance),...
 	(md.results.TransientSolution(2).Vx),...
 	(md.results.TransientSolution(2).Vy),...
 	(md.results.TransientSolution(2).Vel),...
@@ -44,7 +44,7 @@
 	(md.results.TransientSolution(2).Base),...
 	(md.results.TransientSolution(2).Surface),...
 	(md.results.TransientSolution(2).Thickness),...
-	(md.results.TransientSolution(2).SurfaceforcingsMassBalance),...
+	(md.results.TransientSolution(2).SmbMassBalance),...
 	(md.results.TransientSolution(3).Vx),...
 	(md.results.TransientSolution(3).Vy),...
 	(md.results.TransientSolution(3).Vel),...
@@ -52,7 +52,7 @@
 	(md.results.TransientSolution(3).Base),...
 	(md.results.TransientSolution(3).Surface),...
 	(md.results.TransientSolution(3).Thickness),...
-	(md.results.TransientSolution(3).SurfaceforcingsMassBalance),...
+	(md.results.TransientSolution(3).SmbMassBalance),...
 	(md.results.TransientSolution(4).Vx),...
 	(md.results.TransientSolution(4).Vy),...
 	(md.results.TransientSolution(4).Vel),...
@@ -60,5 +60,5 @@
 	(md.results.TransientSolution(4).Base),...
 	(md.results.TransientSolution(4).Surface),...
 	(md.results.TransientSolution(4).Thickness),...
-	(md.results.TransientSolution(4).SurfaceforcingsMassBalance),...
+	(md.results.TransientSolution(4).SmbMassBalance),...
 	};

Modified: issm/trunk/test/NightlyRun/test229.py
===================================================================
--- issm/trunk/test/NightlyRun/test229.py	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/NightlyRun/test229.py	2016-04-13 04:32:01 UTC (rev 20500)
@@ -23,16 +23,16 @@
 smb=numpy.ones((md.mesh.numberofvertices,1))*3.6
 smb=numpy.hstack((smb,smb*2.))
 
-md.surfaceforcings.mass_balance=numpy.vstack((smb,[1.5,3.]))
+md.smb.mass_balance=numpy.vstack((smb,[1.5,3.]))
 md.transient.isthermal=False
 
 md=solve(md,TransientSolutionEnum())
 
 #Fields and tolerances to track changes
-field_names=['Vx1','Vy1','Vel1','Pressure1','Bed1','Surface1','Thickness1','SurfaceforcingsMassBalance1', \
-	'Vx2','Vy2','Vel2','Pressure2','Bed2','Surface2','Thickness2','SurfaceforcingsMassBalance2', \
-	'Vx3','Vy3','Vel3','Pressure3','Bed3','Surface3','Thickness3','SurfaceforcingsMassBalance3', \
-	'Vx4','Vy4','Vel4','Pressure4','Bed4','Surface4','Thickness4','SurfaceforcingsMassBalance4']
+field_names=['Vx1','Vy1','Vel1','Pressure1','Bed1','Surface1','Thickness1','SmbMassBalance1', \
+	'Vx2','Vy2','Vel2','Pressure2','Bed2','Surface2','Thickness2','SmbMassBalance2', \
+	'Vx3','Vy3','Vel3','Pressure3','Bed3','Surface3','Thickness3','SmbMassBalance3', \
+	'Vx4','Vy4','Vel4','Pressure4','Bed4','Surface4','Thickness4','SmbMassBalance4']
 field_tolerances=[1e-09,1e-09,1e-10,1e-10,1e-10,1e-10,1e-10,1e-10,\
 	1e-09,1e-09,1e-10,1e-10,1e-10,1e-10,1e-10,1e-10,\
 	1e-09,1e-09,1e-10,1e-10,1e-10,1e-10,1e-10,1e-10,\
@@ -45,7 +45,7 @@
 	md.results.TransientSolution[0].Base,\
 	md.results.TransientSolution[0].Surface,\
 	md.results.TransientSolution[0].Thickness,\
-	md.results.TransientSolution[0].SurfaceforcingsMassBalance,\
+	md.results.TransientSolution[0].SmbMassBalance,\
 	md.results.TransientSolution[1].Vx,\
 	md.results.TransientSolution[1].Vy,\
 	md.results.TransientSolution[1].Vel,\
@@ -53,7 +53,7 @@
 	md.results.TransientSolution[1].Base,\
 	md.results.TransientSolution[1].Surface,\
 	md.results.TransientSolution[1].Thickness,\
-	md.results.TransientSolution[1].SurfaceforcingsMassBalance,\
+	md.results.TransientSolution[1].SmbMassBalance,\
 	md.results.TransientSolution[2].Vx,\
 	md.results.TransientSolution[2].Vy,\
 	md.results.TransientSolution[2].Vel,\
@@ -61,7 +61,7 @@
 	md.results.TransientSolution[2].Base,\
 	md.results.TransientSolution[2].Surface,\
 	md.results.TransientSolution[2].Thickness,\
-	md.results.TransientSolution[2].SurfaceforcingsMassBalance,\
+	md.results.TransientSolution[2].SmbMassBalance,\
 	md.results.TransientSolution[3].Vx,\
 	md.results.TransientSolution[3].Vy,\
 	md.results.TransientSolution[3].Vel,\
@@ -69,5 +69,5 @@
 	md.results.TransientSolution[3].Base,\
 	md.results.TransientSolution[3].Surface,\
 	md.results.TransientSolution[3].Thickness,\
-	md.results.TransientSolution[3].SurfaceforcingsMassBalance,\
+	md.results.TransientSolution[3].SmbMassBalance,\
 	]

Modified: issm/trunk/test/NightlyRun/test230.m
===================================================================
--- issm/trunk/test/NightlyRun/test230.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/NightlyRun/test230.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -14,17 +14,17 @@
 smb=ones(md.mesh.numberofvertices,1)*3.6;
 smb=[ smb smb*-1. ];
 
-md.surfaceforcings.mass_balance=smb;
-md.surfaceforcings.mass_balance(end+1,:)=[1.5 3.];
+md.smb.mass_balance=smb;
+md.smb.mass_balance(end+1,:)=[1.5 3.];
 md.transient.isthermal=0;
 
 md=solve(md,TransientSolutionEnum());
 
 %Fields and tolerances to track changes
-field_names     ={'Vx1','Vy1','Vz1','Vel1','Pressure1','Bed1','Surface1','Thickness1','SurfaceforcingsMassBalance1', ...
-	'Vx2','Vy2','Vz2','Vel2','Pressure2','Bed2','Surface2','Thickness2','SurfaceforcingsMassBalance2', ...
-	'Vx3','Vy3','Vz3','Vel3','Pressure3','Bed3','Surface3','Thickness3','SurfaceforcingsMassBalance3', ...
-	'Vx4','Vy4','Vz4','Vel4','Pressure4','Bed4','Surface4','Thickness4','SurfaceforcingsMassbalance4'};
+field_names     ={'Vx1','Vy1','Vz1','Vel1','Pressure1','Bed1','Surface1','Thickness1','SmbMassBalance1', ...
+	'Vx2','Vy2','Vz2','Vel2','Pressure2','Bed2','Surface2','Thickness2','SmbMassBalance2', ...
+	'Vx3','Vy3','Vz3','Vel3','Pressure3','Bed3','Surface3','Thickness3','SmbMassBalance3', ...
+	'Vx4','Vy4','Vz4','Vel4','Pressure4','Bed4','Surface4','Thickness4','SmbMassbalance4'};
 field_tolerances={1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,...
 	1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,...
 	1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,...
@@ -38,7 +38,7 @@
 	(md.results.TransientSolution(1).Base),...
 	(md.results.TransientSolution(1).Surface),...
 	(md.results.TransientSolution(1).Thickness),...
-	(md.results.TransientSolution(1).SurfaceforcingsMassBalance),...
+	(md.results.TransientSolution(1).SmbMassBalance),...
 	(md.results.TransientSolution(2).Vx),...
 	(md.results.TransientSolution(2).Vy),...
 	(md.results.TransientSolution(2).Vz),...
@@ -47,7 +47,7 @@
 	(md.results.TransientSolution(2).Base),...
 	(md.results.TransientSolution(2).Surface),...
 	(md.results.TransientSolution(2).Thickness),...
-	(md.results.TransientSolution(2).SurfaceforcingsMassBalance),...
+	(md.results.TransientSolution(2).SmbMassBalance),...
 	(md.results.TransientSolution(3).Vx),...
 	(md.results.TransientSolution(3).Vy),...
 	(md.results.TransientSolution(3).Vz),...
@@ -56,7 +56,7 @@
 	(md.results.TransientSolution(3).Base),...
 	(md.results.TransientSolution(3).Surface),...
 	(md.results.TransientSolution(3).Thickness),...
-	(md.results.TransientSolution(3).SurfaceforcingsMassBalance),...
+	(md.results.TransientSolution(3).SmbMassBalance),...
 	(md.results.TransientSolution(4).Vx),...
 	(md.results.TransientSolution(4).Vy),...
 	(md.results.TransientSolution(4).Vz),...
@@ -65,5 +65,5 @@
 	(md.results.TransientSolution(4).Base),...
 	(md.results.TransientSolution(4).Surface),...
 	(md.results.TransientSolution(4).Thickness),...
-	(md.results.TransientSolution(4).SurfaceforcingsMassBalance),...
+	(md.results.TransientSolution(4).SmbMassBalance),...
 	};

Modified: issm/trunk/test/NightlyRun/test230.py
===================================================================
--- issm/trunk/test/NightlyRun/test230.py	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/NightlyRun/test230.py	2016-04-13 04:32:01 UTC (rev 20500)
@@ -24,16 +24,16 @@
 smb=numpy.ones((md.mesh.numberofvertices,1))*3.6
 smb=numpy.hstack((smb,smb*-1.))
 
-md.surfaceforcings.mass_balance=numpy.vstack((smb,[1.5,3.]))
+md.smb.mass_balance=numpy.vstack((smb,[1.5,3.]))
 md.transient.isthermal=False
 
 md=solve(md,TransientSolutionEnum())
 
 #Fields and tolerances to track changes
-field_names     =['Vx1','Vy1','Vz1','Vel1','Pressure1','Bed1','Surface1','Thickness1','SurfaceforcingsMassBalance1', \
-	'Vx2','Vy2','Vz2','Vel2','Pressure2','Bed2','Surface2','Thickness2','SurfaceforcingsMassBalance2', \
-	'Vx3','Vy3','Vz3','Vel3','Pressure3','Bed3','Surface3','Thickness3','SurfaceforcingsMassBalance3', \
-	'Vx4','Vy4','Vz4','Vel4','Pressure4','Bed4','Surface4','Thickness4','SurfaceforcingsMassbalance4']
+field_names     =['Vx1','Vy1','Vz1','Vel1','Pressure1','Bed1','Surface1','Thickness1','SmbMassBalance1', \
+	'Vx2','Vy2','Vz2','Vel2','Pressure2','Bed2','Surface2','Thickness2','SmbMassBalance2', \
+	'Vx3','Vy3','Vz3','Vel3','Pressure3','Bed3','Surface3','Thickness3','SmbMassBalance3', \
+	'Vx4','Vy4','Vz4','Vel4','Pressure4','Bed4','Surface4','Thickness4','SmbMassbalance4']
 field_tolerances=[1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,\
 	1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,\
 	1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,\
@@ -47,7 +47,7 @@
 	md.results.TransientSolution[0].Base,\
 	md.results.TransientSolution[0].Surface,\
 	md.results.TransientSolution[0].Thickness,\
-	md.results.TransientSolution[0].SurfaceforcingsMassBalance,\
+	md.results.TransientSolution[0].SmbMassBalance,\
 	md.results.TransientSolution[1].Vx,\
 	md.results.TransientSolution[1].Vy,\
 	md.results.TransientSolution[1].Vz,\
@@ -56,7 +56,7 @@
 	md.results.TransientSolution[1].Base,\
 	md.results.TransientSolution[1].Surface,\
 	md.results.TransientSolution[1].Thickness,\
-	md.results.TransientSolution[1].SurfaceforcingsMassBalance,\
+	md.results.TransientSolution[1].SmbMassBalance,\
 	md.results.TransientSolution[2].Vx,\
 	md.results.TransientSolution[2].Vy,\
 	md.results.TransientSolution[2].Vz,\
@@ -65,7 +65,7 @@
 	md.results.TransientSolution[2].Base,\
 	md.results.TransientSolution[2].Surface,\
 	md.results.TransientSolution[2].Thickness,\
-	md.results.TransientSolution[2].SurfaceforcingsMassBalance,\
+	md.results.TransientSolution[2].SmbMassBalance,\
 	md.results.TransientSolution[3].Vx,\
 	md.results.TransientSolution[3].Vy,\
 	md.results.TransientSolution[3].Vz,\
@@ -74,5 +74,5 @@
 	md.results.TransientSolution[3].Base,\
 	md.results.TransientSolution[3].Surface,\
 	md.results.TransientSolution[3].Thickness,\
-	md.results.TransientSolution[3].SurfaceforcingsMassBalance,\
+	md.results.TransientSolution[3].SmbMassBalance,\
 	]

Modified: issm/trunk/test/NightlyRun/test231.m
===================================================================
--- issm/trunk/test/NightlyRun/test231.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/NightlyRun/test231.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -14,17 +14,17 @@
 smb=ones(md.mesh.numberofvertices,1)*3.6;
 smb=[ smb smb*2. ];
 
-md.surfaceforcings.mass_balance=smb;
-md.surfaceforcings.mass_balance(end+1,:)=[1.5 3.];
+md.smb.mass_balance=smb;
+md.smb.mass_balance(end+1,:)=[1.5 3.];
 md.transient.isthermal=0;
 
 md=solve(md,TransientSolutionEnum());
 
 %Fields and tolerances to track changes
-field_names     ={'Vx1','Vy1','Vz1','Vel1','Pressure1','Bed1','Surface1','Thickness1','SurfaceforcingsMassBalance1', ...
-	'Vx2','Vy2','Vz2','Vel2','Pressure2','Bed2','Surface2','Thickness2','SurfaceforcingsMassBalance2', ...
-	'Vx3','Vy3','Vz3','Vel3','Pressure3','Bed3','Surface3','Thickness3','SurfaceforcingsMassBalance3', ...
-	'Vx4','Vy4','Vz4','Vel4','Pressure4','Bed4','Surface4','Thickness4','SurfaceforcingsMassbalance4'};
+field_names     ={'Vx1','Vy1','Vz1','Vel1','Pressure1','Bed1','Surface1','Thickness1','SmbMassBalance1', ...
+	'Vx2','Vy2','Vz2','Vel2','Pressure2','Bed2','Surface2','Thickness2','SmbMassBalance2', ...
+	'Vx3','Vy3','Vz3','Vel3','Pressure3','Bed3','Surface3','Thickness3','SmbMassBalance3', ...
+	'Vx4','Vy4','Vz4','Vel4','Pressure4','Bed4','Surface4','Thickness4','SmbMassbalance4'};
 field_tolerances={1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,...
 	1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,...
 	1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,...
@@ -38,7 +38,7 @@
 	(md.results.TransientSolution(1).Base),...
 	(md.results.TransientSolution(1).Surface),...
 	(md.results.TransientSolution(1).Thickness),...
-	(md.results.TransientSolution(1).SurfaceforcingsMassBalance),...
+	(md.results.TransientSolution(1).SmbMassBalance),...
 	(md.results.TransientSolution(2).Vx),...
 	(md.results.TransientSolution(2).Vy),...
 	(md.results.TransientSolution(2).Vz),...
@@ -47,7 +47,7 @@
 	(md.results.TransientSolution(2).Base),...
 	(md.results.TransientSolution(2).Surface),...
 	(md.results.TransientSolution(2).Thickness),...
-	(md.results.TransientSolution(2).SurfaceforcingsMassBalance),...
+	(md.results.TransientSolution(2).SmbMassBalance),...
 	(md.results.TransientSolution(3).Vx),...
 	(md.results.TransientSolution(3).Vy),...
 	(md.results.TransientSolution(3).Vz),...
@@ -56,7 +56,7 @@
 	(md.results.TransientSolution(3).Base),...
 	(md.results.TransientSolution(3).Surface),...
 	(md.results.TransientSolution(3).Thickness),...
-	(md.results.TransientSolution(3).SurfaceforcingsMassBalance),...
+	(md.results.TransientSolution(3).SmbMassBalance),...
 	(md.results.TransientSolution(4).Vx),...
 	(md.results.TransientSolution(4).Vy),...
 	(md.results.TransientSolution(4).Vz),...
@@ -65,5 +65,5 @@
 	(md.results.TransientSolution(4).Base),...
 	(md.results.TransientSolution(4).Surface),...
 	(md.results.TransientSolution(4).Thickness),...
-	(md.results.TransientSolution(4).SurfaceforcingsMassBalance),...
+	(md.results.TransientSolution(4).SmbMassBalance),...
 	};

Modified: issm/trunk/test/NightlyRun/test231.py
===================================================================
--- issm/trunk/test/NightlyRun/test231.py	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/NightlyRun/test231.py	2016-04-13 04:32:01 UTC (rev 20500)
@@ -24,16 +24,16 @@
 smb=numpy.ones((md.mesh.numberofvertices,1))*3.6
 smb=numpy.hstack((smb,smb*2.))
 
-md.surfaceforcings.mass_balance=numpy.vstack((smb,[1.5,3.]))
+md.smb.mass_balance=numpy.vstack((smb,[1.5,3.]))
 md.transient.isthermal=False
 
 md=solve(md,TransientSolutionEnum())
 
 #Fields and tolerances to track changes
-field_names     =['Vx1','Vy1','Vz1','Vel1','Pressure1','Bed1','Surface1','Thickness1','SurfaceforcingsMassBalance1', \
-	'Vx2','Vy2','Vz2','Vel2','Pressure2','Bed2','Surface2','Thickness2','SurfaceforcingsMassBalance2', \
-	'Vx3','Vy3','Vz3','Vel3','Pressure3','Bed3','Surface3','Thickness3','SurfaceforcingsMassBalance3', \
-	'Vx4','Vy4','Vz4','Vel4','Pressure4','Bed4','Surface4','Thickness4','SurfaceforcingsMassbalance4']
+field_names     =['Vx1','Vy1','Vz1','Vel1','Pressure1','Bed1','Surface1','Thickness1','SmbMassBalance1', \
+	'Vx2','Vy2','Vz2','Vel2','Pressure2','Bed2','Surface2','Thickness2','SmbMassBalance2', \
+	'Vx3','Vy3','Vz3','Vel3','Pressure3','Bed3','Surface3','Thickness3','SmbMassBalance3', \
+	'Vx4','Vy4','Vz4','Vel4','Pressure4','Bed4','Surface4','Thickness4','SmbMassbalance4']
 field_tolerances=[1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,\
 	1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,\
 	1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,\
@@ -47,7 +47,7 @@
 	md.results.TransientSolution[0].Base,\
 	md.results.TransientSolution[0].Surface,\
 	md.results.TransientSolution[0].Thickness,\
-	md.results.TransientSolution[0].SurfaceforcingsMassBalance,\
+	md.results.TransientSolution[0].SmbMassBalance,\
 	md.results.TransientSolution[1].Vx,\
 	md.results.TransientSolution[1].Vy,\
 	md.results.TransientSolution[1].Vz,\
@@ -56,7 +56,7 @@
 	md.results.TransientSolution[1].Base,\
 	md.results.TransientSolution[1].Surface,\
 	md.results.TransientSolution[1].Thickness,\
-	md.results.TransientSolution[1].SurfaceforcingsMassBalance,\
+	md.results.TransientSolution[1].SmbMassBalance,\
 	md.results.TransientSolution[2].Vx,\
 	md.results.TransientSolution[2].Vy,\
 	md.results.TransientSolution[2].Vz,\
@@ -65,7 +65,7 @@
 	md.results.TransientSolution[2].Base,\
 	md.results.TransientSolution[2].Surface,\
 	md.results.TransientSolution[2].Thickness,\
-	md.results.TransientSolution[2].SurfaceforcingsMassBalance,\
+	md.results.TransientSolution[2].SmbMassBalance,\
 	md.results.TransientSolution[3].Vx,\
 	md.results.TransientSolution[3].Vy,\
 	md.results.TransientSolution[3].Vz,\
@@ -74,5 +74,5 @@
 	md.results.TransientSolution[3].Base,\
 	md.results.TransientSolution[3].Surface,\
 	md.results.TransientSolution[3].Thickness,\
-	md.results.TransientSolution[3].SurfaceforcingsMassBalance,\
+	md.results.TransientSolution[3].SmbMassBalance,\
 	]

Modified: issm/trunk/test/NightlyRun/test232.m
===================================================================
--- issm/trunk/test/NightlyRun/test232.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/NightlyRun/test232.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -10,6 +10,7 @@
 md.timestepping.final_time=4;
 md.transient.isstressbalance=0;
 md.transient.ismasstransport=0;
+md.transient.issmb=1;
 md.transient.isthermal=1;
 md.transient.isgroundingline=0;
 md=solve(md,TransientSolutionEnum());

Modified: issm/trunk/test/NightlyRun/test232.py
===================================================================
--- issm/trunk/test/NightlyRun/test232.py	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/NightlyRun/test232.py	2016-04-13 04:32:01 UTC (rev 20500)
@@ -20,6 +20,7 @@
 md.timestepping.final_time=4.
 md.transient.isstressbalance=False
 md.transient.ismasstransport=False
+md.transient.issmb=True
 md.transient.isthermal=True
 md.transient.isgroundingline=False
 md=solve(md,TransientSolutionEnum())

Modified: issm/trunk/test/NightlyRun/test233.m
===================================================================
--- issm/trunk/test/NightlyRun/test233.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/NightlyRun/test233.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -17,7 +17,7 @@
 	'Vx4','Vy4','Vz4','Vel4','Pressure4','Bed4','Surface4','Thickness4','Temperature4','BasalforcingsGroundediceMeltingRate4'};
 field_tolerances={1e-09,1e-09,1e-09,1e-09,1e-09,1e-09,1e-09,1e-09,1e-09,1e-09, ...
 	1e-09,1e-09,1e-08,1e-09,1e-09,1e-09,1e-09,1e-09,1e-09,1e-06, ...
-	1e-09,1e-09,1e-08,1e-09,1e-09,1e-09,1e-09,1e-09,1e-09,1e-06, ...
+	1e-08,1e-09,1e-08,1e-09,1e-09,1e-09,1e-09,1e-09,1e-09,1e-06, ...
 	1e-09,1e-09,1e-08,1e-09,1e-09,1e-09,1e-09,1e-09,1e-09,1e-06};
 field_values={...
 	(md.results.TransientSolution(1).Vx),...

Modified: issm/trunk/test/NightlyRun/test233.py
===================================================================
--- issm/trunk/test/NightlyRun/test233.py	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/NightlyRun/test233.py	2016-04-13 04:32:01 UTC (rev 20500)
@@ -27,7 +27,7 @@
 	'Vx4','Vy4','Vz4','Vel4','Pressure4','Bed4','Surface4','Thickness4','Temperature4','BasalforcingsGroundediceMeltingRate4']
 field_tolerances=[1e-09,1e-09,1e-09,1e-09,1e-09,1e-09,1e-09,1e-09,1e-09,1e-09, \
 	1e-09,1e-09,1e-08,1e-09,1e-09,1e-09,1e-09,1e-09,1e-09,1e-06, \
-	1e-09,1e-09,1e-08,1e-09,1e-09,1e-09,1e-09,1e-09,1e-09,1e-06, \
+	1e-08,1e-09,1e-08,1e-09,1e-09,1e-09,1e-09,1e-09,1e-09,1e-06, \
 	1e-09,1e-09,1e-08,1e-09,1e-09,1e-09,1e-09,1e-09,1e-09,1e-06]
 field_values=[\
 	md.results.TransientSolution[0].Vx,\

Modified: issm/trunk/test/NightlyRun/test234.m
===================================================================
--- issm/trunk/test/NightlyRun/test234.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/NightlyRun/test234.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -12,18 +12,21 @@
 smb = ones(md.mesh.numberofvertices,1)*3.6;
 smb=[ smb smb*-1 ];
 
-md.surfaceforcings.mass_balance= smb;
-md.surfaceforcings.mass_balance(end+1,:)=[1.5 3];
+md.smb.mass_balance= smb;
+md.smb.mass_balance(end+1,:)=[1.5 3];
 md.transient.isthermal=0;
 %Dakota options
 
+%dakota version
+version=IssmConfig('_DAKOTA_VERSION_'); version=version(1:3); version=str2num(version);
+
 %partitioning
 md.qmu.numberofpartitions=20;
 md=partitioner(md,'package','chaco','npart',md.qmu.numberofpartitions,'weighting','on');
 md.qmu.partition=md.qmu.partition-1;
 
 %variables
-md.qmu.variables.surface_mass_balance=normal_uncertain('scaled_SurfaceforcingsMassBalance',1,0.1);
+md.qmu.variables.surface_mass_balance=normal_uncertain('scaled_SmbMassBalance',1,0.1);
 
 %responses
 md.qmu.responses.MaxVel=response_function('MaxVel',[],[0.0001 0.001 0.01 0.25 0.5 0.75 0.99 0.999 0.9999]);
@@ -49,13 +52,21 @@
 
 %parameters
 md.qmu.params.direct=true;
-md.qmu.params.analysis_driver='';
 md.qmu.params.analysis_components='';
-md.qmu.params.evaluation_concurrency=1;
 md.qmu.params.interval_type='forward';
 md.qmu.params.tabular_graphics_data=true;
 md.qmu.isdakota=1;
 
+if version>=6,
+	md.qmu.params.analysis_driver='matlab';
+	md.qmu.params.evaluation_scheduling='master';
+	md.qmu.params.processors_per_evaluation=2;
+else
+	md.qmu.params.analysis_driver='stressbalance';
+	md.qmu.params.evaluation_concurrency=1;
+end
+
+
 md.stressbalance.reltol=10^-5; %tighten for qmu analyses
 md.transient.requested_outputs={'IceVolume'};
 

Modified: issm/trunk/test/NightlyRun/test235.m
===================================================================
--- issm/trunk/test/NightlyRun/test235.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/NightlyRun/test235.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -12,18 +12,21 @@
 smb = ones(md.mesh.numberofvertices,1)*3.6;
 smb=[ smb smb*-1 ];
 
-md.surfaceforcings.mass_balance= smb;
-md.surfaceforcings.mass_balance(end+1,:)=[1.5 3];
+md.smb.mass_balance= smb;
+md.smb.mass_balance(end+1,:)=[1.5 3];
 md.transient.isthermal=0;
 %Dakota options
 
+%dakota version
+version=IssmConfig('_DAKOTA_VERSION_'); version=version(1:3); version=str2num(version);
+
 %partitioning
 md.qmu.numberofpartitions=20;
 md=partitioner(md,'package','chaco','npart',md.qmu.numberofpartitions,'weighting','on');
 md.qmu.partition=md.qmu.partition-1;
 
 %variables
-md.qmu.variables.surface_mass_balance=normal_uncertain('scaled_SurfaceforcingsMassBalance',1,100);
+md.qmu.variables.surface_mass_balance=normal_uncertain('scaled_SmbMassBalance',1,100);
 
 %responses
 md.qmu.responses.MaxVel=response_function('MaxVel',[],[0.0001 0.001 0.01 0.25 0.5 0.75 0.99 0.999 0.9999]);
@@ -44,13 +47,21 @@
 
 %parameters
 md.qmu.params.direct=true;
-md.qmu.params.analysis_driver='';
 md.qmu.params.analysis_components='';
-md.qmu.params.evaluation_concurrency=1;
 md.qmu.params.interval_type='forward';
 md.qmu.params.fd_gradient_step_size='0.1';
 md.qmu.isdakota=1;
 
+if version>=6,
+	md.qmu.params.analysis_driver='matlab';
+	md.qmu.params.evaluation_scheduling='master';
+	md.qmu.params.processors_per_evaluation=2;
+else
+	md.qmu.params.analysis_driver='stressbalance';
+	md.qmu.params.evaluation_concurrency=1;
+end
+
+
 md.stressbalance.reltol=10^-5; %tighten for qmu analyses
 md.transient.requested_outputs={'IceVolume'};
 

Modified: issm/trunk/test/NightlyRun/test236.m
===================================================================
--- issm/trunk/test/NightlyRun/test236.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/NightlyRun/test236.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -6,56 +6,57 @@
 %md.verbose=verbose('all');
 
 % Use of ispdd and isdelta18o methods
-md.surfaceforcings = SMBpdd();
-md.surfaceforcings.isdelta18o=1;
-md.surfaceforcings.ismungsm=0;
+md.smb = SMBpdd();
+md.smb.isdelta18o=1;
+md.smb.ismungsm=0;
 
-%md.surfaceforcings.precipitation(1:md.mesh.numberofvertices,1:12)=0;
-%md.surfaceforcings.monthlytemperatures(1:md.mesh.numberofvertices,1:12)=273;
+%md.smb.precipitation(1:md.mesh.numberofvertices,1:12)=0;
+%md.smb.monthlytemperatures(1:md.mesh.numberofvertices,1:12)=273;
 
 % Add temperature, precipitation and delta18o needed to measure the surface mass balance
 %  creating delta18o
 load '../Data/delta18o.data'
-md.surfaceforcings.delta18o=delta18o;
+md.smb.delta18o=delta18o;
 % creating delta18oSurface
-md.surfaceforcings.delta18o_surface(1,1:(length(delta18o))) = 0;
-md.surfaceforcings.delta18o_surface(2,:) = delta18o(2,:);
+md.smb.delta18o_surface(1,1:(length(delta18o))) = 0;
+md.smb.delta18o_surface(2,:) = delta18o(2,:);
 
 % creating Present day and lgm temperatures
 % Same temperature over the all region:
 tmonth(1:12)=238.15+20.;
 for imonth=0:11
-    md.surfaceforcings.temperatures_presentday(1:md.mesh.numberofvertices,imonth+1)=tmonth(imonth+1);
-    md.surfaceforcings.temperatures_lgm(1:md.mesh.numberofvertices,imonth+1)=tmonth(imonth+1)-20.;
+    md.smb.temperatures_presentday(1:md.mesh.numberofvertices,imonth+1)=tmonth(imonth+1);
+    md.smb.temperatures_lgm(1:md.mesh.numberofvertices,imonth+1)=tmonth(imonth+1)-20.;
     % Time for the last line:
-    md.surfaceforcings.temperatures_presentday(md.mesh.numberofvertices+1,imonth+1)=((imonth+1)/12);
-    md.surfaceforcings.temperatures_lgm(md.mesh.numberofvertices+1,imonth+1)=((imonth+1)/12);
+    md.smb.temperatures_presentday(md.mesh.numberofvertices+1,imonth+1)=((imonth+1)/12);
+    md.smb.temperatures_lgm(md.mesh.numberofvertices+1,imonth+1)=((imonth+1)/12);
 end
 
 % creating initialization and spc temperatures initialization and
 % spc
-md.thermal.spctemperature=mean(md.surfaceforcings.temperatures_lgm(1:md.mesh.numberofvertices,1:12),2); %-10*ones(md.mesh.numberofvertices,1);
+md.thermal.spctemperature=mean(md.smb.temperatures_lgm(1:md.mesh.numberofvertices,1:12),2); %-10*ones(md.mesh.numberofvertices,1);
 md.thermal.spctemperature=repmat(md.thermal.spctemperature,1,md.timestepping.final_time/md.timestepping.time_step);
 itemp=0:md.timestepping.time_step:md.timestepping.final_time-md.timestepping.time_step;
 md.thermal.spctemperature(md.mesh.numberofvertices+1,:)=itemp;
 
-md.initialization.temperature=md.surfaceforcings.temperatures_lgm(1:md.mesh.numberofvertices,1); %*ones(md.mesh.numberofvertices,1);
+md.initialization.temperature=md.smb.temperatures_lgm(1:md.mesh.numberofvertices,1); %*ones(md.mesh.numberofvertices,1);
+md.smb = initialize(md.smb,md);
 
 % creating precipitation
 for imonth=0:11
-    md.surfaceforcings.precipitations_presentday(1:md.mesh.numberofvertices,imonth+1)=-0.4*10^(-6)*md.mesh.y+0.5;
-    md.surfaceforcings.precipitations_lgm(1:md.mesh.numberofvertices,imonth+1)=-0.4*10^(-6)*md.mesh.y+0.5;
+    md.smb.precipitations_presentday(1:md.mesh.numberofvertices,imonth+1)=-0.4*10^(-6)*md.mesh.y+0.5;
+    md.smb.precipitations_lgm(1:md.mesh.numberofvertices,imonth+1)=-0.4*10^(-6)*md.mesh.y+0.5;
     % Time for the last line:
-    md.surfaceforcings.precipitations_presentday(md.mesh.numberofvertices+1,imonth+1)=((imonth+1)/12);
-    md.surfaceforcings.precipitations_lgm(md.mesh.numberofvertices+1,imonth+1)=((imonth+1)/12);
+    md.smb.precipitations_presentday(md.mesh.numberofvertices+1,imonth+1)=((imonth+1)/12);
+    md.smb.precipitations_lgm(md.mesh.numberofvertices+1,imonth+1)=((imonth+1)/12);
 end
 
 % Interpolation factors
-md.surfaceforcings.Tdiff(1,1:md.timestepping.final_time)=0.5;
-md.surfaceforcings.sealev(1,1:md.timestepping.final_time)=0.5;
+md.smb.Tdiff(1,1:md.timestepping.final_time)=0.5;
+md.smb.sealev(1,1:md.timestepping.final_time)=0.5;
 % Year of each data point
-md.surfaceforcings.Tdiff(2,1:md.timestepping.final_time)=1:1:md.timestepping.final_time;
-md.surfaceforcings.sealev(2,1:md.timestepping.final_time)=1:1:md.timestepping.final_time;
+md.smb.Tdiff(2,1:md.timestepping.final_time)=1:1:md.timestepping.final_time;
+md.smb.sealev(2,1:md.timestepping.final_time)=1:1:md.timestepping.final_time;
 
 % time steps and resolution
 md.timestepping.time_step=20;
@@ -63,16 +64,18 @@
 md.timestepping.final_time=60;
 
 % 
-md.transient.requested_outputs={'default','SurfaceforcingsMonthlytemperatures'};
+md.transient.requested_outputs={'default','SmbMonthlytemperatures'};
 md=setflowequation(md,'SSA','all');
 md.cluster=generic('name',oshostname(),'np',1); % 3 for the cluster
 md=solve(md,TransientSolutionEnum());
 
 %Fields and tolerances to track changes
-field_names     ={'Vx1','Vy1','Vel1','Pressure1','Bed1','Surface1','Thickness1','Vx2','Vy2','Vel2','Pressure2','Bed2','Surface2','Thickness2','Vx3','Vy3','Vel3','Pressure3','Bed3','Surface3','Thickness3'};
-field_tolerances={1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,...
-	1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,...
-	1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13};
+field_names     ={'Vx1','Vy1','Vel1','Pressure1','Bed1','Surface1','Thickness1','SmbMonthlytemperatures1','SmbMassBalance1',...
+	   'Vx2','Vy2','Vel2','Pressure2','Bed2','Surface2','Thickness2','SmbMonthlytemperatures2','SmbMassBalance2',...
+	   'Vx3','Vy3','Vel3','Pressure3','Bed3','Surface3','Thickness3','SmbMonthlytemperatures3','SmbMassBalance3'};
+field_tolerances={1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,...
+	1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,...
+	1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13};
 field_values={...
 	(md.results.TransientSolution(1).Vx),...
 	(md.results.TransientSolution(1).Vy),...
@@ -81,8 +84,8 @@
 	(md.results.TransientSolution(1).Base),...
 	(md.results.TransientSolution(1).Surface),...
 	(md.results.TransientSolution(1).Thickness),...
-	(md.results.TransientSolution(1).SurfaceforcingsMonthlytemperatures),...
-	(md.results.TransientSolution(1).SurfaceforcingsMassBalance),...
+	(md.results.TransientSolution(1).SmbMonthlytemperatures),...
+	(md.results.TransientSolution(1).SmbMassBalance),...
 	(md.results.TransientSolution(2).Vx),...
 	(md.results.TransientSolution(2).Vy),...
 	(md.results.TransientSolution(2).Vel),...
@@ -90,8 +93,8 @@
 	(md.results.TransientSolution(2).Base),...
 	(md.results.TransientSolution(2).Surface),...
 	(md.results.TransientSolution(2).Thickness),...
-	(md.results.TransientSolution(2).SurfaceforcingsMonthlytemperatures),...
-	(md.results.TransientSolution(2).SurfaceforcingsMassBalance),...
+	(md.results.TransientSolution(2).SmbMonthlytemperatures),...
+	(md.results.TransientSolution(2).SmbMassBalance),...
 	(md.results.TransientSolution(3).Vx),...
 	(md.results.TransientSolution(3).Vy),...
 	(md.results.TransientSolution(3).Vel),...
@@ -99,6 +102,6 @@
 	(md.results.TransientSolution(3).Base),...
 	(md.results.TransientSolution(3).Surface),...
 	(md.results.TransientSolution(3).Thickness),...
-	(md.results.TransientSolution(3).SurfaceforcingsMonthlytemperatures),...
-	(md.results.TransientSolution(3).SurfaceforcingsMassBalance),...
+	(md.results.TransientSolution(3).SmbMonthlytemperatures),...
+	(md.results.TransientSolution(3).SmbMassBalance),...
 	};

Modified: issm/trunk/test/NightlyRun/test236.py
===================================================================
--- issm/trunk/test/NightlyRun/test236.py	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/NightlyRun/test236.py	2016-04-13 04:32:01 UTC (rev 20500)
@@ -14,53 +14,54 @@
 md=parameterize(md,'../Par/SquareShelf.py')
 
 # Use of ispdd and isdelta18o methods
-md.surfaceforcings = SMBpdd();
-md.surfaceforcings.isdelta18o=1
-md.surfaceforcings.ismungsm=0
+md.smb = SMBpdd();
+md.smb.isdelta18o=1
+md.smb.ismungsm=0
 
 # Add temperature, precipitation and delta18o needed to measure the surface mass balance
 # creating delta18o
 delta18o=numpy.loadtxt('../Data/delta18o.data')
-md.surfaceforcings.delta18o=delta18o
+md.smb.delta18o=delta18o
 # creating delta18oSurface
-md.surfaceforcings.delta18o_surface = numpy.zeros((2,numpy.size(delta18o,axis=1)))
-md.surfaceforcings.delta18o_surface[1,:] = delta18o[1,:]
+md.smb.delta18o_surface = numpy.zeros((2,numpy.size(delta18o,axis=1)))
+md.smb.delta18o_surface[1,:] = delta18o[1,:]
 
 # creating Present day and lgm temperatures
 # Same temperature over the all region:
 tmonth=numpy.ones(12)*(238.15+20.)
-md.surfaceforcings.temperatures_presentday=numpy.zeros((md.mesh.numberofvertices+1,12))
-md.surfaceforcings.temperatures_lgm=numpy.zeros((md.mesh.numberofvertices+1,12))
+md.smb.temperatures_presentday=numpy.zeros((md.mesh.numberofvertices+1,12))
+md.smb.temperatures_lgm=numpy.zeros((md.mesh.numberofvertices+1,12))
 for imonth in xrange(0,12):
-    md.surfaceforcings.temperatures_presentday[0:md.mesh.numberofvertices,imonth]=tmonth[imonth]
-    md.surfaceforcings.temperatures_lgm[0:md.mesh.numberofvertices,imonth]=tmonth[imonth]-20.
+    md.smb.temperatures_presentday[0:md.mesh.numberofvertices,imonth]=tmonth[imonth]
+    md.smb.temperatures_lgm[0:md.mesh.numberofvertices,imonth]=tmonth[imonth]-20.
     # Time for the last line:
-    md.surfaceforcings.temperatures_presentday[md.mesh.numberofvertices,imonth]=((float(imonth)+1.)/12.)
-    md.surfaceforcings.temperatures_lgm[md.mesh.numberofvertices,imonth]=((float(imonth)+1.)/12.)
+    md.smb.temperatures_presentday[md.mesh.numberofvertices,imonth]=((float(imonth)+1.)/12.)
+    md.smb.temperatures_lgm[md.mesh.numberofvertices,imonth]=((float(imonth)+1.)/12.)
 
 # creating initialization and spc temperatures initialization and spc
-md.thermal.spctemperature=numpy.mean(md.surfaceforcings.temperatures_lgm[0:md.mesh.numberofvertices,:],axis=1).reshape(-1,1)    #-10*ones(md.mesh.numberofvertices,1)
+md.thermal.spctemperature=numpy.mean(md.smb.temperatures_lgm[0:md.mesh.numberofvertices,:],axis=1).reshape(-1,1)    #-10*ones(md.mesh.numberofvertices,1)
 md.thermal.spctemperature=numpy.tile(md.thermal.spctemperature,(1,md.timestepping.final_time/md.timestepping.time_step))
 itemp=numpy.arange(0,md.timestepping.final_time,md.timestepping.time_step)
 md.thermal.spctemperature=numpy.vstack((md.thermal.spctemperature,itemp.reshape(1,-1)))
 
-md.initialization.temperature=md.surfaceforcings.temperatures_lgm[0:md.mesh.numberofvertices,0]    #*ones(md.mesh.numberofvertices,1)
+md.initialization.temperature=md.smb.temperatures_lgm[0:md.mesh.numberofvertices,0]    #*ones(md.mesh.numberofvertices,1)
+md.smb.initialize(md)
 
 # creating precipitation
-md.surfaceforcings.precipitations_presentday=numpy.zeros((md.mesh.numberofvertices+1,12))
-md.surfaceforcings.precipitations_lgm=numpy.zeros((md.mesh.numberofvertices+1,12))
+md.smb.precipitations_presentday=numpy.zeros((md.mesh.numberofvertices+1,12))
+md.smb.precipitations_lgm=numpy.zeros((md.mesh.numberofvertices+1,12))
 for imonth in xrange(0,12):
-    md.surfaceforcings.precipitations_presentday[0:md.mesh.numberofvertices,imonth]=-0.4*10**(-6)*md.mesh.y+0.5
-    md.surfaceforcings.precipitations_presentday[md.mesh.numberofvertices,imonth]=((float(imonth)+1.)/12.)
-    md.surfaceforcings.precipitations_lgm[0:md.mesh.numberofvertices,imonth]=-0.4*10**(-6)*md.mesh.y+0.5
-    md.surfaceforcings.precipitations_lgm[md.mesh.numberofvertices,imonth]=((float(imonth)+1.)/12.)
+    md.smb.precipitations_presentday[0:md.mesh.numberofvertices,imonth]=-0.4*10**(-6)*md.mesh.y+0.5
+    md.smb.precipitations_presentday[md.mesh.numberofvertices,imonth]=((float(imonth)+1.)/12.)
+    md.smb.precipitations_lgm[0:md.mesh.numberofvertices,imonth]=-0.4*10**(-6)*md.mesh.y+0.5
+    md.smb.precipitations_lgm[md.mesh.numberofvertices,imonth]=((float(imonth)+1.)/12.)
 
 # Interpolation factors
-md.surfaceforcings.Tdiff=0.5*numpy.ones((2,md.timestepping.final_time))
-md.surfaceforcings.sealev=0.5*numpy.ones((2,md.timestepping.final_time))
+md.smb.Tdiff=0.5*numpy.ones((2,md.timestepping.final_time))
+md.smb.sealev=0.5*numpy.ones((2,md.timestepping.final_time))
 # Year of each data point
-md.surfaceforcings.Tdiff[1,1:md.timestepping.final_time]=numpy.arange(1.,md.timestepping.final_time)
-md.surfaceforcings.sealev[1,1:md.timestepping.final_time]=numpy.arange(1.,md.timestepping.final_time)
+md.smb.Tdiff[1,1:md.timestepping.final_time]=numpy.arange(1.,md.timestepping.final_time)
+md.smb.sealev[1,1:md.timestepping.final_time]=numpy.arange(1.,md.timestepping.final_time)
 
 # time steps and resolution
 md.timestepping.time_step=20.
@@ -68,16 +69,18 @@
 
 
 # 
-md.transient.requested_outputs=['default','SurfaceforcingsMonthlytemperatures']
+md.transient.requested_outputs=['default','SmbMonthlytemperatures']
 md=setflowequation(md,'SSA','all')
 md.cluster=generic('name',oshostname(),'np',3)
 md=solve(md,TransientSolutionEnum())
 
 #Fields and tolerances to track changes
-field_names     =['Vx1','Vy1','Vel1','Pressure1','Bed1','Surface1','Thickness1','Vx2','Vy2','Vel2','Pressure2','Bed2','Surface2','Thickness2','Vx3','Vy3','Vel3','Pressure3','Bed3','Surface3','Thickness3']
-field_tolerances=[1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,\
-	1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,\
-	1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13]
+field_names     =['Vx1','Vy1','Vel1','Pressure1','Bed1','Surface1','Thickness1','SmbMonthlytemperatures1','SmbMassBalance1',\
+		            'Vx2','Vy2','Vel2','Pressure2','Bed2','Surface2','Thickness2','SmbMonthlytemperatures2','SmbMassBalance2',\
+				      'Vx3','Vy3','Vel3','Pressure3','Bed3','Surface3','Thickness3','SmbMonthlytemperatures3','SmbMassBalance3'];
+field_tolerances=[1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,\
+		            1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,\
+			         1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13];
 field_values=[\
 	md.results.TransientSolution[0].Vx,\
 	md.results.TransientSolution[0].Vy,\
@@ -86,8 +89,8 @@
 	md.results.TransientSolution[0].Base,\
 	md.results.TransientSolution[0].Surface,\
 	md.results.TransientSolution[0].Thickness,\
-	md.results.TransientSolution[0].SurfaceforcingsMonthlytemperatures,\
-	md.results.TransientSolution[0].SurfaceforcingsMassBalance,\
+	md.results.TransientSolution[0].SmbMonthlytemperatures,\
+	md.results.TransientSolution[0].SmbMassBalance,\
 	md.results.TransientSolution[1].Vx,\
 	md.results.TransientSolution[1].Vy,\
 	md.results.TransientSolution[1].Vel,\
@@ -95,8 +98,8 @@
 	md.results.TransientSolution[1].Base,\
 	md.results.TransientSolution[1].Surface,\
 	md.results.TransientSolution[1].Thickness,\
-	md.results.TransientSolution[1].SurfaceforcingsMonthlytemperatures,\
-	md.results.TransientSolution[1].SurfaceforcingsMassBalance,\
+	md.results.TransientSolution[1].SmbMonthlytemperatures,\
+	md.results.TransientSolution[1].SmbMassBalance,\
 	md.results.TransientSolution[2].Vx,\
 	md.results.TransientSolution[2].Vy,\
 	md.results.TransientSolution[2].Vel,\
@@ -104,6 +107,6 @@
 	md.results.TransientSolution[2].Base,\
 	md.results.TransientSolution[2].Surface,\
 	md.results.TransientSolution[2].Thickness,\
-	md.results.TransientSolution[2].SurfaceforcingsMonthlytemperatures,\
-	md.results.TransientSolution[2].SurfaceforcingsMassBalance,\
+	md.results.TransientSolution[2].SmbMonthlytemperatures,\
+	md.results.TransientSolution[2].SmbMassBalance,\
 	]

Modified: issm/trunk/test/NightlyRun/test237.m
===================================================================
--- issm/trunk/test/NightlyRun/test237.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/NightlyRun/test237.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -6,67 +6,56 @@
 %md.verbose=verbose('all');
 
 % Use of ispdd methods
-md.surfaceforcings = SMBpdd();
-md.surfaceforcings.isdelta18o=0;
-md.surfaceforcings.ismungsm=1;
+md.smb = SMBpdd();
+md.smb.isdelta18o=0;
+md.smb.ismungsm=1;
 
-if md.surfaceforcings.isdelta18o==0 & md.surfaceforcings.ismungsm==0
-    md.surfaceforcings.precipitation=zeros(md.mesh.numberofvertices,1);
-    md.surfaceforcings.monthlytemperatures=273*ones(md.mesh.numberofvertices,1);
-end
-    
+% time steps and resolution
+md.timestepping.time_step=20;
+md.settings.output_frequency=1;
+md.timestepping.final_time=60;
 
-% Add temperature, precipitation and delta18o needed to measure the surface mass balance
-% % creating delta18o
-% load '../Data/delta18o.data'
-% md.surfaceforcings.delta18o=delta18o;
-% % creating delta18oSurface
-% md.surfaceforcings.delta18o_surface(1,1:(length(delta18o))) = 0;
-% md.surfaceforcings.delta18o_surface(2,:) = delta18o(2,:);
-
 % creating Present day and lgm temperatures
 % Same temperature over the all region:
 tmonth(1:12)=238.15+20.;
 for imonth=0:11
-    md.surfaceforcings.temperatures_presentday(1:md.mesh.numberofvertices,imonth+1)=tmonth(imonth+1);
-    md.surfaceforcings.temperatures_lgm(1:md.mesh.numberofvertices,imonth+1)=tmonth(imonth+1)-20.;
+    md.smb.temperatures_presentday(1:md.mesh.numberofvertices,imonth+1)=tmonth(imonth+1);
+    md.smb.temperatures_lgm(1:md.mesh.numberofvertices,imonth+1)=tmonth(imonth+1)-20.;
     % Time for the last line:
-    md.surfaceforcings.temperatures_presentday(md.mesh.numberofvertices+1,imonth+1)=((imonth+1)/12);
-    md.surfaceforcings.temperatures_lgm(md.mesh.numberofvertices+1,imonth+1)=((imonth+1)/12);
+    md.smb.temperatures_presentday(md.mesh.numberofvertices+1,imonth+1)=((imonth+1)/12);
+    md.smb.temperatures_lgm(md.mesh.numberofvertices+1,imonth+1)=((imonth+1)/12);
 end
 
 % creating initialization and spc temperatures initialization and spc
-md.thermal.spctemperature=mean(md.surfaceforcings.temperatures_lgm(1:md.mesh.numberofvertices,1:12),2); %-10*ones(md.mesh.numberofvertices,1);
+md.thermal.spctemperature=mean(md.smb.temperatures_lgm(1:md.mesh.numberofvertices,1:12),2); %-10*ones(md.mesh.numberofvertices,1);
 md.thermal.spctemperature=repmat(md.thermal.spctemperature,1,md.timestepping.final_time/md.timestepping.time_step);
 itemp=0:md.timestepping.time_step:md.timestepping.final_time-md.timestepping.time_step;
 md.thermal.spctemperature(md.mesh.numberofvertices+1,:)=itemp;
 
-md.initialization.temperature=md.surfaceforcings.temperatures_lgm(1:md.mesh.numberofvertices,1); %*ones(md.mesh.numberofvertices,1);
+md.initialization.temperature=md.smb.temperatures_lgm(1:md.mesh.numberofvertices,1); %*ones(md.mesh.numberofvertices,1);
+md.smb = initialize(md.smb,md);
 
 % creating precipitation
 for imonth=0:11
-    md.surfaceforcings.precipitations_presentday(1:md.mesh.numberofvertices,imonth+1)=-0.4*10^(-6)*md.mesh.y+0.5;
-    md.surfaceforcings.precipitations_lgm(1:md.mesh.numberofvertices,imonth+1)=-0.4*10^(-6)*md.mesh.y+0.5;
+    md.smb.precipitations_presentday(1:md.mesh.numberofvertices,imonth+1)=-0.4*10^(-6)*md.mesh.y+0.5;
+    md.smb.precipitations_lgm(1:md.mesh.numberofvertices,imonth+1)=-0.4*10^(-6)*md.mesh.y+0.5;
     % Time for the last line:
-    md.surfaceforcings.precipitations_presentday(md.mesh.numberofvertices+1,imonth+1)=((imonth+1)/12);
-    md.surfaceforcings.precipitations_lgm(md.mesh.numberofvertices+1,imonth+1)=((imonth+1)/12);
+    md.smb.precipitations_presentday(md.mesh.numberofvertices+1,imonth+1)=((imonth+1)/12);
+    md.smb.precipitations_lgm(md.mesh.numberofvertices+1,imonth+1)=((imonth+1)/12);
 end
 
-md.surfaceforcings.Pfac(1,1:md.timestepping.final_time)=0.5;
-md.surfaceforcings.Tdiff(1,1:md.timestepping.final_time)=0.5;
-md.surfaceforcings.sealev(1,1:md.timestepping.final_time)=0.5;
-% Year of each data point
-md.surfaceforcings.Pfac(2,1:md.timestepping.final_time)=1:1:md.timestepping.final_time;
-md.surfaceforcings.Tdiff(2,1:md.timestepping.final_time)=1:1:md.timestepping.final_time;
-md.surfaceforcings.sealev(2,1:md.timestepping.final_time)=1:1:md.timestepping.final_time;
+for iint=1:(md.timestepping.final_time/md.timestepping.time_step)+1
+    md.smb.Pfac(1,iint)=0.15*iint;
+    md.smb.Tdiff(1,iint)=0.15*iint;
+    md.smb.sealev(1,iint)=0.15*iint;
+    % Year of each data point
+    md.smb.Pfac(2,iint)=(iint-1)*20;
+    md.smb.Tdiff(2,iint)=(iint-1)*20;
+    md.smb.sealev(2,iint)=(iint-1)*20;
+end
 
-% time steps and resolution
-md.timestepping.time_step=20;
-md.settings.output_frequency=1;
-md.timestepping.final_time=60;
-
 %
-md.transient.requested_outputs={'default','SurfaceforcingsMonthlytemperatures'};
+md.transient.requested_outputs={'default','SmbMonthlytemperatures'};
 md=extrude(md,3,1);
 
 md=setflowequation(md,'SSA','all');
@@ -74,13 +63,13 @@
 md=solve(md,TransientSolutionEnum);
 
 %Fields and tolerances to track changes
-field_names     ={'Vx1','Vy1','Vz1','Vel1','Pressure1','Bed1','Surface1','Thickness1','Temperature1','BasalforcingsGroundediceMeltingRate1', ...
-						'Vx2','Vy2','Vz2','Vel2','Pressure2','Bed2','Surface2','Thickness2','Temperature2','BasalforcingsGroundediceMeltingRate2', ...
-						'Vx3','Vy3','Vz3','Vel3','Pressure3','Bed3','Surface3','Thickness3','Temperature3','BasalforcingsGroundediceMeltingRate3'};
+field_names     ={'Vx1','Vy1','Vz1','Vel1','Pressure1','Bed1','Surface1','Thickness1','Temperature1','BasalforcingsGroundediceMeltingRate1','SmbMonthlytemperatures1','SmbMassBalance1',...
+						'Vx2','Vy2','Vz2','Vel2','Pressure2','Bed2','Surface2','Thickness2','Temperature2','BasalforcingsGroundediceMeltingRate2','SmbMonthlytemperatures2','SmbMassBalance2',...
+						'Vx3','Vy3','Vz3','Vel3','Pressure3','Bed3','Surface3','Thickness3','Temperature3','BasalforcingsGroundediceMeltingRate3','SmbMonthlytemperatures3','SmbMassBalance3'};
 field_tolerances={...
-	1e-13,1e-13,1e-13,1e-13,1e-13,1e-8,1e-8,1e-8,1e-13,1e-8,...
-	1e-13,1e-13,1e-13,1e-13,1e-13,1e-8,1e-8,1e-8,1e-13,1e-8,...
-	1e-13,1e-13,1e-08,1e-13,1e-13,1e-8,1e-8,1e-8,1e-13,1e-8};
+	1e-13,1e-13,1e-13,1e-13,1e-13,1e-8,1e-8,1e-8,1e-13,1e-8,1e-13,1e-13,...
+	1e-13,1e-13,1e-13,1e-13,1e-13,1e-8,1e-8,1e-8,1e-13,1e-7,1e-13,1e-13,...
+	1e-13,1e-13,1e-08,1e-13,1e-13,1e-8,1e-8,1e-8,1e-13,5e-7,1e-13,1e-13};
 field_values={...
 	(md.results.TransientSolution(1).Vx),...
 	(md.results.TransientSolution(1).Vy),...
@@ -92,8 +81,8 @@
 	(md.results.TransientSolution(1).Thickness),...
 	(md.results.TransientSolution(1).Temperature),...
 	(md.results.TransientSolution(1).BasalforcingsGroundediceMeltingRate),...
-	(md.results.TransientSolution(1).SurfaceforcingsMonthlytemperatures),...
-	(md.results.TransientSolution(1).SurfaceforcingsMassBalance),...
+	(md.results.TransientSolution(1).SmbMonthlytemperatures),...
+	(md.results.TransientSolution(1).SmbMassBalance),...
 	(md.results.TransientSolution(2).Vx),...
 	(md.results.TransientSolution(2).Vy),...
 	(md.results.TransientSolution(2).Vz),...
@@ -104,8 +93,8 @@
 	(md.results.TransientSolution(2).Thickness),...
 	(md.results.TransientSolution(2).Temperature),...
 	(md.results.TransientSolution(2).BasalforcingsGroundediceMeltingRate),...
-	(md.results.TransientSolution(2).SurfaceforcingsMonthlytemperatures),...
-	(md.results.TransientSolution(2).SurfaceforcingsMassBalance),...
+	(md.results.TransientSolution(2).SmbMonthlytemperatures),...
+	(md.results.TransientSolution(2).SmbMassBalance),...
 	(md.results.TransientSolution(3).Vx),...
 	(md.results.TransientSolution(3).Vy),...
 	(md.results.TransientSolution(3).Vz),...
@@ -116,6 +105,6 @@
 	(md.results.TransientSolution(3).Thickness),...
 	(md.results.TransientSolution(3).Temperature),...
 	(md.results.TransientSolution(3).BasalforcingsGroundediceMeltingRate),...
-	(md.results.TransientSolution(3).SurfaceforcingsMonthlytemperatures),...
-	(md.results.TransientSolution(3).SurfaceforcingsMassBalance),...
+	(md.results.TransientSolution(3).SmbMonthlytemperatures),...
+	(md.results.TransientSolution(3).SmbMassBalance),...
 	};

Modified: issm/trunk/test/NightlyRun/test237.py
===================================================================
--- issm/trunk/test/NightlyRun/test237.py	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/NightlyRun/test237.py	2016-04-13 04:32:01 UTC (rev 20500)
@@ -15,77 +15,73 @@
 md=parameterize(md,'../Par/SquareShelf.py')
 
 # Use of ispdd and isdelta18o methods
-md.surfaceforcings = SMBpdd();
-md.surfaceforcings.isdelta18o=0
-md.surfaceforcings.ismungsm=1
+md.smb = SMBpdd();
+md.smb.isdelta18o=0
+md.smb.ismungsm=1
 
+# time steps and resolution
+md.timestepping.time_step=20.
+md.settings.output_frequency=1
+md.timestepping.final_time=60.
 
-# # Add temperature, precipitation and delta18o needed to measure the surface mass balance
-# # creating delta18o
-# delta18o=numpy.loadtxt('../Data/delta18o.data')
-# md.surfaceforcings.delta18o=delta18o
-# # creating delta18oSurface
-# md.surfaceforcings.delta18o_surface = numpy.zeros((2,numpy.size(delta18o,axis=1)))
-# md.surfaceforcings.delta18o_surface[1,:] = delta18o[1,:]
-
 # creating Present day and lgm temperatures
 # Same temperature over the all region:
 tmonth=numpy.ones(12)*(238.15+20.)
-md.surfaceforcings.temperatures_presentday=numpy.zeros((md.mesh.numberofvertices+1,12))
-md.surfaceforcings.temperatures_lgm=numpy.zeros((md.mesh.numberofvertices+1,12))
+md.smb.temperatures_presentday=numpy.zeros((md.mesh.numberofvertices+1,12))
+md.smb.temperatures_lgm=numpy.zeros((md.mesh.numberofvertices+1,12))
 for imonth in xrange(0,12):
-    md.surfaceforcings.temperatures_presentday[0:md.mesh.numberofvertices,imonth]=tmonth[imonth]
-    md.surfaceforcings.temperatures_lgm[0:md.mesh.numberofvertices,imonth]=tmonth[imonth]-20.
+    md.smb.temperatures_presentday[0:md.mesh.numberofvertices,imonth]=tmonth[imonth]
+    md.smb.temperatures_lgm[0:md.mesh.numberofvertices,imonth]=tmonth[imonth]-20.
     # Time for the last line:
-    md.surfaceforcings.temperatures_presentday[md.mesh.numberofvertices,imonth]=((float(imonth)+1.)/12.)
-    md.surfaceforcings.temperatures_lgm[md.mesh.numberofvertices,imonth]=((float(imonth)+1.)/12.)
+    md.smb.temperatures_presentday[md.mesh.numberofvertices,imonth]=((float(imonth)+1.)/12.)
+    md.smb.temperatures_lgm[md.mesh.numberofvertices,imonth]=((float(imonth)+1.)/12.)
 
 # creating initialization and spc temperatures initialization and spc
-md.thermal.spctemperature=numpy.mean(md.surfaceforcings.temperatures_lgm[0:md.mesh.numberofvertices,:],axis=1).reshape(-1,1)    #-10*ones(md.mesh.numberofvertices,1)
+md.thermal.spctemperature=numpy.mean(md.smb.temperatures_lgm[0:md.mesh.numberofvertices,:],axis=1).reshape(-1,1)    #-10*ones(md.mesh.numberofvertices,1)
 md.thermal.spctemperature=numpy.tile(md.thermal.spctemperature,(1,md.timestepping.final_time/md.timestepping.time_step))
 itemp=numpy.arange(0,md.timestepping.final_time,md.timestepping.time_step)
 md.thermal.spctemperature=numpy.vstack((md.thermal.spctemperature,itemp.reshape(1,-1)))
 
-md.initialization.temperature=md.surfaceforcings.temperatures_lgm[0:md.mesh.numberofvertices,0].reshape(-1,1)   #*ones(md.mesh.numberofvertices,1)
+md.initialization.temperature=md.smb.temperatures_lgm[0:md.mesh.numberofvertices,0].reshape(-1,1)   #*ones(md.mesh.numberofvertices,1)
+md.smb.initialize(md)
 
 # creating precipitation
-md.surfaceforcings.precipitations_presentday=numpy.zeros((md.mesh.numberofvertices+1,12))
-md.surfaceforcings.precipitations_lgm=numpy.zeros((md.mesh.numberofvertices+1,12))
+md.smb.precipitations_presentday=numpy.zeros((md.mesh.numberofvertices+1,12))
+md.smb.precipitations_lgm=numpy.zeros((md.mesh.numberofvertices+1,12))
 for imonth in xrange(0,12):
-    md.surfaceforcings.precipitations_presentday[0:md.mesh.numberofvertices,imonth]=-0.4*10**(-6)*md.mesh.y+0.5
-    md.surfaceforcings.precipitations_presentday[md.mesh.numberofvertices,imonth]=((float(imonth)+1.)/12.)
-    md.surfaceforcings.precipitations_lgm[0:md.mesh.numberofvertices,imonth]=-0.4*10**(-6)*md.mesh.y+0.5
-    md.surfaceforcings.precipitations_lgm[md.mesh.numberofvertices,imonth]=((float(imonth)+1.)/12.)
+    md.smb.precipitations_presentday[0:md.mesh.numberofvertices,imonth]=-0.4*10**(-6)*md.mesh.y+0.5
+    md.smb.precipitations_presentday[md.mesh.numberofvertices,imonth]=((float(imonth)+1.)/12.)
+    md.smb.precipitations_lgm[0:md.mesh.numberofvertices,imonth]=-0.4*10**(-6)*md.mesh.y+0.5
+    md.smb.precipitations_lgm[md.mesh.numberofvertices,imonth]=((float(imonth)+1.)/12.)
 
-# Interpolation factors
-md.surfaceforcings.Pfac=0.5*numpy.ones((2,md.timestepping.final_time))
-md.surfaceforcings.Tdiff=0.5*numpy.ones((2,md.timestepping.final_time))
-md.surfaceforcings.sealev=0.5*numpy.ones((2,md.timestepping.final_time))
-# Year of each data point
-md.surfaceforcings.Pfac[1,1:md.timestepping.final_time]=numpy.arange(1.,md.timestepping.final_time)
-md.surfaceforcings.Tdiff[1,1:md.timestepping.final_time]=numpy.arange(1.,md.timestepping.final_time)
-md.surfaceforcings.sealev[1,1:md.timestepping.final_time]=numpy.arange(1.,md.timestepping.final_time)
+fsize=int(md.timestepping.final_time/md.timestepping.time_step)+2
+md.smb.Pfac=numpy.zeros((2,fsize))
+md.smb.Tdiff=numpy.zeros((2,fsize))
+md.smb.sealev=numpy.zeros((2,fsize))
+for iint in xrange(0,fsize):
+    # Interpolation factors
+	 md.smb.Pfac[0,iint]=0.15*(iint+1)
+	 md.smb.Tdiff[0,iint]=0.15*(iint+1)
+	 md.smb.sealev[0,iint]=0.15*(iint+1)
+	 # Year of each data point
+	 md.smb.Pfac[1,iint]=(float(iint))*20
+	 md.smb.Tdiff[1,iint]=(float(iint))*20
+	 md.smb.sealev[1,iint]=(float(iint))*20
 
-# time steps and resolution
-md.timestepping.time_step=20.
-md.settings.output_frequency=1
-md.timestepping.final_time=60.
-
 #
-md.transient.requested_outputs=['default','SurfaceforcingsMonthlytemperatures']
+md.transient.requested_outputs=['default','SmbMonthlytemperatures']
 md.extrude(3,1.)
 md=setflowequation(md,'SSA','all')
 md.cluster=generic('name',oshostname(),'np',1)
 md=solve(md,TransientSolutionEnum())
 
 #Fields and tolerances to track changes
-field_names     =['Vx1','Vy1','Vz1','Vel1','Pressure1','Bed1','Surface1','Thickness1','Temperature1','BasalforcingsGroundediceMeltingRate1', \
-						'Vx2','Vy2','Vz2','Vel2','Pressure2','Bed2','Surface2','Thickness2','Temperature2','BasalforcingsGroundediceMeltingRate2', \
-						'Vx3','Vy3','Vz3','Vel3','Pressure3','Bed3','Surface3','Thickness3','Temperature3','BasalforcingsGroundediceMeltingRate3']
-field_tolerances=[\
-	1e-13,1e-13,1e-13,1e-13,1e-13,1e-8,1e-8,1e-13,1e-13,1e-8,\
-	1e-13,1e-13,1e-13,1e-13,1e-13,1e-8,1e-8,1e-13,1e-13,1e-8,\
-	1e-13,1e-13,1e-08,1e-13,1e-13,1e-8,1e-8,1e-10,1e-13,1e-8]
+field_names     =['Vx1','Vy1','Vz1','Vel1','Pressure1','Bed1','Surface1','Thickness1','Temperature1','BasalforcingsGroundediceMeltingRate1','SmbMonthlytemperatures1','SmbMassBalance1',\
+		'Vx2','Vy2','Vz2','Vel2','Pressure2','Bed2','Surface2','Thickness2','Temperature2','BasalforcingsGroundediceMeltingRate2','SmbMonthlytemperatures2','SmbMassBalance2',\
+		'Vx3','Vy3','Vz3','Vel3','Pressure3','Bed3','Surface3','Thickness3','Temperature3','BasalforcingsGroundediceMeltingRate3','SmbMonthlytemperatures3','SmbMassBalance3'];
+field_tolerances=[1e-13,1e-13,1e-13,1e-13,1e-13,1e-8,1e-8,1e-8,1e-13,1e-8,1e-13,1e-13,\
+		1e-13,1e-13,1e-13,1e-13,1e-13,1e-8,1e-8,1e-8,7e-13,1e-7,1e-13,1e-13,\
+		1e-13,1e-13,1e-08,1e-13,1e-13,1e-8,1e-8,1e-8,7e-13,5e-7,1e-13,1e-13];
 field_values=[\
 	md.results.TransientSolution[0].Vx,\
 	md.results.TransientSolution[0].Vy,\
@@ -97,8 +93,8 @@
 	md.results.TransientSolution[0].Thickness,\
 	md.results.TransientSolution[0].Temperature,\
 	md.results.TransientSolution[0].BasalforcingsGroundediceMeltingRate,\
-	md.results.TransientSolution[0].SurfaceforcingsMonthlytemperatures,\
-	md.results.TransientSolution[0].SurfaceforcingsMassBalance,\
+	md.results.TransientSolution[0].SmbMonthlytemperatures,\
+	md.results.TransientSolution[0].SmbMassBalance,\
 	md.results.TransientSolution[1].Vx,\
 	md.results.TransientSolution[1].Vy,\
 	md.results.TransientSolution[1].Vz,\
@@ -109,8 +105,8 @@
 	md.results.TransientSolution[1].Thickness,\
 	md.results.TransientSolution[1].Temperature,\
 	md.results.TransientSolution[1].BasalforcingsGroundediceMeltingRate,\
-	md.results.TransientSolution[1].SurfaceforcingsMonthlytemperatures,\
-	md.results.TransientSolution[1].SurfaceforcingsMassBalance,\
+	md.results.TransientSolution[1].SmbMonthlytemperatures,\
+	md.results.TransientSolution[1].SmbMassBalance,\
 	md.results.TransientSolution[2].Vx,\
 	md.results.TransientSolution[2].Vy,\
 	md.results.TransientSolution[2].Vz,\
@@ -121,6 +117,6 @@
 	md.results.TransientSolution[2].Thickness,\
 	md.results.TransientSolution[2].Temperature,\
 	md.results.TransientSolution[2].BasalforcingsGroundediceMeltingRate,\
-	md.results.TransientSolution[2].SurfaceforcingsMonthlytemperatures,\
-	md.results.TransientSolution[2].SurfaceforcingsMassBalance,\
+	md.results.TransientSolution[2].SmbMonthlytemperatures,\
+	md.results.TransientSolution[2].SmbMassBalance,\
 	]

Modified: issm/trunk/test/NightlyRun/test238.m
===================================================================
--- issm/trunk/test/NightlyRun/test238.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/NightlyRun/test238.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -1,34 +1,61 @@
-%Test Name: SquareShelfTranForceNoInterp2d
+%Test Name: SquareShelfTranIspddIsdeltaO18pdSSA2d
 md=triangle(model(),'../Exp/Square.exp',150000.);
 md=setmask(md,'all','');
 md=parameterize(md,'../Par/SquareShelf.par');
-md=setflowequation(md,'SSA','all');
-md.cluster=generic('name',oshostname(),'np',3);
 
-md.timestepping.time_step=1.;
-md.settings.output_frequency=1;
-md.timestepping.final_time=4.;
-md.timestepping.interp_forcings=0;
+%md.verbose=verbose('all');
 
-%Set up transient
-smb=ones(md.mesh.numberofvertices,1)*3.6;
-smb=[ smb smb*-1. ];
+% Use of ispdd and isdelta18o methods
+md.smb = SMBd18opdd();
+md.smb.isd18opd=1;
+%md.smb.precipitation(1:md.mesh.numberofvertices,1:12)=0;
+%md.smb.monthlytemperatures(1:md.mesh.numberofvertices,1:12)=273;
 
-md.surfaceforcings.mass_balance=smb;
-md.surfaceforcings.mass_balance(end+1,:)=[1.5 3.];
-md.transient.isthermal=0;
+% Add temperature, precipitation and delta18o needed to measure the surface mass balance
+%  creating delta18o
+load '../Data/delta18o.data'
+md.smb.delta18o=delta18o;
 
+% creating Present day  temperatures
+% Same temperature over the all region:
+tmonth(1:12)=238.15+20.;
+for imonth=0:11
+    md.smb.temperatures_presentday(1:md.mesh.numberofvertices,imonth+1)=tmonth(imonth+1);
+    % Time for the last line:
+    md.smb.temperatures_presentday(md.mesh.numberofvertices+1,imonth+1)=((imonth+1)/12);
+end
+
+% creating initialization and spc temperatures initialization and
+% spc
+md.thermal.spctemperature=mean(md.smb.temperatures_presentday(1:md.mesh.numberofvertices,1:12),2)-10; %-10*ones(md.mesh.numberofvertices,1);
+md.initialization.temperature=md.thermal.spctemperature; %md.smb.temperatures_presentday(1:md.mesh.numberofvertices,1);
+
+% creating precipitation
+for imonth=0:11
+    md.smb.precipitations_presentday(1:md.mesh.numberofvertices,imonth+1)=-0.4*10^(-6)*md.mesh.y+0.5;
+    % Time for the last line:
+    md.smb.precipitations_presentday(md.mesh.numberofvertices+1,imonth+1)=((imonth+1)/12);
+end
+md.smb = initialize(md.smb,md);
+
+% time steps and resolution
+md.timestepping.time_step=20;
+md.settings.output_frequency=1;
+md.timestepping.final_time=60;
+
+% 
+md.transient.requested_outputs={'default','SmbMonthlytemperatures'};
+md=setflowequation(md,'SSA','all');
+md.cluster=generic('name',oshostname(),'np',1); % 3 for the cluster
 md=solve(md,TransientSolutionEnum());
 
 %Fields and tolerances to track changes
-field_names={'Vx1','Vy1','Vel1','Pressure1','Bed1','Surface1','Thickness1','SurfaceforcingsMassBalance1', ...
-	'Vx2','Vy2','Vel2','Pressure2','Bed2','Surface2','Thickness2','SurfaceforcingsMassBalance2', ...
-	'Vx3','Vy3','Vel3','Pressure3','Bed3','Surface3','Thickness3','SurfaceforcingsMassBalance3', ...
-	'Vx4','Vy4','Vel4','Pressure4','Bed4','Surface4','Thickness4','SurfaceforcingsMassBalance4'};
-field_tolerances={1e-09,1e-09,1e-10,1e-10,1e-10,1e-10,1e-10,1e-10,...
-	1e-09,1e-09,1e-10,1e-10,1e-10,1e-10,1e-10,1e-10,...
-	1e-09,1e-09,1e-10,1e-10,1e-10,1e-10,1e-10,1e-10,...
-	1e-09,1e-09,1e-10,1e-10,1e-10,1e-10,1e-10,1e-10};
+field_names     ={'Vx1','Vy1','Vel1','Pressure1','Bed1','Surface1','Thickness1','SmbMonthlytemperatures1','SmbMassBalance1',...
+	      'Vx2','Vy2','Vel2','Pressure2','Bed2','Surface2','Thickness2','SmbMonthlytemperatures2','SmbMassBalance2',...
+	      'Vx3','Vy3','Vel3','Pressure3','Bed3','Surface3','Thickness3','SmbMonthlytemperatures3','SmbMassBalance3'};
+field_tolerances={1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,...
+	   1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,...
+	   1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13};
 field_values={...
 	(md.results.TransientSolution(1).Vx),...
 	(md.results.TransientSolution(1).Vy),...
@@ -37,7 +64,8 @@
 	(md.results.TransientSolution(1).Base),...
 	(md.results.TransientSolution(1).Surface),...
 	(md.results.TransientSolution(1).Thickness),...
-	(md.results.TransientSolution(1).SurfaceforcingsMassBalance),...
+	(md.results.TransientSolution(1).SmbMonthlytemperatures),...
+	(md.results.TransientSolution(1).SmbMassBalance),...
 	(md.results.TransientSolution(2).Vx),...
 	(md.results.TransientSolution(2).Vy),...
 	(md.results.TransientSolution(2).Vel),...
@@ -45,7 +73,8 @@
 	(md.results.TransientSolution(2).Base),...
 	(md.results.TransientSolution(2).Surface),...
 	(md.results.TransientSolution(2).Thickness),...
-	(md.results.TransientSolution(2).SurfaceforcingsMassBalance),...
+	(md.results.TransientSolution(2).SmbMonthlytemperatures),...
+	(md.results.TransientSolution(2).SmbMassBalance),...
 	(md.results.TransientSolution(3).Vx),...
 	(md.results.TransientSolution(3).Vy),...
 	(md.results.TransientSolution(3).Vel),...
@@ -53,13 +82,6 @@
 	(md.results.TransientSolution(3).Base),...
 	(md.results.TransientSolution(3).Surface),...
 	(md.results.TransientSolution(3).Thickness),...
-	(md.results.TransientSolution(3).SurfaceforcingsMassBalance),...
-	(md.results.TransientSolution(4).Vx),...
-	(md.results.TransientSolution(4).Vy),...
-	(md.results.TransientSolution(4).Vel),...
-	(md.results.TransientSolution(4).Pressure),...
-	(md.results.TransientSolution(4).Base),...
-	(md.results.TransientSolution(4).Surface),...
-	(md.results.TransientSolution(4).Thickness),...
-	(md.results.TransientSolution(4).SurfaceforcingsMassBalance),...
+	(md.results.TransientSolution(3).SmbMonthlytemperatures),...
+	(md.results.TransientSolution(3).SmbMassBalance),...
 	};

Modified: issm/trunk/test/NightlyRun/test239.m
===================================================================
--- issm/trunk/test/NightlyRun/test239.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/NightlyRun/test239.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -1,71 +1,88 @@
-%Test Name: SquareShelfTranForceNoInterp3d
-md=triangle(model(),'../Exp/Square.exp',350000.);
+%Test Name: SquareShelfTranIspddIsdeltaO18pdInterpSSA2d
+md=triangle(model(),'../Exp/Square.exp',150000.);
 md=setmask(md,'all','');
 md=parameterize(md,'../Par/SquareShelf.par');
-md=extrude(md,3,1.);
-md=setflowequation(md,'HO','all');
-md.cluster=generic('name',oshostname(),'np',3);
 
-md.timestepping.time_step=1;
-md.settings.output_frequency=1;
-md.timestepping.final_time=4;
-md.timestepping.interp_forcings=0;
+%md.verbose=verbose('all');
 
-%Set up transient
-smb=ones(md.mesh.numberofvertices,1)*3.6;
-smb=[ smb smb*-1. ];
+% Use of ispdd and isdelta18o methods
+md.smb = SMBd18opdd();
+md.smb.isd18opd=1;
+%md.smb.precipitation(1:md.mesh.numberofvertices,1:12)=0;
+%md.smb.monthlytemperatures(1:md.mesh.numberofvertices,1:12)=273;
 
-md.surfaceforcings.mass_balance=smb;
-md.surfaceforcings.mass_balance(end+1,:)=[1.5 3.];
-md.transient.isthermal=0;
+% Add temperature, precipitation and delta18o needed to measure the surface mass balance
+%  creating delta18o
+load '../Data/delta18o.data'
+md.smb.delta18o=delta18o;
 
+% creating Present day  temperatures
+% Same temperature over the all region:
+tmonth(1:12)=238.15+20.;
+for imonth=0:11
+    md.smb.temperatures_presentday(1:md.mesh.numberofvertices,imonth+1)=tmonth(imonth+1);
+    % Time for the last line:
+    md.smb.temperatures_presentday(md.mesh.numberofvertices+1,imonth+1)=((imonth+1)/12);
+end
+
+% creating initialization and spc temperatures initialization and
+% spc
+md.thermal.spctemperature=mean(md.smb.temperatures_presentday(1:md.mesh.numberofvertices,1:12),2)-10; %-10*ones(md.mesh.numberofvertices,1);
+
+md.initialization.temperature=md.thermal.spctemperature; %md.smb.temperatures_presentday(1:md.mesh.numberofvertices,1);
+
+% creating precipitation
+for imonth=0:11
+    md.smb.precipitations_presentday(1:md.mesh.numberofvertices,imonth+1)=-0.4*10^(-6)*md.mesh.y+0.5;
+    % Time for the last line:
+    md.smb.precipitations_presentday(md.mesh.numberofvertices+1,imonth+1)=((imonth+1)/12);
+end
+md.smb = initialize(md.smb,md);
+
+% time steps and resolution
+md.timestepping.time_step=0.5;
+md.settings.output_frequency=1;
+md.timestepping.final_time=2;
+
+% 
+md.transient.requested_outputs={'default','SmbMonthlytemperatures'};
+md=setflowequation(md,'SSA','all');
+md.cluster=generic('name',oshostname(),'np',1); % 3 for the cluster
 md=solve(md,TransientSolutionEnum());
 
 %Fields and tolerances to track changes
-field_names     ={'Vx1','Vy1','Vz1','Vel1','Pressure1','Bed1','Surface1','Thickness1','SurfaceforcingsMassBalance1', ...
-	'Vx2','Vy2','Vz2','Vel2','Pressure2','Bed2','Surface2','Thickness2','SurfaceforcingsMassBalance2', ...
-	'Vx3','Vy3','Vz3','Vel3','Pressure3','Bed3','Surface3','Thickness3','SurfaceforcingsMassBalance3', ...
-	'Vx4','Vy4','Vz4','Vel4','Pressure4','Bed4','Surface4','Thickness4','SurfaceforcingsMassbalance4'};
-field_tolerances={...
-	1e-09,1e-09,1e-09,1e-09,1e-10,1e-10,1e-10,1e-10,1e-13,...
-	1e-09,1e-09,1e-09,1e-09,1e-10,1e-10,1e-10,1e-10,1e-13,...
-	1e-09,1e-09,1e-09,1e-09,1e-10,1e-10,1e-10,1e-10,1e-13,...
-	1e-09,1e-09,1e-09,1e-09,1e-10,1e-10,1e-10,1e-10,1e-13};
+field_names     ={'Vx1','Vy1','Vel1','Pressure1','Bed1','Surface1','Thickness1','SmbMonthlytemperatures1','SmbMassBalance1',...
+	      'Vx2','Vy2','Vel2','Pressure2','Bed2','Surface2','Thickness2','SmbMonthlytemperatures2','SmbMassBalance2',...
+	      'Vx3','Vy3','Vel3','Pressure3','Bed3','Surface3','Thickness3','SmbMonthlytemperatures3','SmbMassBalance3'};
+field_tolerances={1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,...
+	   1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,...
+	   1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13};
 field_values={...
 	(md.results.TransientSolution(1).Vx),...
 	(md.results.TransientSolution(1).Vy),...
-	(md.results.TransientSolution(1).Vz),...
 	(md.results.TransientSolution(1).Vel),...
 	(md.results.TransientSolution(1).Pressure),...
 	(md.results.TransientSolution(1).Base),...
 	(md.results.TransientSolution(1).Surface),...
 	(md.results.TransientSolution(1).Thickness),...
-	(md.results.TransientSolution(1).SurfaceforcingsMassBalance),...
+	(md.results.TransientSolution(1).SmbMonthlytemperatures),...
+	(md.results.TransientSolution(1).SmbMassBalance),...
 	(md.results.TransientSolution(2).Vx),...
 	(md.results.TransientSolution(2).Vy),...
-	(md.results.TransientSolution(2).Vz),...
 	(md.results.TransientSolution(2).Vel),...
 	(md.results.TransientSolution(2).Pressure),...
 	(md.results.TransientSolution(2).Base),...
 	(md.results.TransientSolution(2).Surface),...
 	(md.results.TransientSolution(2).Thickness),...
-	(md.results.TransientSolution(2).SurfaceforcingsMassBalance),...
+	(md.results.TransientSolution(2).SmbMonthlytemperatures),...
+	(md.results.TransientSolution(2).SmbMassBalance),...
 	(md.results.TransientSolution(3).Vx),...
 	(md.results.TransientSolution(3).Vy),...
-	(md.results.TransientSolution(3).Vz),...
 	(md.results.TransientSolution(3).Vel),...
 	(md.results.TransientSolution(3).Pressure),...
 	(md.results.TransientSolution(3).Base),...
 	(md.results.TransientSolution(3).Surface),...
 	(md.results.TransientSolution(3).Thickness),...
-	(md.results.TransientSolution(3).SurfaceforcingsMassBalance),...
-	(md.results.TransientSolution(4).Vx),...
-	(md.results.TransientSolution(4).Vy),...
-	(md.results.TransientSolution(4).Vz),...
-	(md.results.TransientSolution(4).Vel),...
-	(md.results.TransientSolution(4).Pressure),...
-	(md.results.TransientSolution(4).Base),...
-	(md.results.TransientSolution(4).Surface),...
-	(md.results.TransientSolution(4).Thickness),...
-	(md.results.TransientSolution(4).SurfaceforcingsMassBalance),...
+	(md.results.TransientSolution(3).SmbMonthlytemperatures),...
+	(md.results.TransientSolution(3).SmbMassBalance),...
 	};

Modified: issm/trunk/test/NightlyRun/test272.m
===================================================================
--- issm/trunk/test/NightlyRun/test272.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/NightlyRun/test272.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -1,4 +1,4 @@
-%Test Name: SquareShelfCMZSSA2dDamage
+%Test Name: SquareShelfCMDSSA2dDamage
 md=triangle(model(),'../Exp/Square.exp',150000.);
 md=setmask(md,'all','');
 md.materials=matdamageice();

Modified: issm/trunk/test/NightlyRun/test272.py
===================================================================
--- issm/trunk/test/NightlyRun/test272.py	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/NightlyRun/test272.py	2016-04-13 04:32:01 UTC (rev 20500)
@@ -1,4 +1,4 @@
-#Test Name: SquareShelfCMZSSA2dDamage
+#Test Name: SquareShelfCMDSSA2dDamage
 import numpy
 from model import model
 from triangle import triangle

Modified: issm/trunk/test/NightlyRun/test275.m
===================================================================
--- issm/trunk/test/NightlyRun/test275.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/NightlyRun/test275.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -1,4 +1,4 @@
-%Test Name: SquareShelfDamageEvolutionSSA2d
+%Test Name: SquareShelfDamageEvolutionSSA2dPralong
 md=triangle(model(),'../Exp/Square.exp',150000.);
 md=setmask(md,'all','');
 md.materials=matdamageice();

Modified: issm/trunk/test/NightlyRun/test275.py
===================================================================
--- issm/trunk/test/NightlyRun/test275.py	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/NightlyRun/test275.py	2016-04-13 04:32:01 UTC (rev 20500)
@@ -1,4 +1,4 @@
-#Test Name: SquareShelfDamageEvolutionSSA2d
+#Test Name: SquareShelfDamageEvolutionSSA2dPralong 
 import numpy
 from triangle import triangle
 from model import model

Modified: issm/trunk/test/NightlyRun/test3001.py
===================================================================
--- issm/trunk/test/NightlyRun/test3001.py	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/NightlyRun/test3001.py	2016-04-13 04:32:01 UTC (rev 20500)
@@ -14,7 +14,6 @@
 md=setflowequation(md,'SSA','all')
 md.cluster=generic('name',oshostname(),'np',1)
 md.stressbalance.requested_outputs=['default','DeviatoricStressxx','DeviatoricStressyy','DeviatoricStressxy']
-md.toolkits.DefaultAnalysis=issmgslsolver()
 md.autodiff.isautodiff=True
 md=solve(md,StressbalanceSolutionEnum())
 

Modified: issm/trunk/test/NightlyRun/test3002.py
===================================================================
--- issm/trunk/test/NightlyRun/test3002.py	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/NightlyRun/test3002.py	2016-04-13 04:32:01 UTC (rev 20500)
@@ -15,7 +15,6 @@
 md=setflowequation(md,'SSA','all')
 md.cluster=generic('name',oshostname(),'np',1)
 md.autodiff.isautodiff=True
-md.toolkits.DefaultAnalysis=issmgslsolver()
 md=solve(md,StressbalanceSolutionEnum())
 
 #Fields and tolerances to track changes

Modified: issm/trunk/test/NightlyRun/test3003.py
===================================================================
--- issm/trunk/test/NightlyRun/test3003.py	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/NightlyRun/test3003.py	2016-04-13 04:32:01 UTC (rev 20500)
@@ -15,7 +15,6 @@
 md=setflowequation(md,'HO','all')
 md.cluster=generic('name',oshostname(),'np',1)
 md.stressbalance.requested_outputs=['default','StressTensorxx','StressTensoryy','StressTensorzz','StressTensorxy','StressTensorxz','StressTensoryz']
-md.toolkits.DefaultAnalysis=issmgslsolver()
 md.autodiff.isautodiff=True
 md=solve(md,StressbalanceSolutionEnum())
 

Modified: issm/trunk/test/NightlyRun/test3004.py
===================================================================
--- issm/trunk/test/NightlyRun/test3004.py	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/NightlyRun/test3004.py	2016-04-13 04:32:01 UTC (rev 20500)
@@ -14,7 +14,6 @@
 md.extrude(3,2.)
 md=setflowequation(md,'FS','all')
 md.cluster=generic('name',oshostname(),'np',1)
-md.toolkits.DefaultAnalysis=issmgslsolver()
 md.autodiff.isautodiff=True
 md=solve(md,StressbalanceSolutionEnum())
 

Modified: issm/trunk/test/NightlyRun/test3005.py
===================================================================
--- issm/trunk/test/NightlyRun/test3005.py	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/NightlyRun/test3005.py	2016-04-13 04:32:01 UTC (rev 20500)
@@ -13,7 +13,6 @@
 md=parameterize(md,'../Par/SquareShelfConstrained.py')
 md=setflowequation(md,'SSA','all')
 md.cluster=generic('name',oshostname(),'np',1)
-md.toolkits.DefaultAnalysis=issmgslsolver()
 md.autodiff.isautodiff=True
 md=solve(md,MasstransportSolutionEnum())
 

Modified: issm/trunk/test/NightlyRun/test3006.py
===================================================================
--- issm/trunk/test/NightlyRun/test3006.py	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/NightlyRun/test3006.py	2016-04-13 04:32:01 UTC (rev 20500)
@@ -17,7 +17,6 @@
 md.cluster=generic('name',oshostname(),'np',1)
 md.masstransport.stabilization=3
 md.masstransport.spcthickness=md.geometry.thickness
-md.toolkits.DefaultAnalysis=issmgslsolver()
 md.autodiff.isautodiff=True
 md=solve(md,MasstransportSolutionEnum())
 

Modified: issm/trunk/test/NightlyRun/test3007.py
===================================================================
--- issm/trunk/test/NightlyRun/test3007.py	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/NightlyRun/test3007.py	2016-04-13 04:32:01 UTC (rev 20500)
@@ -14,7 +14,6 @@
 md=setflowequation(md,'SSA','all')
 md.extrude(5,3.)
 md.cluster=generic('name',oshostname(),'np',1)
-md.toolkits.DefaultAnalysis=issmgslsolver()
 md.autodiff.isautodiff=True
 md=solve(md,MasstransportSolutionEnum())
 

Modified: issm/trunk/test/NightlyRun/test3008.py
===================================================================
--- issm/trunk/test/NightlyRun/test3008.py	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/NightlyRun/test3008.py	2016-04-13 04:32:01 UTC (rev 20500)
@@ -15,7 +15,6 @@
 md=setflowequation(md,'SSA','all')
 md.timestepping.time_step=0
 md.cluster=generic('name',oshostname(),'np',1)
-md.toolkits.DefaultAnalysis=issmgslsolver()
 md.autodiff.isautodiff=True
 md=solve(md,ThermalSolutionEnum())
 

Modified: issm/trunk/test/NightlyRun/test3009.m
===================================================================
--- issm/trunk/test/NightlyRun/test3009.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/NightlyRun/test3009.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -7,6 +7,7 @@
 md.cluster=generic('name',oshostname(),'np',1);
 md.transient.isstressbalance=0;
 md.transient.ismasstransport=0;
+md.transient.issmb=1;
 md.transient.isthermal=1;
 md.transient.isgroundingline=0;
 md.autodiff.isautodiff=true;

Modified: issm/trunk/test/NightlyRun/test3009.py
===================================================================
--- issm/trunk/test/NightlyRun/test3009.py	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/NightlyRun/test3009.py	2016-04-13 04:32:01 UTC (rev 20500)
@@ -16,9 +16,9 @@
 md.cluster=generic('name',oshostname(),'np',1)
 md.transient.isstressbalance=False
 md.transient.ismasstransport=False
+md.transient.issmb=True
 md.transient.isthermal=True
 md.transient.isgroundingline=False
-md.toolkits.DefaultAnalysis=issmgslsolver()
 md.autodiff.isautodiff=True
 md=solve(md,TransientSolutionEnum())
 

Modified: issm/trunk/test/NightlyRun/test3010.py
===================================================================
--- issm/trunk/test/NightlyRun/test3010.py	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/NightlyRun/test3010.py	2016-04-13 04:32:01 UTC (rev 20500)
@@ -13,7 +13,6 @@
 md=parameterize(md,'../Par/SquareShelfConstrained.py')
 md=setflowequation(md,'SSA','all')
 md.cluster=generic('name',oshostname(),'np',1)
-md.toolkits.DefaultAnalysis=issmgslsolver()
 md.transient.requested_outputs=['IceVolume']
 
 md.autodiff.isautodiff=True

Modified: issm/trunk/test/NightlyRun/test3015.py
===================================================================
--- issm/trunk/test/NightlyRun/test3015.py	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/NightlyRun/test3015.py	2016-04-13 04:32:01 UTC (rev 20500)
@@ -21,10 +21,9 @@
 md=setmask(md,'all','')
 md=parameterize(md,'../Par/SquareShelfConstrained.py')
 md=setflowequation(md,'SSA','all')
-md.cluster=generic('name',oshostname(),'np',3)
+md.cluster=generic('name',oshostname(),'np',1)
 md.masstransport.requested_outputs=['IceVolume']
 md.verbose=verbose('autodiff',True)
-md.toolkits.DefaultAnalysis=issmgslsolver()
 
 #setup autodiff parameters
 index=1 #this is the scalar component we are checking against
@@ -37,6 +36,9 @@
 	]
 md.autodiff.driver='fos_forward'
 
+#PYTHON: indices start at 0, make sure to offset index
+index=index-1
+
 #parameters for the step-wise derivative
 delta=0.001
 h1=md.geometry.thickness[index]
@@ -85,7 +87,7 @@
 #retrieve directly
 dVdh_ad=md.results.MasstransportSolution.AutodiffJacobian
 
-print "dV/dh: analytical:  #16.16g\n       using adolc:  #16.16g\n" % (dVdh_an,dVdh_ad)
+print "dV/dh: analytical:  %16.16g\n       using adolc:  %16.16g\n" % (dVdh_an,dVdh_ad)
 
 #Fields and tolerances to track changes
 field_names     =['dV/dh-dV/dh0']

Modified: issm/trunk/test/NightlyRun/test3019.m
===================================================================
--- issm/trunk/test/NightlyRun/test3019.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/NightlyRun/test3019.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -1,7 +1,4 @@
 %Test Name: SquareShelfConstrainedTherTranAdolcReverseVsForward
-SquareShelfConstrainedTherTranAdolcReverseVsForward
-%Test Name: SquareShelfConstrainedTherTranAdolcReverseVsForward
-SquareShelfConstrainedTherTranAdolcReverseVsForward
 %test reverse scalar vs forward vectorial drivers in ADOLC, using the test3009 setup, equivalent to test109 setup.
 md=triangle(model(),'../Exp/Square.exp',100000.);
 md=setmask(md,'all','');

Modified: issm/trunk/test/NightlyRun/test3019.py
===================================================================
--- issm/trunk/test/NightlyRun/test3019.py	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/NightlyRun/test3019.py	2016-04-13 04:32:01 UTC (rev 20500)
@@ -1,7 +1,4 @@
 #Test Name: SquareShelfConstrainedTherTranAdolcReverseVsForward
-SquareShelfConstrainedTherTranAdolcReverseVsForward
-#Test Name: SquareShelfConstrainedTherTranAdolcReverseVsForward
-SquareShelfConstrainedTherTranAdolcReverseVsForward
 import numpy
 from model import *
 from triangle import *
@@ -19,8 +16,7 @@
 md=setmask(md,'all','')
 md=parameterize(md,'../Par/SquareShelfConstrained.py')
 md=setflowequation(md,'SSA','all')
-md.cluster=generic('name',oshostname(),'np',3)
-md.toolkits.DefaultAnalysis=issmgslsolver()
+md.cluster=generic('name',oshostname(),'np',1)
 
 md.autodiff.isautodiff=True
 md.verbose.autodiff=True
@@ -47,5 +43,5 @@
 
 #Fields and tolerances to track changes
 field_names     =['Jac Forward','Jac Reverse','Jac Forward - Reverse']
-field_tolerances=[1e-13,1e-13,1e-13]
+field_tolerances=[1e-8,1e-8,1e-6]
 field_values=[jac_forward,jac_reverse,jac_forward-jac_reverse]

Modified: issm/trunk/test/NightlyRun/test3020.py
===================================================================
--- issm/trunk/test/NightlyRun/test3020.py	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/NightlyRun/test3020.py	2016-04-13 04:32:01 UTC (rev 20500)
@@ -25,7 +25,6 @@
 md.transient.requested_outputs=['IceVolume','MaxVel']
 md.verbose=verbose('autodiff',True)
 md.stressbalance.restol=0.000001
-md.toolkits.DefaultAnalysis=issmgslsolver()
 
 #setup autodiff parameters
 index=1 #this is the scalar component we are checking against
@@ -39,6 +38,9 @@
 	]
 md.autodiff.driver='fos_forward'
 
+#PYTHON: indices start at 0, make sure to offset index
+index=index-1
+
 #parameters for the step-wise derivative
 delta=0.00001
 h1=md.geometry.thickness[index]

Modified: issm/trunk/test/NightlyRun/test3101.py
===================================================================
--- issm/trunk/test/NightlyRun/test3101.py	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/NightlyRun/test3101.py	2016-04-13 04:32:01 UTC (rev 20500)
@@ -14,7 +14,7 @@
 md=setflowequation(md,'SSA','all')
 md.cluster=generic('name',oshostname(),'np',3)
 md.stressbalance.requested_outputs=['default','DeviatoricStressxx','DeviatoricStressyy','DeviatoricStressxy']
-md.toolkits.DefaultAnalysis=issmmumpssolver()
+
 md.autodiff.isautodiff=True
 md=solve(md,StressbalanceSolutionEnum())
 

Modified: issm/trunk/test/NightlyRun/test3102.py
===================================================================
--- issm/trunk/test/NightlyRun/test3102.py	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/NightlyRun/test3102.py	2016-04-13 04:32:01 UTC (rev 20500)
@@ -15,7 +15,7 @@
 md=setflowequation(md,'SSA','all')
 md.cluster=generic('name',oshostname(),'np',3)
 md.autodiff.isautodiff=True
-md.toolkits.DefaultAnalysis=issmmumpssolver()
+
 md=solve(md,StressbalanceSolutionEnum())
 
 #Fields and tolerances to track changes

Modified: issm/trunk/test/NightlyRun/test3103.py
===================================================================
--- issm/trunk/test/NightlyRun/test3103.py	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/NightlyRun/test3103.py	2016-04-13 04:32:01 UTC (rev 20500)
@@ -15,7 +15,7 @@
 md=setflowequation(md,'HO','all')
 md.cluster=generic('name',oshostname(),'np',3)
 md.stressbalance.requested_outputs=['default','StressTensorxx','StressTensoryy','StressTensorzz','StressTensorxy','StressTensorxz','StressTensoryz']
-md.toolkits.DefaultAnalysis=issmmumpssolver()
+
 md.autodiff.isautodiff=True
 md=solve(md,StressbalanceSolutionEnum())
 

Modified: issm/trunk/test/NightlyRun/test3104.py
===================================================================
--- issm/trunk/test/NightlyRun/test3104.py	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/NightlyRun/test3104.py	2016-04-13 04:32:01 UTC (rev 20500)
@@ -14,7 +14,7 @@
 md.extrude(3,2.)
 md=setflowequation(md,'FS','all')
 md.cluster=generic('name',oshostname(),'np',3)
-md.toolkits.DefaultAnalysis=issmmumpssolver()
+
 md.autodiff.isautodiff=True
 md=solve(md,StressbalanceSolutionEnum())
 

Modified: issm/trunk/test/NightlyRun/test3105.py
===================================================================
--- issm/trunk/test/NightlyRun/test3105.py	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/NightlyRun/test3105.py	2016-04-13 04:32:01 UTC (rev 20500)
@@ -13,7 +13,7 @@
 md=parameterize(md,'../Par/SquareShelfConstrained.py')
 md=setflowequation(md,'SSA','all')
 md.cluster=generic('name',oshostname(),'np',3)
-md.toolkits.DefaultAnalysis=issmmumpssolver()
+
 md.autodiff.isautodiff=True
 md=solve(md,MasstransportSolutionEnum())
 

Modified: issm/trunk/test/NightlyRun/test3106.py
===================================================================
--- issm/trunk/test/NightlyRun/test3106.py	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/NightlyRun/test3106.py	2016-04-13 04:32:01 UTC (rev 20500)
@@ -17,7 +17,7 @@
 md.cluster=generic('name',oshostname(),'np',3)
 md.masstransport.stabilization=3
 md.masstransport.spcthickness=md.geometry.thickness
-md.toolkits.DefaultAnalysis=issmmumpssolver()
+
 md.autodiff.isautodiff=True
 md=solve(md,MasstransportSolutionEnum())
 

Modified: issm/trunk/test/NightlyRun/test3107.py
===================================================================
--- issm/trunk/test/NightlyRun/test3107.py	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/NightlyRun/test3107.py	2016-04-13 04:32:01 UTC (rev 20500)
@@ -14,7 +14,7 @@
 md=setflowequation(md,'SSA','all')
 md.extrude(5,3.)
 md.cluster=generic('name',oshostname(),'np',3)
-md.toolkits.DefaultAnalysis=issmmumpssolver()
+
 md.autodiff.isautodiff=True
 md=solve(md,MasstransportSolutionEnum())
 

Modified: issm/trunk/test/NightlyRun/test3108.py
===================================================================
--- issm/trunk/test/NightlyRun/test3108.py	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/NightlyRun/test3108.py	2016-04-13 04:32:01 UTC (rev 20500)
@@ -15,7 +15,7 @@
 md=setflowequation(md,'SSA','all')
 md.timestepping.time_step=0
 md.cluster=generic('name',oshostname(),'np',3)
-md.toolkits.DefaultAnalysis=issmmumpssolver()
+
 md.autodiff.isautodiff=True
 md=solve(md,ThermalSolutionEnum())
 

Modified: issm/trunk/test/NightlyRun/test3109.m
===================================================================
--- issm/trunk/test/NightlyRun/test3109.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/NightlyRun/test3109.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -7,6 +7,7 @@
 md.cluster=generic('name',oshostname(),'np',3);
 md.transient.isstressbalance=0;
 md.transient.ismasstransport=0;
+md.transient.issmb=1;
 md.transient.isthermal=1;
 md.transient.isgroundingline=0;
 md.autodiff.isautodiff=true;

Modified: issm/trunk/test/NightlyRun/test3109.py
===================================================================
--- issm/trunk/test/NightlyRun/test3109.py	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/NightlyRun/test3109.py	2016-04-13 04:32:01 UTC (rev 20500)
@@ -16,9 +16,10 @@
 md.cluster=generic('name',oshostname(),'np',3)
 md.transient.isstressbalance=False
 md.transient.ismasstransport=False
+md.transient.issmb=True
 md.transient.isthermal=True
 md.transient.isgroundingline=False
-md.toolkits.DefaultAnalysis=issmmumpssolver()
+
 md.autodiff.isautodiff=True
 md=solve(md,TransientSolutionEnum())
 

Modified: issm/trunk/test/NightlyRun/test3110.py
===================================================================
--- issm/trunk/test/NightlyRun/test3110.py	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/NightlyRun/test3110.py	2016-04-13 04:32:01 UTC (rev 20500)
@@ -13,7 +13,7 @@
 md=parameterize(md,'../Par/SquareShelfConstrained.py')
 md=setflowequation(md,'SSA','all')
 md.cluster=generic('name',oshostname(),'np',3)
-md.toolkits.DefaultAnalysis=issmmumpssolver()
+
 md.transient.requested_outputs=['IceVolume']
 
 md.autodiff.isautodiff=True

Modified: issm/trunk/test/NightlyRun/test3119.m
===================================================================
--- issm/trunk/test/NightlyRun/test3119.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/NightlyRun/test3119.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -1,4 +1,5 @@
-%test reverse scalar driver in ADOLC, using the test3009 setup, equivalent to test109 setup.
+%Test Name: ReverseScalarDriver
+%reverse scalar driver in ADOLC, using the test3009 setup, equivalent to test109 setup.
 md=triangle(model(),'../Exp/Square.exp',100000.);
 md=setmask(md,'all','');
 md=parameterize(md,'../Par/SquareShelfConstrained.par');

Modified: issm/trunk/test/NightlyRun/test3119.py
===================================================================
--- issm/trunk/test/NightlyRun/test3119.py	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/NightlyRun/test3119.py	2016-04-13 04:32:01 UTC (rev 20500)
@@ -16,7 +16,6 @@
 md=parameterize(md,'../Par/SquareShelfConstrained.py')
 md=setflowequation(md,'SSA','all')
 md.cluster=generic('name',oshostname(),'np',3)
-md.toolkits.DefaultAnalysis=issmgslsolver()
 
 md.autodiff.isautodiff=True
 md.verbose.autodiff=True

Modified: issm/trunk/test/NightlyRun/test313.m
===================================================================
--- issm/trunk/test/NightlyRun/test313.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/NightlyRun/test313.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -8,6 +8,7 @@
 md.verbose=verbose('convergence',true,'solution',true);
 md.transient.isstressbalance=0;
 md.transient.ismasstransport=0;
+md.transient.issmb=1;
 md.transient.isthermal=1;
 md.transient.isgroundingline=0;
 md=solve(md,TransientSolutionEnum());

Modified: issm/trunk/test/NightlyRun/test313.py
===================================================================
--- issm/trunk/test/NightlyRun/test313.py	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/NightlyRun/test313.py	2016-04-13 04:32:01 UTC (rev 20500)
@@ -17,6 +17,7 @@
 md.verbose=verbose('convergence',True,'solution',True)
 md.transient.isstressbalance=False
 md.transient.ismasstransport=False
+md.transient.issmb=True
 md.transient.isthermal=True
 md.transient.isgroundingline=False
 md=solve(md,TransientSolutionEnum())

Modified: issm/trunk/test/NightlyRun/test314.m
===================================================================
--- issm/trunk/test/NightlyRun/test314.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/NightlyRun/test314.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -4,11 +4,18 @@
 md=parameterize(md,'../Par/SquareSheetConstrained.par');
 md=setflowequation(md,'SIA','all');
 md.cluster=generic('name',oshostname(),'np',3);
+md.transient.requested_outputs={'default','GroundedArea','FloatingArea','IceVolume'};
 md=solve(md,TransientSolutionEnum());
 
 %Fields and tolerances to track changes
-field_names     ={'Vx1','Vy1','Vel1','Pressure1','Bed1','Surface1','Thickness1','Vx2','Vy2','Vel2','Pressure2','Bed2','Surface2','Thickness2','Vx3','Vy3','Vel3','Pressure3','Bed3','Surface3','Thickness3'};
-field_tolerances={1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-10,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-10,1.5e-13,1.5e-13,1e-13,1e-13,1e-13,1e-13};
+field_names     ={...
+	'Vx1','Vy1','Vel1','Pressure1','Bed1','Surface1','Thickness1','GroundedArea1','FloatingArea1',...
+	'Vx2','Vy2','Vel2','Pressure2','Bed2','Surface2','Thickness2','GroundedArea2','FloatingArea2',...
+	'Vx3','Vy3','Vel3','Pressure3','Bed3','Surface3','Thickness3','GroundedArea3','FloatingArea3'};
+field_tolerances={...
+	1e-13 , 1e-13   , 1e-13   , 1e-13 , 1e-13 , 1e-13 , 1e-13   , 1e-13 , 1e-13...
+	1e-10 , 1e-13   , 1e-13   , 1e-13 , 1e-13 , 1e-13 , 1e-13   , 1e-13 , 1e-13...
+	1e-10 , 1.5e-13 , 1.5e-13 , 1e-13 , 1e-13 , 1e-13 , 1e-13,    1e-13 , 1e-13};
 field_values={...
 	(md.results.TransientSolution(1).Vx),...
 	(md.results.TransientSolution(1).Vy),...
@@ -17,6 +24,8 @@
 	(md.results.TransientSolution(1).Base),...
 	(md.results.TransientSolution(1).Surface),...
 	(md.results.TransientSolution(1).Thickness),...
+	(md.results.TransientSolution(1).GroundedArea),...
+	(md.results.TransientSolution(1).FloatingArea),...
 	(md.results.TransientSolution(2).Vx),...
 	(md.results.TransientSolution(2).Vy),...
 	(md.results.TransientSolution(2).Vel),...
@@ -24,6 +33,8 @@
 	(md.results.TransientSolution(2).Base),...
 	(md.results.TransientSolution(2).Surface),...
 	(md.results.TransientSolution(2).Thickness),...
+	(md.results.TransientSolution(2).GroundedArea),...
+	(md.results.TransientSolution(2).FloatingArea),...
 	(md.results.TransientSolution(3).Vx),...
 	(md.results.TransientSolution(3).Vy),...
 	(md.results.TransientSolution(3).Vel),...
@@ -31,4 +42,6 @@
 	(md.results.TransientSolution(3).Base),...
 	(md.results.TransientSolution(3).Surface),...
 	(md.results.TransientSolution(3).Thickness),...
+	(md.results.TransientSolution(3).GroundedArea),...
+	(md.results.TransientSolution(3).FloatingArea),...
 	};

Modified: issm/trunk/test/NightlyRun/test314.py
===================================================================
--- issm/trunk/test/NightlyRun/test314.py	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/NightlyRun/test314.py	2016-04-13 04:32:01 UTC (rev 20500)
@@ -13,11 +13,18 @@
 md=parameterize(md,'../Par/SquareSheetConstrained.py')
 md=setflowequation(md,'SIA','all')
 md.cluster=generic('name',oshostname(),'np',3)
+md.transient.requested_outputs=['default','GroundedArea','FloatingArea','IceVolume']
 md=solve(md,TransientSolutionEnum())
 
 #Fields and tolerances to track changes
-field_names     =['Vx1','Vy1','Vel1','Pressure1','Bed1','Surface1','Thickness1','Vx2','Vy2','Vel2','Pressure2','Bed2','Surface2','Thickness2','Vx3','Vy3','Vel3','Pressure3','Bed3','Surface3','Thickness3']
-field_tolerances=[1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-10,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-10,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13]
+field_names     =[
+'Vx1','Vy1','Vel1','Pressure1','Bed1','Surface1','Thickness1','GroundedArea1','FloatingArea1',
+'Vx2','Vy2','Vel2','Pressure2','Bed2','Surface2','Thickness2','GroundedArea2','FloatingArea2',
+'Vx3','Vy3','Vel3','Pressure3','Bed3','Surface3','Thickness3','GroundedArea3','FloatingArea3']
+field_tolerances=[
+		1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,
+		1e-10,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,
+		1e-10,1.5e-13,1.5e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13]
 field_values=[\
 	md.results.TransientSolution[0].Vx,\
 	md.results.TransientSolution[0].Vy,\
@@ -26,6 +33,8 @@
 	md.results.TransientSolution[0].Base,\
 	md.results.TransientSolution[0].Surface,\
 	md.results.TransientSolution[0].Thickness,\
+	md.results.TransientSolution[0].GroundedArea,\
+	md.results.TransientSolution[0].FloatingArea,\
 	md.results.TransientSolution[1].Vx,\
 	md.results.TransientSolution[1].Vy,\
 	md.results.TransientSolution[1].Vel,\
@@ -33,6 +42,8 @@
 	md.results.TransientSolution[1].Base,\
 	md.results.TransientSolution[1].Surface,\
 	md.results.TransientSolution[1].Thickness,\
+	md.results.TransientSolution[1].GroundedArea,\
+	md.results.TransientSolution[1].FloatingArea,\
 	md.results.TransientSolution[2].Vx,\
 	md.results.TransientSolution[2].Vy,\
 	md.results.TransientSolution[2].Vel,\
@@ -40,4 +51,6 @@
 	md.results.TransientSolution[2].Base,\
 	md.results.TransientSolution[2].Surface,\
 	md.results.TransientSolution[2].Thickness,\
+	md.results.TransientSolution[2].GroundedArea,\
+	md.results.TransientSolution[2].FloatingArea,\
 	]

Modified: issm/trunk/test/NightlyRun/test315.m
===================================================================
--- issm/trunk/test/NightlyRun/test315.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/NightlyRun/test315.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -12,8 +12,8 @@
 	'Vx2','Vy2','Vz2','Vel2','Pressure2','Bed2','Surface2','Thickness2','Temperature2','BasalforcingsGroundediceMeltingRate2',...
 	'Vx3','Vy3','Vz3','Vel3','Pressure3','Bed3','Surface3','Thickness3','Temperature3','BasalforcingsGroundediceMeltingRate3'};
 field_tolerances={1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,...,
-	1e-10,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,...
-	1e-10,2e-13,2e-13,2e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13};
+	1e-10,1e-13,5e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,...
+	1e-10,2e-13,5e-13,2e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13};
 field_values={...
 	(md.results.TransientSolution(1).Vx),...
 	(md.results.TransientSolution(1).Vy),...

Modified: issm/trunk/test/NightlyRun/test315.py
===================================================================
--- issm/trunk/test/NightlyRun/test315.py	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/NightlyRun/test315.py	2016-04-13 04:32:01 UTC (rev 20500)
@@ -21,8 +21,8 @@
 	'Vx2','Vy2','Vz2','Vel2','Pressure2','Bed2','Surface2','Thickness2','Temperature2','BasalforcingsGroundediceMeltingRate2',\
 	'Vx3','Vy3','Vz3','Vel3','Pressure3','Bed3','Surface3','Thickness3','Temperature3','BasalforcingsGroundediceMeltingRate3']
 field_tolerances=[1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,\
-	1e-10,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,\
-	1e-10,2e-13,2e-13,2e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13]
+	1e-10,1e-13,5e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,\
+	1e-10,2e-13,5e-13,2e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13]
 field_values=[\
 	md.results.TransientSolution[0].Vx,\
 	md.results.TransientSolution[0].Vy,\

Modified: issm/trunk/test/NightlyRun/test317.m
===================================================================
--- issm/trunk/test/NightlyRun/test317.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/NightlyRun/test317.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -2,18 +2,20 @@
 md=triangle(model(),'../Exp/Square.exp',200000.);
 md=setmask(md,'','');
 md=parameterize(md,'../Par/SquareSheetConstrained.par');
+md.basalforcings.groundedice_melting_rate(:)=5;
 md=extrude(md,3,1.);
 md=setflowequation(md,'HO','all');
 md.cluster=generic('name',oshostname(),'np',3);
+md.transient.requested_outputs={'default','GroundedArea','FloatingArea','TotalFloatingBmb','TotalGroundedBmb'};
 md=solve(md,TransientSolutionEnum());
 
 %Fields and tolerances to track changes
-field_names     ={'Vx1','Vy1','Vz1','Vel1','Pressure1','Bed1','Surface1','Thickness1','Temperature1','BasalforcingsGroundediceMeltingRate1',...
-	'Vx2','Vy2','Vz2','Vel2','Pressure2','Bed2','Surface2','Thickness2','Temperature2','BasalforcingsGroundediceMeltingRate2',...
-	'Vx3','Vy3','Vz3','Vel3','Pressure3','Bed3','Surface3','Thickness3','Temperature3','BasalforcingsGroundediceMeltingRate3'};
-field_tolerances={1e-09,1e-09,1e-09,1e-09,1e-10,1e-10,1e-10,1e-10,1e-10,1e-10,...
-	1e-09,1e-09,1e-09,1e-09,1e-10,1e-10,1e-10,1e-10,1e-10,1e-10,...
-	1e-09,5e-10,1e-09,1e-09,1e-10,1e-10,1e-10,1e-10,1e-10,1e-10};
+field_names     ={'Vx1','Vy1','Vz1','Vel1','Pressure1','Bed1','Surface1','Thickness1','Temperature1','BasalforcingsGroundediceMeltingRate1','GroundedArea1','FloatingArea1','TotalFloatingBmb1','TotalGroundedBmb1'...
+	'Vx2','Vy2','Vz2','Vel2','Pressure2','Bed2','Surface2','Thickness2','Temperature2','BasalforcingsGroundediceMeltingRate2','GroundedArea2','FloatingArea2','TotalFloatingBmb2','TotalGroundedBmb2',...
+	'Vx3','Vy3','Vz3','Vel3','Pressure3','Bed3','Surface3','Thickness3','Temperature3','BasalforcingsGroundediceMeltingRate3','GroundedArea3','FloatingArea3','TotalFloatingBmb3','TotalGroundedBmb3'};
+field_tolerances={1e-09,1e-09,1e-09,1e-09,1e-10,1e-10,1e-10,1e-10,1e-10,1e-10,1e-12,1e-12,1e-12,1e-12,...
+	1e-09,1e-09,1e-09,1e-09,1e-10,1e-10,1e-10,1e-10,1e-10,1e-10,1e-12,1e-12,1e-12,1e-12,...
+	1e-09,5e-10,1e-09,1e-09,1e-10,1e-10,1e-10,1e-10,1e-10,1e-10,1e-12,1e-12,1e-12,1e-12};
 field_values={...
 	(md.results.TransientSolution(1).Vx),...
 	(md.results.TransientSolution(1).Vy),...
@@ -25,6 +27,10 @@
 	(md.results.TransientSolution(1).Thickness),...
 	(md.results.TransientSolution(1).Temperature),...
 	(md.results.TransientSolution(1).BasalforcingsGroundediceMeltingRate),...
+	(md.results.TransientSolution(1).GroundedArea),...
+	(md.results.TransientSolution(1).FloatingArea),...
+	(md.results.TransientSolution(1).TotalFloatingBmb),...
+	(md.results.TransientSolution(1).TotalGroundedBmb),...
 	(md.results.TransientSolution(2).Vx),...
 	(md.results.TransientSolution(2).Vy),...
 	(md.results.TransientSolution(2).Vz),...
@@ -35,6 +41,10 @@
 	(md.results.TransientSolution(2).Thickness),...
 	(md.results.TransientSolution(2).Temperature),...
 	(md.results.TransientSolution(2).BasalforcingsGroundediceMeltingRate),...
+	(md.results.TransientSolution(2).GroundedArea),...
+	(md.results.TransientSolution(2).FloatingArea),...
+	(md.results.TransientSolution(2).TotalFloatingBmb),...
+	(md.results.TransientSolution(2).TotalGroundedBmb),...
 	(md.results.TransientSolution(3).Vx),...
 	(md.results.TransientSolution(3).Vy),...
 	(md.results.TransientSolution(3).Vz),...
@@ -45,4 +55,8 @@
 	(md.results.TransientSolution(3).Thickness),...
 	(md.results.TransientSolution(3).Temperature),...
 	(md.results.TransientSolution(3).BasalforcingsGroundediceMeltingRate),...
+	(md.results.TransientSolution(3).GroundedArea),...
+	(md.results.TransientSolution(3).FloatingArea),...
+	(md.results.TransientSolution(3).TotalFloatingBmb),...
+	(md.results.TransientSolution(3).TotalGroundedBmb),...
 	};

Modified: issm/trunk/test/NightlyRun/test317.py
===================================================================
--- issm/trunk/test/NightlyRun/test317.py	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/NightlyRun/test317.py	2016-04-13 04:32:01 UTC (rev 20500)
@@ -11,18 +11,20 @@
 md=triangle(model(),'../Exp/Square.exp',200000.)
 md=setmask(md,'','')
 md=parameterize(md,'../Par/SquareSheetConstrained.py')
+md.basalforcings.groundedice_melting_rate[:]=5.
 md.extrude(3,1.)
 md=setflowequation(md,'HO','all')
 md.cluster=generic('name',oshostname(),'np',3)
+md.transient.requested_outputs=['default','GroundedArea','FloatingArea','TotalFloatingBmb','TotalGroundedBmb']
 md=solve(md,TransientSolutionEnum())
 
 #Fields and tolerances to track changes
-field_names     =['Vx1','Vy1','Vz1','Vel1','Pressure1','Bed1','Surface1','Thickness1','Temperature1','BasalforcingsGroundediceMeltingRate1',\
-	'Vx2','Vy2','Vz2','Vel2','Pressure2','Bed2','Surface2','Thickness2','Temperature2','BasalforcingsGroundediceMeltingRate2',\
-	'Vx3','Vy3','Vz3','Vel3','Pressure3','Bed3','Surface3','Thickness3','Temperature3','BasalforcingsGroundediceMeltingRate3']
-field_tolerances=[1e-09,1e-09,1e-09,1e-09,1e-10,1e-10,1e-10,1e-10,1e-10,1e-10,\
-		1e-09,1e-09,1e-09,1e-09,1e-10,1e-10,1e-10,1e-10,1e-10,1e-10,\
-		1e-09,5e-10,1e-09,1e-09,1e-10,1e-10,1e-10,1e-10,1e-10,1e-10]
+field_names     =['Vx1','Vy1','Vz1','Vel1','Pressure1','Bed1','Surface1','Thickness1','Temperature1','BasalforcingsGroundediceMeltingRate1','GroundedArea1','FloatingArea1','TotalFloatingBmb1','TotalGroundedBmb1'\
+	'Vx2','Vy2','Vz2','Vel2','Pressure2','Bed2','Surface2','Thickness2','Temperature2','BasalforcingsGroundediceMeltingRate2','GroundedArea2','FloatingArea2','TotalFloatingBmb2','TotalGroundedBmb2',\
+	'Vx3','Vy3','Vz3','Vel3','Pressure3','Bed3','Surface3','Thickness3','Temperature3','BasalforcingsGroundediceMeltingRate3','GroundedArea3','FloatingArea3','TotalFloatingBmb2','TotalGroundedBmb2']
+field_tolerances=[1e-09,1e-09,1e-09,1e-09,1e-10,1e-10,1e-10,1e-10,1e-10,1e-10,1e-12,1e-12,1e-12,1e-12,\
+		1e-09,1e-09,1e-09,1e-09,1e-10,1e-10,1e-10,1e-10,1e-10,1e-10,1e-12,1e-12,1e-12,1e-12,\
+		1e-09,5e-10,1e-09,1e-09,1e-10,1e-10,1e-10,1e-10,1e-10,1e-10,1e-12,1e-12,1e-12,1e-12]
 field_values=[\
 	md.results.TransientSolution[0].Vx,\
 	md.results.TransientSolution[0].Vy,\
@@ -34,6 +36,10 @@
 	md.results.TransientSolution[0].Thickness,\
 	md.results.TransientSolution[0].Temperature,\
 	md.results.TransientSolution[0].BasalforcingsGroundediceMeltingRate,\
+	md.results.TransientSolution[0].GroundedArea,\
+	md.results.TransientSolution[0].FloatingArea,\
+	md.results.TransientSolution[0].TotalFloatingBmb,\
+	md.results.TransientSolution[0].TotalGroundedBmb,\
 	md.results.TransientSolution[1].Vx,\
 	md.results.TransientSolution[1].Vy,\
 	md.results.TransientSolution[1].Vz,\
@@ -44,6 +50,10 @@
 	md.results.TransientSolution[1].Thickness,\
 	md.results.TransientSolution[1].Temperature,\
 	md.results.TransientSolution[1].BasalforcingsGroundediceMeltingRate,\
+	md.results.TransientSolution[1].GroundedArea,\
+	md.results.TransientSolution[1].FloatingArea,\
+	md.results.TransientSolution[1].TotalFloatingBmb,\
+	md.results.TransientSolution[1].TotalGroundedBmb,\
 	md.results.TransientSolution[2].Vx,\
 	md.results.TransientSolution[2].Vy,\
 	md.results.TransientSolution[2].Vz,\
@@ -54,4 +64,8 @@
 	md.results.TransientSolution[2].Thickness,\
 	md.results.TransientSolution[2].Temperature,\
 	md.results.TransientSolution[2].BasalforcingsGroundediceMeltingRate,\
+	md.results.TransientSolution[2].GroundedArea,\
+	md.results.TransientSolution[2].FloatingArea,\
+	md.results.TransientSolution[2].TotalFloatingBmb,\
+	md.results.TransientSolution[2].TotalGroundedBmb,\
 	]

Modified: issm/trunk/test/NightlyRun/test318.m
===================================================================
--- issm/trunk/test/NightlyRun/test318.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/NightlyRun/test318.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -10,7 +10,7 @@
 
 %Fields and tolerances to track changes
 field_names     ={'Vx','Vy','Vz','Vel','Pressure','Temperature','BasalforcingsGroundediceMeltingRate'};
-field_tolerances={1e-13,1e-13,4e-10,1e-10,1e-13,1e-11,1e-6};
+field_tolerances={1e-13,1e-13,6e-10,1e-10,1e-13,1e-11,1e-6};
 field_values={...
 	(md.results.SteadystateSolution.Vx),...
 	(md.results.SteadystateSolution.Vy),...

Modified: issm/trunk/test/NightlyRun/test318.py
===================================================================
--- issm/trunk/test/NightlyRun/test318.py	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/NightlyRun/test318.py	2016-04-13 04:32:01 UTC (rev 20500)
@@ -19,7 +19,7 @@
 
 #Fields and tolerances to track changes
 field_names     =['Vx','Vy','Vz','Vel','Pressure','Temperature','BasalforcingsGroundediceMeltingRate']
-field_tolerances=[1e-13,1e-13,1.5e-10,1e-10,1e-13,1e-11,1e-6]
+field_tolerances=[1e-13,1e-13,1.6e-10,1e-10,1e-13,1e-11,1e-6]
 field_values=[\
 	md.results.SteadystateSolution.Vx,\
 	md.results.SteadystateSolution.Vy,\

Modified: issm/trunk/test/NightlyRun/test323.m
===================================================================
--- issm/trunk/test/NightlyRun/test323.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/NightlyRun/test323.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -5,7 +5,7 @@
 md=setflowequation(md,'SSA','all');
 md.cluster=generic('name',oshostname(),'np',3);
 md.timestepping.time_adapt=1;
-md.timestepping.final_time=650.;
+md.timestepping.final_time=1120.;
 md=solve(md,TransientSolutionEnum());
 
 %Fields and tolerances to track changes

Modified: issm/trunk/test/NightlyRun/test323.py
===================================================================
--- issm/trunk/test/NightlyRun/test323.py	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/NightlyRun/test323.py	2016-04-13 04:32:01 UTC (rev 20500)
@@ -15,7 +15,7 @@
 md=setflowequation(md,'SSA','all')
 md.cluster=generic('name',oshostname(),'np',3)
 md.timestepping.time_adapt=1
-md.timestepping.final_time=650.
+md.timestepping.final_time=1120.
 md=solve(md,TransientSolutionEnum())
 
 #Fields and tolerances to track changes

Modified: issm/trunk/test/NightlyRun/test324.m
===================================================================
--- issm/trunk/test/NightlyRun/test324.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/NightlyRun/test324.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -6,16 +6,16 @@
 md=setflowequation(md,'SIA','all');
 md.cluster=generic('name',oshostname(),'np',3);
 md.timestepping.time_adapt=1;
-md.timestepping.final_time=500.;
+md.timestepping.final_time=16000.;
 md=solve(md,TransientSolutionEnum());
 
 %Fields and tolerances to track changes
 field_names     ={'Vx1','Vy1','Vz1','Vel1','Pressure1','Bed1','Surface1','Thickness1','Temperature1','BasalforcingsGroundediceMeltingRate1',...
-	'Vx2','Vy2','Vz2','Vel2','Pressure2','Bed2','Surface2','Thickness2','Temperature2','BasalforcingsGroundediceMeltingRate2'};
-	%'Vx3','Vy3','Vz3','Vel3','Pressure3','Bed3','Surface3','Thickness3','Temperature3','BasalforcingsGroundediceMeltingRate3'};
-field_tolerances={1e-13,  1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,...,
-	5*1e-11,1e-13,1.5e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13};
-	%1e-10,  1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13};
+	'Vx2','Vy2','Vz2','Vel2','Pressure2','Bed2','Surface2','Thickness2','Temperature2','BasalforcingsGroundediceMeltingRate2',...
+	'Vx3','Vy3','Vz3','Vel3','Pressure3','Bed3','Surface3','Thickness3','Temperature3','BasalforcingsGroundediceMeltingRate3'};
+field_tolerances={1e-13,  1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,...
+	5*1e-11,1e-13,5e-13,1e-13,1e-13,1e-13,5e-13,1e-13,1e-13,1e-13,...
+	1e-10,  1e-12,1e-12,1e-12,1e-13,1e-13,1e-12,1e-12,1e-13,1e-13};
 field_values={...
 	(md.results.TransientSolution(1).Vx),...
 	(md.results.TransientSolution(1).Vy),...
@@ -37,14 +37,14 @@
 	(md.results.TransientSolution(2).Thickness),...
 	(md.results.TransientSolution(2).Temperature),...
 	(md.results.TransientSolution(2).BasalforcingsGroundediceMeltingRate),...
-%	(md.results.TransientSolution(3).Vx),...
-%	(md.results.TransientSolution(3).Vy),...
-%	(md.results.TransientSolution(3).Vz),...
-%	(md.results.TransientSolution(3).Vel),...
-%	(md.results.TransientSolution(3).Pressure),...
-%	(md.results.TransientSolution(3).Base),...
-%	(md.results.TransientSolution(3).Surface),...
-%	(md.results.TransientSolution(3).Thickness),...
-%	(md.results.TransientSolution(3).Temperature),...
-%	(md.results.TransientSolution(3).BasalforcingsGroundediceMeltingRate),...
+	(md.results.TransientSolution(3).Vx),...
+	(md.results.TransientSolution(3).Vy),...
+	(md.results.TransientSolution(3).Vz),...
+	(md.results.TransientSolution(3).Vel),...
+	(md.results.TransientSolution(3).Pressure),...
+	(md.results.TransientSolution(3).Base),...
+	(md.results.TransientSolution(3).Surface),...
+	(md.results.TransientSolution(3).Thickness),...
+	(md.results.TransientSolution(3).Temperature),...
+	(md.results.TransientSolution(3).BasalforcingsGroundediceMeltingRate),...
 	};

Modified: issm/trunk/test/NightlyRun/test324.py
===================================================================
--- issm/trunk/test/NightlyRun/test324.py	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/NightlyRun/test324.py	2016-04-13 04:32:01 UTC (rev 20500)
@@ -16,16 +16,16 @@
 md=setflowequation(md,'SIA','all')
 md.cluster=generic('name',oshostname(),'np',3)
 md.timestepping.time_adapt=1
-md.timestepping.final_time=500.
+md.timestepping.final_time=16000.
 md=solve(md,TransientSolutionEnum())
 
 #Fields and tolerances to track changes
 field_names     =['Vx1','Vy1','Vz1','Vel1','Pressure1','Bed1','Surface1','Thickness1','Temperature1','BasalforcingsGroundediceMeltingRate1',\
-	'Vx2','Vy2','Vz2','Vel2','Pressure2','Bed2','Surface2','Thickness2','Temperature2','BasalforcingsGroundediceMeltingRate2']
-	#'Vx3','Vy3','Vz3','Vel3','Pressure3','Bed3','Surface3','Thickness3','Temperature3','BasalforcingsGroundediceMeltingRate3']
+	'Vx2','Vy2','Vz2','Vel2','Pressure2','Bed2','Surface2','Thickness2','Temperature2','BasalforcingsGroundediceMeltingRate2',\
+	'Vx3','Vy3','Vz3','Vel3','Pressure3','Bed3','Surface3','Thickness3','Temperature3','BasalforcingsGroundediceMeltingRate3']
 field_tolerances=[1e-13,  1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,\
-	5*1e-11,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,\
-	1e-10,  1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13]
+	5*1e-11,1e-13,5e-13,1e-13,1e-13,1e-13,5e-13,1e-13,1e-13,1e-13,\
+	1e-10,  1e-12,1e-12,1e-12,1e-13,1e-13,1e-12,1e-12,1e-13,1e-13]
 field_values=[\
 	md.results.TransientSolution[0].Vx,\
 	md.results.TransientSolution[0].Vy,\
@@ -47,14 +47,14 @@
 	md.results.TransientSolution[1].Thickness,\
 	md.results.TransientSolution[1].Temperature,\
 	md.results.TransientSolution[1].BasalforcingsGroundediceMeltingRate,\
-#	md.results.TransientSolution[2].Vx,\
-#	md.results.TransientSolution[2].Vy,\
-#	md.results.TransientSolution[2].Vz,\
-#	md.results.TransientSolution[2].Vel,\
-#	md.results.TransientSolution[2].Pressure,\
-#	md.results.TransientSolution[2].Base,\
-#	md.results.TransientSolution[2].Surface,\
-#	md.results.TransientSolution[2].Thickness,\
-#	md.results.TransientSolution[2].Temperature,\
-#	md.results.TransientSolution[2].BasalforcingsGroundediceMeltingRate,\
+	md.results.TransientSolution[2].Vx,\
+	md.results.TransientSolution[2].Vy,\
+	md.results.TransientSolution[2].Vz,\
+	md.results.TransientSolution[2].Vel,\
+	md.results.TransientSolution[2].Pressure,\
+	md.results.TransientSolution[2].Base,\
+	md.results.TransientSolution[2].Surface,\
+	md.results.TransientSolution[2].Thickness,\
+	md.results.TransientSolution[2].Temperature,\
+	md.results.TransientSolution[2].BasalforcingsGroundediceMeltingRate,\
 	]

Modified: issm/trunk/test/NightlyRun/test326.m
===================================================================
--- issm/trunk/test/NightlyRun/test326.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/NightlyRun/test326.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -9,6 +9,7 @@
 md.initialization.watercolumn=zeros(md.mesh.numberofvertices,1);
 md.transient.isstressbalance=0;
 md.transient.ismasstransport=0;
+md.transient.issmb=1;
 md.transient.isthermal=1;
 md.transient.isgroundingline=0;
 md.thermal.isenthalpy=1;

Modified: issm/trunk/test/NightlyRun/test326.py
===================================================================
--- issm/trunk/test/NightlyRun/test326.py	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/NightlyRun/test326.py	2016-04-13 04:32:01 UTC (rev 20500)
@@ -19,6 +19,7 @@
 md.initialization.watercolumn=numpy.zeros((md.mesh.numberofvertices,1))
 md.transient.isstressbalance=False
 md.transient.ismasstransport=False
+md.transient.issmb=True
 md.transient.isthermal=True
 md.transient.isgroundingline=False
 md.thermal.isenthalpy=1

Modified: issm/trunk/test/NightlyRun/test328.m
===================================================================
--- issm/trunk/test/NightlyRun/test328.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/NightlyRun/test328.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -3,11 +3,11 @@
 md=setmask(md,'','');
 md=parameterize(md,'../Par/SquareSheetConstrained.par');
 md=setflowequation(md,'SSA','all');
-md.surfaceforcings = SMBgradients();
-md.surfaceforcings.b_pos=-100. + 0.00005*md.mesh.x - 0.0001*md.mesh.y;
-md.surfaceforcings.b_neg=250. + 0.000051*md.mesh.x - 0.00011*md.mesh.y;
-md.surfaceforcings.href=md.geometry.surface;
-md.surfaceforcings.smbref= 1000. - 0.001*md.mesh.x - 0.005*md.mesh.y;
+md.smb = SMBgradients();
+md.smb.b_pos=-100. + 0.00005*md.mesh.x - 0.0001*md.mesh.y;
+md.smb.b_neg=250. + 0.000051*md.mesh.x - 0.00011*md.mesh.y;
+md.smb.href=md.geometry.surface;
+md.smb.smbref= 1000. - 0.001*md.mesh.x - 0.005*md.mesh.y;
 md.transient.requested_outputs={'default','TotalSmb'};
 md.cluster=generic('name',oshostname(),'np',3);
 md=solve(md,TransientSolutionEnum());
@@ -22,7 +22,7 @@
 	(md.results.TransientSolution(1).Base),...
 	(md.results.TransientSolution(1).Surface),...
 	(md.results.TransientSolution(1).Thickness),...
-	(md.results.TransientSolution(1).SurfaceforcingsMassBalance),...
+	(md.results.TransientSolution(1).SmbMassBalance),...
 	(md.results.TransientSolution(1).TotalSmb),...
 	(md.results.TransientSolution(2).Vx),...
 	(md.results.TransientSolution(2).Vy),...
@@ -31,13 +31,13 @@
 	(md.results.TransientSolution(2).Surface),...
 	(md.results.TransientSolution(2).Thickness),...
 	(md.results.TransientSolution(2).TotalSmb),...
-	(md.results.TransientSolution(2).SurfaceforcingsMassBalance),...
+	(md.results.TransientSolution(2).SmbMassBalance),...
 	(md.results.TransientSolution(3).Vx),...
 	(md.results.TransientSolution(3).Vy),...
 	(md.results.TransientSolution(3).Vel),...
 	(md.results.TransientSolution(3).Base),...
 	(md.results.TransientSolution(3).Surface),...
 	(md.results.TransientSolution(3).Thickness),...
-	(md.results.TransientSolution(3).SurfaceforcingsMassBalance),...
+	(md.results.TransientSolution(3).SmbMassBalance),...
 	(md.results.TransientSolution(3).TotalSmb),...
 	};

Modified: issm/trunk/test/NightlyRun/test328.py
===================================================================
--- issm/trunk/test/NightlyRun/test328.py	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/NightlyRun/test328.py	2016-04-13 04:32:01 UTC (rev 20500)
@@ -14,12 +14,12 @@
 md=setmask(md,'','')
 md=parameterize(md,'../Par/SquareSheetConstrained.py')
 md=setflowequation(md,'SSA','all')
-md.surfaceforcings = SMBgradients();
-md.surfaceforcings.b_pos=-100. + 0.00005*md.mesh.x - 0.0001*md.mesh.y
-md.surfaceforcings.b_neg=250. + 0.000051*md.mesh.x - 0.00011*md.mesh.y
+md.smb = SMBgradients();
+md.smb.b_pos=-100. + 0.00005*md.mesh.x - 0.0001*md.mesh.y
+md.smb.b_neg=250. + 0.000051*md.mesh.x - 0.00011*md.mesh.y
 md.transient.requested_outputs=['default','TotalSmb']
-md.surfaceforcings.href=copy.deepcopy(md.geometry.surface).reshape(-1)
-md.surfaceforcings.smbref= 1000. - 0.001*md.mesh.x - 0.005*md.mesh.y;
+md.smb.href=copy.deepcopy(md.geometry.surface).reshape(-1)
+md.smb.smbref= 1000. - 0.001*md.mesh.x - 0.005*md.mesh.y;
 md.cluster=generic('name',oshostname(),'np',3)
 md=solve(md,TransientSolutionEnum())
 
@@ -33,7 +33,7 @@
 	md.results.TransientSolution[0].Base,\
 	md.results.TransientSolution[0].Surface,\
 	md.results.TransientSolution[0].Thickness,\
-	md.results.TransientSolution[0].SurfaceforcingsMassBalance,\
+	md.results.TransientSolution[0].SmbMassBalance,\
 	md.results.TransientSolution[0].TotalSmb,\
 	md.results.TransientSolution[1].Vx,\
 	md.results.TransientSolution[1].Vy,\
@@ -42,13 +42,13 @@
 	md.results.TransientSolution[1].Surface,\
 	md.results.TransientSolution[1].Thickness,\
 	md.results.TransientSolution[1].TotalSmb,\
-	md.results.TransientSolution[1].SurfaceforcingsMassBalance,\
+	md.results.TransientSolution[1].SmbMassBalance,\
 	md.results.TransientSolution[2].Vx,\
 	md.results.TransientSolution[2].Vy,\
 	md.results.TransientSolution[2].Vel,\
 	md.results.TransientSolution[2].Base,\
 	md.results.TransientSolution[2].Surface,\
 	md.results.TransientSolution[2].Thickness,\
-	md.results.TransientSolution[2].SurfaceforcingsMassBalance,\
+	md.results.TransientSolution[2].SmbMassBalance,\
 	md.results.TransientSolution[2].TotalSmb,\
 	]

Modified: issm/trunk/test/NightlyRun/test329.m
===================================================================
--- issm/trunk/test/NightlyRun/test329.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/NightlyRun/test329.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -4,11 +4,11 @@
 md=parameterize(md,'../Par/SquareSheetConstrained.par');
 md=extrude(md,3,1.);
 md=setflowequation(md,'HO','all');
-md.surfaceforcings = SMBgradients();
-md.surfaceforcings.b_pos=-100. + 0.00005*md.mesh.x - 0.0001*md.mesh.y;
-md.surfaceforcings.b_neg=250. + 0.000051*md.mesh.x - 0.00011*md.mesh.y;
-md.surfaceforcings.href=md.geometry.surface;
-md.surfaceforcings.smbref= 1000. - 0.001*md.mesh.x - 0.005*md.mesh.y;
+md.smb = SMBgradients();
+md.smb.b_pos=-100. + 0.00005*md.mesh.x - 0.0001*md.mesh.y;
+md.smb.b_neg=250. + 0.000051*md.mesh.x - 0.00011*md.mesh.y;
+md.smb.href=md.geometry.surface;
+md.smb.smbref= 1000. - 0.001*md.mesh.x - 0.005*md.mesh.y;
 md.transient.requested_outputs={'default','TotalSmb'};
 md.cluster=generic('name',oshostname(),'np',3);
 md=solve(md,TransientSolutionEnum());
@@ -27,7 +27,7 @@
 	(md.results.TransientSolution(1).Surface),...
 	(md.results.TransientSolution(1).Thickness),...
 	(md.results.TransientSolution(1).Temperature),...
-	(md.results.TransientSolution(1).SurfaceforcingsMassBalance),...
+	(md.results.TransientSolution(1).SmbMassBalance),...
 	(md.results.TransientSolution(1).TotalSmb),...
 	(md.results.TransientSolution(2).Vx),...
 	(md.results.TransientSolution(2).Vy),...
@@ -37,7 +37,7 @@
 	(md.results.TransientSolution(2).Surface),...
 	(md.results.TransientSolution(2).Thickness),...
 	(md.results.TransientSolution(2).Temperature),...
-	(md.results.TransientSolution(2).SurfaceforcingsMassBalance),...
+	(md.results.TransientSolution(2).SmbMassBalance),...
 	(md.results.TransientSolution(2).TotalSmb),...
 	(md.results.TransientSolution(3).Vx),...
 	(md.results.TransientSolution(3).Vy),...
@@ -47,6 +47,6 @@
 	(md.results.TransientSolution(3).Surface),...
 	(md.results.TransientSolution(3).Thickness),...
 	(md.results.TransientSolution(3).Temperature),...
-	(md.results.TransientSolution(3).SurfaceforcingsMassBalance),...
+	(md.results.TransientSolution(3).SmbMassBalance),...
 	(md.results.TransientSolution(3).TotalSmb),...
 	};

Modified: issm/trunk/test/NightlyRun/test329.py
===================================================================
--- issm/trunk/test/NightlyRun/test329.py	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/NightlyRun/test329.py	2016-04-13 04:32:01 UTC (rev 20500)
@@ -15,11 +15,11 @@
 md=parameterize(md,'../Par/SquareSheetConstrained.py')
 md.extrude(3,1)
 md=setflowequation(md,'HO','all')
-md.surfaceforcings = SMBgradients();
-md.surfaceforcings.b_pos=-100. + 0.00005*md.mesh.x - 0.0001*md.mesh.y
-md.surfaceforcings.b_neg=250. + 0.000051*md.mesh.x - 0.00011*md.mesh.y
-md.surfaceforcings.href=copy.deepcopy(md.geometry.surface).reshape(-1)
-md.surfaceforcings.smbref= 1000. - 0.001*md.mesh.x - 0.005*md.mesh.y;
+md.smb = SMBgradients();
+md.smb.b_pos=-100. + 0.00005*md.mesh.x - 0.0001*md.mesh.y
+md.smb.b_neg=250. + 0.000051*md.mesh.x - 0.00011*md.mesh.y
+md.smb.href=copy.deepcopy(md.geometry.surface).reshape(-1)
+md.smb.smbref= 1000. - 0.001*md.mesh.x - 0.005*md.mesh.y;
 md.transient.requested_outputs=['default','TotalSmb']
 md.cluster=generic('name',oshostname(),'np',3)
 md=solve(md,TransientSolutionEnum())
@@ -38,7 +38,7 @@
 	md.results.TransientSolution[0].Surface,\
 	md.results.TransientSolution[0].Thickness,\
 	md.results.TransientSolution[0].Temperature,\
-	md.results.TransientSolution[0].SurfaceforcingsMassBalance,\
+	md.results.TransientSolution[0].SmbMassBalance,\
 	md.results.TransientSolution[0].TotalSmb,\
 	md.results.TransientSolution[1].Vx,\
 	md.results.TransientSolution[1].Vy,\
@@ -48,7 +48,7 @@
 	md.results.TransientSolution[1].Surface,\
 	md.results.TransientSolution[1].Thickness,\
 	md.results.TransientSolution[1].Temperature,\
-	md.results.TransientSolution[1].SurfaceforcingsMassBalance,\
+	md.results.TransientSolution[1].SmbMassBalance,\
 	md.results.TransientSolution[1].TotalSmb,\
 	md.results.TransientSolution[2].Vx,\
 	md.results.TransientSolution[2].Vy,\
@@ -58,6 +58,6 @@
 	md.results.TransientSolution[2].Surface,\
 	md.results.TransientSolution[2].Thickness,\
 	md.results.TransientSolution[2].Temperature,\
-	md.results.TransientSolution[2].SurfaceforcingsMassBalance,\
+	md.results.TransientSolution[2].SmbMassBalance,\
 	md.results.TransientSolution[2].TotalSmb,\
 	]

Modified: issm/trunk/test/NightlyRun/test333.m
===================================================================
--- issm/trunk/test/NightlyRun/test333.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/NightlyRun/test333.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -4,6 +4,7 @@
 md=parameterize(md,'../Par/SquareSheetConstrained.par');
 md.transient=deactivateall(md.transient);
 md.transient.ishydrology=1;
+md.transient.issmb=1;
 md=setflowequation(md,'SSA','all');
 md.cluster=generic('name',oshostname(),'np',1);
 md.hydrology=(hydrologydc);
@@ -48,7 +49,7 @@
 field_tolerances={...
 	1e-13, 1e-13, 1e-13,...
 	1e-13, 1e-13, 1e-13,...
-	1e-13, 5e-12, 8e-12,...
+	1e-13, 5e-12, 1e-11,...
 	1e-13, 5e-12, 1e-11};
 field_values={md.results.TransientSolution(1).SedimentHead, ...
 							md.results.TransientSolution(1).EplHead,...

Modified: issm/trunk/test/NightlyRun/test333.py
===================================================================
--- issm/trunk/test/NightlyRun/test333.py	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/NightlyRun/test333.py	2016-04-13 04:32:01 UTC (rev 20500)
@@ -17,6 +17,7 @@
 md=parameterize(md,'../Par/SquareSheetConstrained.py')
 md.transient=transient.setallnullparameters(md.transient)
 md.transient.ishydrology=True
+md.transient.issmb=True
 md=setflowequation(md,'SSA','all')
 md.cluster=generic('name',oshostname(),'np',1)
 md.hydrology=hydrologydc()
@@ -53,7 +54,7 @@
 field_tolerances=[ \
 	1e-13, 1e-13, 1e-13, \
 	1e-13, 1e-13, 1e-13, \
-	1e-13, 5e-12, 8e-12, \
+	1e-13, 5e-12, 1e-11, \
 	1e-13, 5e-12, 1e-11]
 field_values=[md.results.TransientSolution[0].SedimentHead, \
 							md.results.TransientSolution[0].EplHead, \

Modified: issm/trunk/test/NightlyRun/test334.m
===================================================================
--- issm/trunk/test/NightlyRun/test334.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/NightlyRun/test334.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -20,7 +20,6 @@
 md.hydrology.sediment_transmitivity= 3.0*ones(md.mesh.numberofvertices,1);
 md.timestepping.time_step=0;
 md.timestepping.final_time=1.0;
-%md.verbose=verbose('1111111');
 md=extrude(md,3,1.1);
 md=solve(md,HydrologySolutionEnum());
 

Modified: issm/trunk/test/NightlyRun/test335.m
===================================================================
--- issm/trunk/test/NightlyRun/test335.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/NightlyRun/test335.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -3,6 +3,7 @@
 md=setmask(md,'','');
 md.transient=deactivateall(md.transient);
 md.transient.ishydrology=1;
+md.transient.issmb=1;
 md=parameterize(md,'../Par/SquareSheetConstrained.par');
 md=setflowequation(md,'SSA','all');
 md.cluster=generic('name',oshostname(),'np',1);

Modified: issm/trunk/test/NightlyRun/test336.m
===================================================================
--- issm/trunk/test/NightlyRun/test336.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/NightlyRun/test336.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -13,19 +13,19 @@
 smb=ones(md.mesh.numberofvertices,1)*3.6;
 smb=[ smb smb*-1. ];
 
-md.surfaceforcings=SMBcomponents();
-md.surfaceforcings.accumulation=[smb*2; [1.5 3.]];
-md.surfaceforcings.runoff=[smb/2; [1.5 3.]];
-md.surfaceforcings.evaporation=[smb/2; [1.5 3.]];
+md.smb=SMBcomponents();
+md.smb.accumulation=[smb*2; [1.5 3.]];
+md.smb.runoff=[smb/2; [1.5 3.]];
+md.smb.evaporation=[smb/2; [1.5 3.]];
 md.transient.isthermal=0;
 
 md=solve(md,TransientSolutionEnum());
 
 %Fields and tolerances to track changes
-field_names={'Vx1','Vy1','Vel1','Pressure1','Bed1','Surface1','Thickness1','SurfaceforcingsMassBalance1', ...
-	'Vx2','Vy2','Vel2','Pressure2','Bed2','Surface2','Thickness2','SurfaceforcingsMassBalance2', ...
-	'Vx3','Vy3','Vel3','Pressure3','Bed3','Surface3','Thickness3','SurfaceforcingsMassBalance3', ...
-	'Vx4','Vy4','Vel4','Pressure4','Bed4','Surface4','Thickness4','SurfaceforcingsMassBalance4'};
+field_names={'Vx1','Vy1','Vel1','Pressure1','Bed1','Surface1','Thickness1','SmbMassBalance1', ...
+	'Vx2','Vy2','Vel2','Pressure2','Bed2','Surface2','Thickness2','SmbMassBalance2', ...
+	'Vx3','Vy3','Vel3','Pressure3','Bed3','Surface3','Thickness3','SmbMassBalance3', ...
+	'Vx4','Vy4','Vel4','Pressure4','Bed4','Surface4','Thickness4','SmbMassBalance4'};
 field_tolerances={1e-09,1e-09,1e-10,1e-10,1e-10,1e-10,1e-10,1e-10,...
 	1e-09,1e-09,1e-10,1e-10,1e-10,1e-10,1e-10,1e-10,...
 	1e-09,1e-09,1e-10,1e-10,1e-10,1e-10,1e-10,1e-10,...
@@ -38,7 +38,7 @@
 	(md.results.TransientSolution(1).Base),...
 	(md.results.TransientSolution(1).Surface),...
 	(md.results.TransientSolution(1).Thickness),...
-	(md.results.TransientSolution(1).SurfaceforcingsMassBalance),...
+	(md.results.TransientSolution(1).SmbMassBalance),...
 	(md.results.TransientSolution(2).Vx),...
 	(md.results.TransientSolution(2).Vy),...
 	(md.results.TransientSolution(2).Vel),...
@@ -46,7 +46,7 @@
 	(md.results.TransientSolution(2).Base),...
 	(md.results.TransientSolution(2).Surface),...
 	(md.results.TransientSolution(2).Thickness),...
-	(md.results.TransientSolution(2).SurfaceforcingsMassBalance),...
+	(md.results.TransientSolution(2).SmbMassBalance),...
 	(md.results.TransientSolution(3).Vx),...
 	(md.results.TransientSolution(3).Vy),...
 	(md.results.TransientSolution(3).Vel),...
@@ -54,7 +54,7 @@
 	(md.results.TransientSolution(3).Base),...
 	(md.results.TransientSolution(3).Surface),...
 	(md.results.TransientSolution(3).Thickness),...
-	(md.results.TransientSolution(3).SurfaceforcingsMassBalance),...
+	(md.results.TransientSolution(3).SmbMassBalance),...
 	(md.results.TransientSolution(4).Vx),...
 	(md.results.TransientSolution(4).Vy),...
 	(md.results.TransientSolution(4).Vel),...
@@ -62,5 +62,5 @@
 	(md.results.TransientSolution(4).Base),...
 	(md.results.TransientSolution(4).Surface),...
 	(md.results.TransientSolution(4).Thickness),...
-	(md.results.TransientSolution(4).SurfaceforcingsMassBalance),...
+	(md.results.TransientSolution(4).SmbMassBalance),...
 	};

Modified: issm/trunk/test/NightlyRun/test336.py
===================================================================
--- issm/trunk/test/NightlyRun/test336.py	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/NightlyRun/test336.py	2016-04-13 04:32:01 UTC (rev 20500)
@@ -23,19 +23,19 @@
 smb=numpy.ones((md.mesh.numberofvertices,1))*3.6
 smb=numpy.hstack((smb,smb*-1.))
 
-md.surfaceforcings=SMBcomponents();
-md.surfaceforcings.accumulation=numpy.vstack((smb*2, [1.5,3.]));
-md.surfaceforcings.runoff=numpy.vstack((smb/2, [1.5,3.]));
-md.surfaceforcings.evaporation=numpy.vstack((smb/2, [1.5,3.]));
+md.smb=SMBcomponents();
+md.smb.accumulation=numpy.vstack((smb*2, [1.5,3.]));
+md.smb.runoff=numpy.vstack((smb/2, [1.5,3.]));
+md.smb.evaporation=numpy.vstack((smb/2, [1.5,3.]));
 md.transient.isthermal=False
 
 md=solve(md,TransientSolutionEnum())
 
 #Fields and tolerances to track changes
-field_names=['Vx1','Vy1','Vel1','Pressure1','Bed1','Surface1','Thickness1','SurfaceforcingsMassBalance1', \
-	'Vx2','Vy2','Vel2','Pressure2','Bed2','Surface2','Thickness2','SurfaceforcingsMassBalance2', \
-	'Vx3','Vy3','Vel3','Pressure3','Bed3','Surface3','Thickness3','SurfaceforcingsMassBalance3', \
-	'Vx4','Vy4','Vel4','Pressure4','Bed4','Surface4','Thickness4','SurfaceforcingsMassBalance4']
+field_names=['Vx1','Vy1','Vel1','Pressure1','Bed1','Surface1','Thickness1','SmbMassBalance1', \
+	'Vx2','Vy2','Vel2','Pressure2','Bed2','Surface2','Thickness2','SmbMassBalance2', \
+	'Vx3','Vy3','Vel3','Pressure3','Bed3','Surface3','Thickness3','SmbMassBalance3', \
+	'Vx4','Vy4','Vel4','Pressure4','Bed4','Surface4','Thickness4','SmbMassBalance4']
 field_tolerances=[1e-09,1e-09,1e-10,1e-10,1e-10,1e-10,1e-10,1e-10,\
 	1e-09,1e-09,1e-10,1e-10,1e-10,1e-10,1e-10,1e-10,\
 	1e-09,1e-09,1e-10,1e-10,1e-10,1e-10,1e-10,1e-10,\
@@ -48,7 +48,7 @@
 	md.results.TransientSolution[0].Base,\
 	md.results.TransientSolution[0].Surface,\
 	md.results.TransientSolution[0].Thickness,\
-	md.results.TransientSolution[0].SurfaceforcingsMassBalance,\
+	md.results.TransientSolution[0].SmbMassBalance,\
 	md.results.TransientSolution[1].Vx,\
 	md.results.TransientSolution[1].Vy,\
 	md.results.TransientSolution[1].Vel,\
@@ -56,7 +56,7 @@
 	md.results.TransientSolution[1].Base,\
 	md.results.TransientSolution[1].Surface,\
 	md.results.TransientSolution[1].Thickness,\
-	md.results.TransientSolution[1].SurfaceforcingsMassBalance,\
+	md.results.TransientSolution[1].SmbMassBalance,\
 	md.results.TransientSolution[2].Vx,\
 	md.results.TransientSolution[2].Vy,\
 	md.results.TransientSolution[2].Vel,\
@@ -64,7 +64,7 @@
 	md.results.TransientSolution[2].Base,\
 	md.results.TransientSolution[2].Surface,\
 	md.results.TransientSolution[2].Thickness,\
-	md.results.TransientSolution[2].SurfaceforcingsMassBalance,\
+	md.results.TransientSolution[2].SmbMassBalance,\
 	md.results.TransientSolution[3].Vx,\
 	md.results.TransientSolution[3].Vy,\
 	md.results.TransientSolution[3].Vel,\
@@ -72,5 +72,5 @@
 	md.results.TransientSolution[3].Base,\
 	md.results.TransientSolution[3].Surface,\
 	md.results.TransientSolution[3].Thickness,\
-	md.results.TransientSolution[3].SurfaceforcingsMassBalance,\
+	md.results.TransientSolution[3].SmbMassBalance,\
 	]

Modified: issm/trunk/test/NightlyRun/test337.m
===================================================================
--- issm/trunk/test/NightlyRun/test337.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/NightlyRun/test337.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -14,19 +14,19 @@
 smb=ones(md.mesh.numberofvertices,1)*3.6;
 smb=[ smb smb*-1. ];
 
-md.surfaceforcings=SMBcomponents();
-md.surfaceforcings.accumulation=[smb*2; [1.5 3.]];
-md.surfaceforcings.runoff=[smb/2; [1.5 3.]];
-md.surfaceforcings.evaporation=[smb/2; [1.5 3.]];
+md.smb=SMBcomponents();
+md.smb.accumulation=[smb*2; [1.5 3.]];
+md.smb.runoff=[smb/2; [1.5 3.]];
+md.smb.evaporation=[smb/2; [1.5 3.]];
 md.transient.isthermal=0;
 
 md=solve(md,TransientSolutionEnum());
 
 %Fields and tolerances to track changes
-field_names={'Vx1','Vy1','Vel1','Pressure1','Bed1','Surface1','Thickness1','SurfaceforcingsMassBalance1', ...
-	'Vx2','Vy2','Vel2','Pressure2','Bed2','Surface2','Thickness2','SurfaceforcingsMassBalance2', ...
-	'Vx3','Vy3','Vel3','Pressure3','Bed3','Surface3','Thickness3','SurfaceforcingsMassBalance3', ...
-	'Vx4','Vy4','Vel4','Pressure4','Bed4','Surface4','Thickness4','SurfaceforcingsMassBalance4'};
+field_names={'Vx1','Vy1','Vel1','Pressure1','Bed1','Surface1','Thickness1','SmbMassBalance1', ...
+	'Vx2','Vy2','Vel2','Pressure2','Bed2','Surface2','Thickness2','SmbMassBalance2', ...
+	'Vx3','Vy3','Vel3','Pressure3','Bed3','Surface3','Thickness3','SmbMassBalance3', ...
+	'Vx4','Vy4','Vel4','Pressure4','Bed4','Surface4','Thickness4','SmbMassBalance4'};
 field_tolerances={...
 	5e-09,1e-09,1e-09,1e-10,1e-10,1e-10,1e-10,1e-10,...
 	5e-09,1e-09,1e-09,1e-10,1e-10,1e-10,1e-10,1e-10,...
@@ -40,7 +40,7 @@
 	(md.results.TransientSolution(1).Base),...
 	(md.results.TransientSolution(1).Surface),...
 	(md.results.TransientSolution(1).Thickness),...
-	(md.results.TransientSolution(1).SurfaceforcingsMassBalance),...
+	(md.results.TransientSolution(1).SmbMassBalance),...
 	(md.results.TransientSolution(2).Vx),...
 	(md.results.TransientSolution(2).Vy),...
 	(md.results.TransientSolution(2).Vel),...
@@ -48,7 +48,7 @@
 	(md.results.TransientSolution(2).Base),...
 	(md.results.TransientSolution(2).Surface),...
 	(md.results.TransientSolution(2).Thickness),...
-	(md.results.TransientSolution(2).SurfaceforcingsMassBalance),...
+	(md.results.TransientSolution(2).SmbMassBalance),...
 	(md.results.TransientSolution(3).Vx),...
 	(md.results.TransientSolution(3).Vy),...
 	(md.results.TransientSolution(3).Vel),...
@@ -56,7 +56,7 @@
 	(md.results.TransientSolution(3).Base),...
 	(md.results.TransientSolution(3).Surface),...
 	(md.results.TransientSolution(3).Thickness),...
-	(md.results.TransientSolution(3).SurfaceforcingsMassBalance),...
+	(md.results.TransientSolution(3).SmbMassBalance),...
 	(md.results.TransientSolution(4).Vx),...
 	(md.results.TransientSolution(4).Vy),...
 	(md.results.TransientSolution(4).Vel),...
@@ -64,5 +64,5 @@
 	(md.results.TransientSolution(4).Base),...
 	(md.results.TransientSolution(4).Surface),...
 	(md.results.TransientSolution(4).Thickness),...
-	(md.results.TransientSolution(4).SurfaceforcingsMassBalance),...
+	(md.results.TransientSolution(4).SmbMassBalance),...
 	};

Modified: issm/trunk/test/NightlyRun/test337.py
===================================================================
--- issm/trunk/test/NightlyRun/test337.py	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/NightlyRun/test337.py	2016-04-13 04:32:01 UTC (rev 20500)
@@ -24,19 +24,19 @@
 smb=numpy.ones((md.mesh.numberofvertices,1))*3.6
 smb=numpy.hstack((smb,smb*-1.))
 
-md.surfaceforcings=SMBcomponents();
-md.surfaceforcings.accumulation=numpy.vstack((smb*2, [1.5,3.]));
-md.surfaceforcings.runoff=numpy.vstack((smb/2, [1.5,3.]));
-md.surfaceforcings.evaporation=numpy.vstack((smb/2, [1.5,3.]));
+md.smb=SMBcomponents();
+md.smb.accumulation=numpy.vstack((smb*2, [1.5,3.]));
+md.smb.runoff=numpy.vstack((smb/2, [1.5,3.]));
+md.smb.evaporation=numpy.vstack((smb/2, [1.5,3.]));
 md.transient.isthermal=False
 
 md=solve(md,TransientSolutionEnum())
 
 #Fields and tolerances to track changes
-field_names=['Vx1','Vy1','Vel1','Pressure1','Bed1','Surface1','Thickness1','SurfaceforcingsMassBalance1', \
-	'Vx2','Vy2','Vel2','Pressure2','Bed2','Surface2','Thickness2','SurfaceforcingsMassBalance2', \
-	'Vx3','Vy3','Vel3','Pressure3','Bed3','Surface3','Thickness3','SurfaceforcingsMassBalance3', \
-	'Vx4','Vy4','Vel4','Pressure4','Bed4','Surface4','Thickness4','SurfaceforcingsMassBalance4']
+field_names=['Vx1','Vy1','Vel1','Pressure1','Bed1','Surface1','Thickness1','SmbMassBalance1', \
+	'Vx2','Vy2','Vel2','Pressure2','Bed2','Surface2','Thickness2','SmbMassBalance2', \
+	'Vx3','Vy3','Vel3','Pressure3','Bed3','Surface3','Thickness3','SmbMassBalance3', \
+	'Vx4','Vy4','Vel4','Pressure4','Bed4','Surface4','Thickness4','SmbMassBalance4']
 field_tolerances=[\
 		5e-09,1e-09,1e-09,1e-10,1e-10,1e-10,1e-10,1e-10,\
 		5e-09,1e-09,1e-09,1e-10,1e-10,1e-10,1e-10,1e-10,\
@@ -50,7 +50,7 @@
 	md.results.TransientSolution[0].Base,\
 	md.results.TransientSolution[0].Surface,\
 	md.results.TransientSolution[0].Thickness,\
-	md.results.TransientSolution[0].SurfaceforcingsMassBalance,\
+	md.results.TransientSolution[0].SmbMassBalance,\
 	md.results.TransientSolution[1].Vx,\
 	md.results.TransientSolution[1].Vy,\
 	md.results.TransientSolution[1].Vel,\
@@ -58,7 +58,7 @@
 	md.results.TransientSolution[1].Base,\
 	md.results.TransientSolution[1].Surface,\
 	md.results.TransientSolution[1].Thickness,\
-	md.results.TransientSolution[1].SurfaceforcingsMassBalance,\
+	md.results.TransientSolution[1].SmbMassBalance,\
 	md.results.TransientSolution[2].Vx,\
 	md.results.TransientSolution[2].Vy,\
 	md.results.TransientSolution[2].Vel,\
@@ -66,7 +66,7 @@
 	md.results.TransientSolution[2].Base,\
 	md.results.TransientSolution[2].Surface,\
 	md.results.TransientSolution[2].Thickness,\
-	md.results.TransientSolution[2].SurfaceforcingsMassBalance,\
+	md.results.TransientSolution[2].SmbMassBalance,\
 	md.results.TransientSolution[3].Vx,\
 	md.results.TransientSolution[3].Vy,\
 	md.results.TransientSolution[3].Vel,\
@@ -74,5 +74,5 @@
 	md.results.TransientSolution[3].Base,\
 	md.results.TransientSolution[3].Surface,\
 	md.results.TransientSolution[3].Thickness,\
-	md.results.TransientSolution[3].SurfaceforcingsMassBalance,\
+	md.results.TransientSolution[3].SmbMassBalance,\
 	]

Modified: issm/trunk/test/NightlyRun/test338.m
===================================================================
--- issm/trunk/test/NightlyRun/test338.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/NightlyRun/test338.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -13,20 +13,20 @@
 smb=ones(md.mesh.numberofvertices,1)*3.6;
 smb=[ smb smb*-1. ];
 
-md.surfaceforcings=SMBmeltcomponents();
-md.surfaceforcings.accumulation=[smb; [1.5 3.]];
-md.surfaceforcings.melt=[smb/2; [1.5 3.]];
-md.surfaceforcings.refreeze=[smb; [1.5 3.]];
-md.surfaceforcings.evaporation=[smb/2; [1.5 3.]];
+md.smb=SMBmeltcomponents();
+md.smb.accumulation=[smb; [1.5 3.]];
+md.smb.melt=[smb/2; [1.5 3.]];
+md.smb.refreeze=[smb; [1.5 3.]];
+md.smb.evaporation=[smb/2; [1.5 3.]];
 md.transient.isthermal=0;
 
 md=solve(md,TransientSolutionEnum());
 
 %Fields and tolerances to track changes
-field_names={'Vx1','Vy1','Vel1','Pressure1','Bed1','Surface1','Thickness1','SurfaceforcingsMassBalance1', ...
-	'Vx2','Vy2','Vel2','Pressure2','Bed2','Surface2','Thickness2','SurfaceforcingsMassBalance2', ...
-	'Vx3','Vy3','Vel3','Pressure3','Bed3','Surface3','Thickness3','SurfaceforcingsMassBalance3', ...
-	'Vx4','Vy4','Vel4','Pressure4','Bed4','Surface4','Thickness4','SurfaceforcingsMassBalance4'};
+field_names={'Vx1','Vy1','Vel1','Pressure1','Bed1','Surface1','Thickness1','SmbMassBalance1', ...
+	'Vx2','Vy2','Vel2','Pressure2','Bed2','Surface2','Thickness2','SmbMassBalance2', ...
+	'Vx3','Vy3','Vel3','Pressure3','Bed3','Surface3','Thickness3','SmbMassBalance3', ...
+	'Vx4','Vy4','Vel4','Pressure4','Bed4','Surface4','Thickness4','SmbMassBalance4'};
 field_tolerances={1e-09,1e-09,1e-10,1e-10,1e-10,1e-10,1e-10,1e-10,...
 	1e-09,1e-09,1e-10,1e-10,1e-10,1e-10,1e-10,1e-10,...
 	1e-09,1e-09,1e-10,1e-10,1e-10,1e-10,1e-10,1e-10,...
@@ -39,7 +39,7 @@
 	(md.results.TransientSolution(1).Base),...
 	(md.results.TransientSolution(1).Surface),...
 	(md.results.TransientSolution(1).Thickness),...
-	(md.results.TransientSolution(1).SurfaceforcingsMassBalance),...
+	(md.results.TransientSolution(1).SmbMassBalance),...
 	(md.results.TransientSolution(2).Vx),...
 	(md.results.TransientSolution(2).Vy),...
 	(md.results.TransientSolution(2).Vel),...
@@ -47,7 +47,7 @@
 	(md.results.TransientSolution(2).Base),...
 	(md.results.TransientSolution(2).Surface),...
 	(md.results.TransientSolution(2).Thickness),...
-	(md.results.TransientSolution(2).SurfaceforcingsMassBalance),...
+	(md.results.TransientSolution(2).SmbMassBalance),...
 	(md.results.TransientSolution(3).Vx),...
 	(md.results.TransientSolution(3).Vy),...
 	(md.results.TransientSolution(3).Vel),...
@@ -55,7 +55,7 @@
 	(md.results.TransientSolution(3).Base),...
 	(md.results.TransientSolution(3).Surface),...
 	(md.results.TransientSolution(3).Thickness),...
-	(md.results.TransientSolution(3).SurfaceforcingsMassBalance),...
+	(md.results.TransientSolution(3).SmbMassBalance),...
 	(md.results.TransientSolution(4).Vx),...
 	(md.results.TransientSolution(4).Vy),...
 	(md.results.TransientSolution(4).Vel),...
@@ -63,5 +63,5 @@
 	(md.results.TransientSolution(4).Base),...
 	(md.results.TransientSolution(4).Surface),...
 	(md.results.TransientSolution(4).Thickness),...
-	(md.results.TransientSolution(4).SurfaceforcingsMassBalance),...
+	(md.results.TransientSolution(4).SmbMassBalance),...
 	};

Modified: issm/trunk/test/NightlyRun/test338.py
===================================================================
--- issm/trunk/test/NightlyRun/test338.py	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/NightlyRun/test338.py	2016-04-13 04:32:01 UTC (rev 20500)
@@ -23,20 +23,20 @@
 smb=numpy.ones((md.mesh.numberofvertices,1))*3.6
 smb=numpy.hstack((smb,smb*-1.))
 
-md.surfaceforcings=SMBmeltcomponents();
-md.surfaceforcings.accumulation=numpy.vstack((smb, [1.5,3.]));
-md.surfaceforcings.evaporation=numpy.vstack((smb/2, [1.5,3.]));
-md.surfaceforcings.melt=numpy.vstack((smb/2, [1.5,3.]));
-md.surfaceforcings.refreeze=numpy.vstack((smb, [1.5,3.]));
+md.smb=SMBmeltcomponents();
+md.smb.accumulation=numpy.vstack((smb, [1.5,3.]));
+md.smb.evaporation=numpy.vstack((smb/2, [1.5,3.]));
+md.smb.melt=numpy.vstack((smb/2, [1.5,3.]));
+md.smb.refreeze=numpy.vstack((smb, [1.5,3.]));
 md.transient.isthermal=False
 
 md=solve(md,TransientSolutionEnum())
 
 #Fields and tolerances to track changes
-field_names=['Vx1','Vy1','Vel1','Pressure1','Bed1','Surface1','Thickness1','SurfaceforcingsMassBalance1', \
-	'Vx2','Vy2','Vel2','Pressure2','Bed2','Surface2','Thickness2','SurfaceforcingsMassBalance2', \
-	'Vx3','Vy3','Vel3','Pressure3','Bed3','Surface3','Thickness3','SurfaceforcingsMassBalance3', \
-	'Vx4','Vy4','Vel4','Pressure4','Bed4','Surface4','Thickness4','SurfaceforcingsMassBalance4']
+field_names=['Vx1','Vy1','Vel1','Pressure1','Bed1','Surface1','Thickness1','SmbMassBalance1', \
+	'Vx2','Vy2','Vel2','Pressure2','Bed2','Surface2','Thickness2','SmbMassBalance2', \
+	'Vx3','Vy3','Vel3','Pressure3','Bed3','Surface3','Thickness3','SmbMassBalance3', \
+	'Vx4','Vy4','Vel4','Pressure4','Bed4','Surface4','Thickness4','SmbMassBalance4']
 field_tolerances=[1e-09,1e-09,1e-10,1e-10,1e-10,1e-10,1e-10,1e-10,\
 	1e-09,1e-09,1e-10,1e-10,1e-10,1e-10,1e-10,1e-10,\
 	1e-09,1e-09,1e-10,1e-10,1e-10,1e-10,1e-10,1e-10,\
@@ -49,7 +49,7 @@
 	md.results.TransientSolution[0].Base,\
 	md.results.TransientSolution[0].Surface,\
 	md.results.TransientSolution[0].Thickness,\
-	md.results.TransientSolution[0].SurfaceforcingsMassBalance,\
+	md.results.TransientSolution[0].SmbMassBalance,\
 	md.results.TransientSolution[1].Vx,\
 	md.results.TransientSolution[1].Vy,\
 	md.results.TransientSolution[1].Vel,\
@@ -57,7 +57,7 @@
 	md.results.TransientSolution[1].Base,\
 	md.results.TransientSolution[1].Surface,\
 	md.results.TransientSolution[1].Thickness,\
-	md.results.TransientSolution[1].SurfaceforcingsMassBalance,\
+	md.results.TransientSolution[1].SmbMassBalance,\
 	md.results.TransientSolution[2].Vx,\
 	md.results.TransientSolution[2].Vy,\
 	md.results.TransientSolution[2].Vel,\
@@ -65,7 +65,7 @@
 	md.results.TransientSolution[2].Base,\
 	md.results.TransientSolution[2].Surface,\
 	md.results.TransientSolution[2].Thickness,\
-	md.results.TransientSolution[2].SurfaceforcingsMassBalance,\
+	md.results.TransientSolution[2].SmbMassBalance,\
 	md.results.TransientSolution[3].Vx,\
 	md.results.TransientSolution[3].Vy,\
 	md.results.TransientSolution[3].Vel,\
@@ -73,5 +73,5 @@
 	md.results.TransientSolution[3].Base,\
 	md.results.TransientSolution[3].Surface,\
 	md.results.TransientSolution[3].Thickness,\
-	md.results.TransientSolution[3].SurfaceforcingsMassBalance,\
+	md.results.TransientSolution[3].SmbMassBalance,\
 	]

Modified: issm/trunk/test/NightlyRun/test339.m
===================================================================
--- issm/trunk/test/NightlyRun/test339.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/NightlyRun/test339.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -14,20 +14,20 @@
 smb=ones(md.mesh.numberofvertices,1)*3.6;
 smb=[ smb smb*-1. ];
 
-md.surfaceforcings=SMBmeltcomponents();
-md.surfaceforcings.accumulation=[smb; [1.5 3.]];
-md.surfaceforcings.melt=[smb/2; [1.5 3.]];
-md.surfaceforcings.refreeze=[smb; [1.5 3.]];
-md.surfaceforcings.evaporation=[smb/2; [1.5 3.]];
+md.smb=SMBmeltcomponents();
+md.smb.accumulation=[smb; [1.5 3.]];
+md.smb.melt=[smb/2; [1.5 3.]];
+md.smb.refreeze=[smb; [1.5 3.]];
+md.smb.evaporation=[smb/2; [1.5 3.]];
 md.transient.isthermal=0;
 
 md=solve(md,TransientSolutionEnum());
 
 %Fields and tolerances to track changes
-field_names={'Vx1','Vy1','Vel1','Pressure1','Bed1','Surface1','Thickness1','SurfaceforcingsMassBalance1', ...
-	'Vx2','Vy2','Vel2','Pressure2','Bed2','Surface2','Thickness2','SurfaceforcingsMassBalance2', ...
-	'Vx3','Vy3','Vel3','Pressure3','Bed3','Surface3','Thickness3','SurfaceforcingsMassBalance3', ...
-	'Vx4','Vy4','Vel4','Pressure4','Bed4','Surface4','Thickness4','SurfaceforcingsMassBalance4'};
+field_names={'Vx1','Vy1','Vel1','Pressure1','Bed1','Surface1','Thickness1','SmbMassBalance1', ...
+	'Vx2','Vy2','Vel2','Pressure2','Bed2','Surface2','Thickness2','SmbMassBalance2', ...
+	'Vx3','Vy3','Vel3','Pressure3','Bed3','Surface3','Thickness3','SmbMassBalance3', ...
+	'Vx4','Vy4','Vel4','Pressure4','Bed4','Surface4','Thickness4','SmbMassBalance4'};
 field_tolerances={...
 	1e-09,1e-09,1e-09,1e-10,1e-10,1e-10,1e-10,1e-10,...
 	1e-09,1e-09,1e-09,1e-10,1e-10,1e-10,1e-10,1e-10,...
@@ -41,7 +41,7 @@
 	(md.results.TransientSolution(1).Base),...
 	(md.results.TransientSolution(1).Surface),...
 	(md.results.TransientSolution(1).Thickness),...
-	(md.results.TransientSolution(1).SurfaceforcingsMassBalance),...
+	(md.results.TransientSolution(1).SmbMassBalance),...
 	(md.results.TransientSolution(2).Vx),...
 	(md.results.TransientSolution(2).Vy),...
 	(md.results.TransientSolution(2).Vel),...
@@ -49,7 +49,7 @@
 	(md.results.TransientSolution(2).Base),...
 	(md.results.TransientSolution(2).Surface),...
 	(md.results.TransientSolution(2).Thickness),...
-	(md.results.TransientSolution(2).SurfaceforcingsMassBalance),...
+	(md.results.TransientSolution(2).SmbMassBalance),...
 	(md.results.TransientSolution(3).Vx),...
 	(md.results.TransientSolution(3).Vy),...
 	(md.results.TransientSolution(3).Vel),...
@@ -57,7 +57,7 @@
 	(md.results.TransientSolution(3).Base),...
 	(md.results.TransientSolution(3).Surface),...
 	(md.results.TransientSolution(3).Thickness),...
-	(md.results.TransientSolution(3).SurfaceforcingsMassBalance),...
+	(md.results.TransientSolution(3).SmbMassBalance),...
 	(md.results.TransientSolution(4).Vx),...
 	(md.results.TransientSolution(4).Vy),...
 	(md.results.TransientSolution(4).Vel),...
@@ -65,5 +65,5 @@
 	(md.results.TransientSolution(4).Base),...
 	(md.results.TransientSolution(4).Surface),...
 	(md.results.TransientSolution(4).Thickness),...
-	(md.results.TransientSolution(4).SurfaceforcingsMassBalance),...
+	(md.results.TransientSolution(4).SmbMassBalance),...
 	};

Modified: issm/trunk/test/NightlyRun/test339.py
===================================================================
--- issm/trunk/test/NightlyRun/test339.py	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/NightlyRun/test339.py	2016-04-13 04:32:01 UTC (rev 20500)
@@ -24,20 +24,20 @@
 smb=numpy.ones((md.mesh.numberofvertices,1))*3.6
 smb=numpy.hstack((smb,smb*-1.))
 
-md.surfaceforcings=SMBmeltcomponents();
-md.surfaceforcings.accumulation=numpy.vstack((smb, [1.5,3.]));
-md.surfaceforcings.evaporation=numpy.vstack((smb/2, [1.5,3.]));
-md.surfaceforcings.melt=numpy.vstack((smb/2, [1.5,3.]));
-md.surfaceforcings.refreeze=numpy.vstack((smb, [1.5,3.]));
+md.smb=SMBmeltcomponents();
+md.smb.accumulation=numpy.vstack((smb, [1.5,3.]));
+md.smb.evaporation=numpy.vstack((smb/2, [1.5,3.]));
+md.smb.melt=numpy.vstack((smb/2, [1.5,3.]));
+md.smb.refreeze=numpy.vstack((smb, [1.5,3.]));
 md.transient.isthermal=False
 
 md=solve(md,TransientSolutionEnum())
 
 #Fields and tolerances to track changes
-field_names=['Vx1','Vy1','Vel1','Pressure1','Bed1','Surface1','Thickness1','SurfaceforcingsMassBalance1', \
-	'Vx2','Vy2','Vel2','Pressure2','Bed2','Surface2','Thickness2','SurfaceforcingsMassBalance2', \
-	'Vx3','Vy3','Vel3','Pressure3','Bed3','Surface3','Thickness3','SurfaceforcingsMassBalance3', \
-	'Vx4','Vy4','Vel4','Pressure4','Bed4','Surface4','Thickness4','SurfaceforcingsMassBalance4']
+field_names=['Vx1','Vy1','Vel1','Pressure1','Bed1','Surface1','Thickness1','SmbMassBalance1', \
+	'Vx2','Vy2','Vel2','Pressure2','Bed2','Surface2','Thickness2','SmbMassBalance2', \
+	'Vx3','Vy3','Vel3','Pressure3','Bed3','Surface3','Thickness3','SmbMassBalance3', \
+	'Vx4','Vy4','Vel4','Pressure4','Bed4','Surface4','Thickness4','SmbMassBalance4']
 field_tolerances=[\
 		1e-09,1e-09,1e-09,1e-10,1e-10,1e-10,1e-10,1e-10,\
 		1e-09,1e-09,1e-09,1e-10,1e-10,1e-10,1e-10,1e-10,\
@@ -51,7 +51,7 @@
 	md.results.TransientSolution[0].Base,\
 	md.results.TransientSolution[0].Surface,\
 	md.results.TransientSolution[0].Thickness,\
-	md.results.TransientSolution[0].SurfaceforcingsMassBalance,\
+	md.results.TransientSolution[0].SmbMassBalance,\
 	md.results.TransientSolution[1].Vx,\
 	md.results.TransientSolution[1].Vy,\
 	md.results.TransientSolution[1].Vel,\
@@ -59,7 +59,7 @@
 	md.results.TransientSolution[1].Base,\
 	md.results.TransientSolution[1].Surface,\
 	md.results.TransientSolution[1].Thickness,\
-	md.results.TransientSolution[1].SurfaceforcingsMassBalance,\
+	md.results.TransientSolution[1].SmbMassBalance,\
 	md.results.TransientSolution[2].Vx,\
 	md.results.TransientSolution[2].Vy,\
 	md.results.TransientSolution[2].Vel,\
@@ -67,7 +67,7 @@
 	md.results.TransientSolution[2].Base,\
 	md.results.TransientSolution[2].Surface,\
 	md.results.TransientSolution[2].Thickness,\
-	md.results.TransientSolution[2].SurfaceforcingsMassBalance,\
+	md.results.TransientSolution[2].SmbMassBalance,\
 	md.results.TransientSolution[3].Vx,\
 	md.results.TransientSolution[3].Vy,\
 	md.results.TransientSolution[3].Vel,\
@@ -75,5 +75,5 @@
 	md.results.TransientSolution[3].Base,\
 	md.results.TransientSolution[3].Surface,\
 	md.results.TransientSolution[3].Thickness,\
-	md.results.TransientSolution[3].SurfaceforcingsMassBalance,\
+	md.results.TransientSolution[3].SmbMassBalance,\
 	]

Modified: issm/trunk/test/NightlyRun/test341.m
===================================================================
--- issm/trunk/test/NightlyRun/test341.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/NightlyRun/test341.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -22,7 +22,7 @@
 
 %Fields and tolerances to track changes
 field_names     ={'Gradient','FrictionCoefficient','Pressure','Vel','Vx','Vy'};
-field_tolerances={1e-08,1e-10,1e-10,1e-09,1e-09,1e-09};
+field_tolerances={1e-08,1e-9,1e-10,1e-09,1e-09,1e-09};
 field_values={...
 	(md.results.StressbalanceSolution.Gradient1),...
 	(md.results.StressbalanceSolution.FrictionCoefficient),...

Modified: issm/trunk/test/NightlyRun/test4001.m
===================================================================
--- issm/trunk/test/NightlyRun/test4001.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/NightlyRun/test4001.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -10,7 +10,6 @@
 org=organizer('repository','Models/','prefix','IceOcean.','steps',steps);
 
 presentdirectory=pwd; 
-addpath(recursivepath([pwd '/../MITgcm']));
 
 % {{{ Parameters: 
 if perform(org,'Parameters'),
@@ -169,6 +168,7 @@
 	 system(['../MITgcm/build.sh generic ' pwd]);
 end
 % }}}
+addpath(recursivepath([pwd '/../MITgcm']));
 % {{{ RunUncoupledMITgcm: 
 if perform(org,'RunUncoupledMITgcm'),
 
@@ -482,7 +482,7 @@
 	%temperatures and surface mass balance:
 	md.initialization.temperature=(273.15-20)*ones(md.mesh.numberofvertices,1);
 	md.initialization.pressure=md.materials.rho_ice*md.constants.g*(md.geometry.surface-md.geometry.base);
-	md.surfaceforcings.mass_balance = [1*ones(md.mesh.numberofvertices,1); 1];
+	md.smb.mass_balance = [1*ones(md.mesh.numberofvertices,1); 1];
 
 	%Flow law 
 	md.materials.rheology_B=paterson(md.initialization.temperature);

Modified: issm/trunk/test/NightlyRun/test403.m
===================================================================
--- issm/trunk/test/NightlyRun/test403.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/NightlyRun/test403.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -9,7 +9,7 @@
 
 %Fields and tolerances to track changes
 field_names     ={'Vx','Vy','Vz','Vel','Pressure'};
-field_tolerances={2e-09,1e-09,1e-09,1e-09,1e-09};
+field_tolerances={2e-09,2e-09,2e-09,2e-09,2e-09};
 field_values={...
 	(md.results.StressbalanceSolution.Vx),...
 	(md.results.StressbalanceSolution.Vy),...

Modified: issm/trunk/test/NightlyRun/test403.py
===================================================================
--- issm/trunk/test/NightlyRun/test403.py	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/NightlyRun/test403.py	2016-04-13 04:32:01 UTC (rev 20500)
@@ -19,7 +19,7 @@
 
 #Fields and tolerances to track changes
 field_names     =['Vx','Vy','Vz','Vel','Pressure']
-field_tolerances=[2e-09,1e-09,1e-09,1e-09,1e-09]
+field_tolerances=[2e-09,2e-09,2e-09,2e-09,2e-09]
 field_values=[\
 	md.results.StressbalanceSolution.Vx,\
 	md.results.StressbalanceSolution.Vy,\

Modified: issm/trunk/test/NightlyRun/test404.m
===================================================================
--- issm/trunk/test/NightlyRun/test404.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/NightlyRun/test404.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -9,7 +9,7 @@
 
 %Fields and tolerances to track changes
 field_names     ={'Vx','Vy','Vz','Vel','Pressure'};
-field_tolerances={5e-07,5e-07,2e-06,1e-06,1e-07};
+field_tolerances={6e-07,6e-07,2e-06,1e-06,3e-07};
 field_values={...
 	(md.results.StressbalanceSolution.Vx),...
 	(md.results.StressbalanceSolution.Vy),...

Modified: issm/trunk/test/NightlyRun/test404.py
===================================================================
--- issm/trunk/test/NightlyRun/test404.py	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/NightlyRun/test404.py	2016-04-13 04:32:01 UTC (rev 20500)
@@ -19,7 +19,7 @@
 
 #Fields and tolerances to track changes
 field_names     =['Vx','Vy','Vz','Vel','Pressure']
-field_tolerances=[5e-07,4e-07,2e-06,1e-06,1e-07]
+field_tolerances=[6e-07,6e-07,2e-06,1e-06,3e-07]
 field_values=[\
 	md.results.StressbalanceSolution.Vx,\
 	md.results.StressbalanceSolution.Vy,\

Modified: issm/trunk/test/NightlyRun/test407.m
===================================================================
--- issm/trunk/test/NightlyRun/test407.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/NightlyRun/test407.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -7,6 +7,7 @@
 md.cluster=generic('name',oshostname(),'np',3);
 md.transient.isstressbalance=0;
 md.transient.ismasstransport=0;
+md.transient.issmb=1;
 md.transient.isthermal=1;
 md.transient.isgroundingline=0;
 md=solve(md,TransientSolutionEnum());

Modified: issm/trunk/test/NightlyRun/test407.py
===================================================================
--- issm/trunk/test/NightlyRun/test407.py	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/NightlyRun/test407.py	2016-04-13 04:32:01 UTC (rev 20500)
@@ -17,6 +17,7 @@
 md.cluster=generic('name',oshostname(),'np',3)
 md.transient.isstressbalance=False
 md.transient.ismasstransport=False
+md.transient.issmb=True
 md.transient.isthermal=True
 md.transient.isgroundingline=False
 md=solve(md,TransientSolutionEnum())

Modified: issm/trunk/test/NightlyRun/test408.m
===================================================================
--- issm/trunk/test/NightlyRun/test408.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/NightlyRun/test408.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -1,14 +1,21 @@
-%Test Name: SquareSheetShelfTranSSA2d
+%Test Name: SquareSheetShelfTranSSA3d
 md=triangle(model(),'../Exp/Square.exp',150000.);
 md=setmask(md,'../Exp/SquareShelf.exp','');
 md=parameterize(md,'../Par/SquareSheetShelf.par');
+md=extrude(md,3,1);
+md.transient.isthermal=0;
 md=setflowequation(md,'SSA','all');
 md.cluster=generic('name',oshostname(),'np',3);
+md.transient.requested_outputs={'default','GroundedArea','FloatingArea','TotalFloatingBmb','TotalGroundedBmb','TotalSmb'};
 md=solve(md,TransientSolutionEnum());
 
 %Fields and tolerances to track changes
-field_names     ={'Vx1','Vy1','Vel1','Pressure1','Bed1','Surface1','Thickness1','Vx2','Vy2','Vel2','Pressure2','Bed2','Surface2','Thickness2','Vx3','Vy3','Vel3','Pressure3','Bed3','Surface3','Thickness3'};
-field_tolerances={1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13};
+field_names     ={'Vx1','Vy1','Vel1','Pressure1','Bed1','Surface1','Thickness1','GroundedArea1','FloatingArea1','TotalFloatingBmb1','TotalGroundedBmb1','TotalSmb1',...
+	'Vx2','Vy2','Vel2','Pressure2','Bed2','Surface2','Thickness2','GroundedArea2','FloatingArea2','TotalFloatingBmb2','TotalGroundedBmb2','TotalSmb2',...
+	'Vx3','Vy3','Vel3','Pressure3','Bed3','Surface3','Thickness3','GroundedArea3','FloatingArea3','TotalFloatingBmb3','TotalGroundedBmb3','TotalSmb3'};
+field_tolerances={1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,...
+	1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,...
+	1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13};
 field_values={...
 	(md.results.TransientSolution(1).Vx),...
 	(md.results.TransientSolution(1).Vy),...
@@ -17,6 +24,11 @@
 	(md.results.TransientSolution(1).Base),...
 	(md.results.TransientSolution(1).Surface),...
 	(md.results.TransientSolution(1).Thickness),...
+	(md.results.TransientSolution(1).GroundedArea),...
+	(md.results.TransientSolution(1).FloatingArea),...
+	(md.results.TransientSolution(1).TotalFloatingBmb),...
+	(md.results.TransientSolution(1).TotalGroundedBmb),...
+	(md.results.TransientSolution(1).TotalSmb),...
 	(md.results.TransientSolution(2).Vx),...
 	(md.results.TransientSolution(2).Vy),...
 	(md.results.TransientSolution(2).Vel),...
@@ -24,6 +36,11 @@
 	(md.results.TransientSolution(2).Base),...
 	(md.results.TransientSolution(2).Surface),...
 	(md.results.TransientSolution(2).Thickness),...
+	(md.results.TransientSolution(2).GroundedArea),...
+	(md.results.TransientSolution(2).FloatingArea),...
+	(md.results.TransientSolution(2).TotalFloatingBmb),...
+	(md.results.TransientSolution(2).TotalGroundedBmb),...
+	(md.results.TransientSolution(2).TotalSmb),...
 	(md.results.TransientSolution(3).Vx),...
 	(md.results.TransientSolution(3).Vy),...
 	(md.results.TransientSolution(3).Vel),...
@@ -31,4 +48,9 @@
 	(md.results.TransientSolution(3).Base),...
 	(md.results.TransientSolution(3).Surface),...
 	(md.results.TransientSolution(3).Thickness),...
+	(md.results.TransientSolution(3).GroundedArea),...
+	(md.results.TransientSolution(3).FloatingArea),...
+	(md.results.TransientSolution(3).TotalFloatingBmb),...
+	(md.results.TransientSolution(3).TotalGroundedBmb),...
+	(md.results.TransientSolution(3).TotalSmb),...
 	};

Modified: issm/trunk/test/NightlyRun/test408.py
===================================================================
--- issm/trunk/test/NightlyRun/test408.py	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/NightlyRun/test408.py	2016-04-13 04:32:01 UTC (rev 20500)
@@ -1,4 +1,4 @@
-#Test Name: SquareSheetShelfTranSSA2d
+#Test Name: SquareSheetShelfTranSSA3d
 import numpy
 from model import *
 from EnumDefinitions import *
@@ -12,13 +12,16 @@
 md=triangle(model(),'../Exp/Square.exp',150000.)
 md=setmask(md,'../Exp/SquareShelf.exp','')
 md=parameterize(md,'../Par/SquareSheetShelf.py')
+md.extrude(3,1.)
 md=setflowequation(md,'SSA','all')
+md.transient.isthermal=False
 md.cluster=generic('name',oshostname(),'np',3)
+md.transient.requested_outputs=['default','GroundedArea','FloatingArea','TotalFloatingBmb','TotalGroundedBmb','TotalSmb']
 md=solve(md,TransientSolutionEnum())
 
 #Fields and tolerances to track changes
-field_names     =['Vx1','Vy1','Vel1','Pressure1','Bed1','Surface1','Thickness1','Vx2','Vy2','Vel2','Pressure2','Bed2','Surface2','Thickness2','Vx3','Vy3','Vel3','Pressure3','Bed3','Surface3','Thickness3']
-field_tolerances=[1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13]
+field_names     =['Vx1','Vy1','Vel1','Pressure1','Bed1','Surface1','Thickness1','GroundedArea1','FloatingArea1','TotalFloatingBmb1','TotalGroundedBmb1','TotalSmb1','Vx2','Vy2','Vel2','Pressure2','Bed2','Surface2','Thickness2','GroundedArea2','FloatingArea2','TotalFloatingBmb2','TotalGroundedBmb2','TotalSmb2','Vx3','Vy3','Vel3','Pressure3','Bed3','Surface3','Thickness3','GroundedArea3','FloatingArea3','TotalFloatingBmb3','TotalGroundedBmb3','TotalSmb3']
+field_tolerances=[1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13]
 field_values=[\
 	md.results.TransientSolution[0].Vx,\
 	md.results.TransientSolution[0].Vy,\
@@ -27,6 +30,11 @@
 	md.results.TransientSolution[0].Base,\
 	md.results.TransientSolution[0].Surface,\
 	md.results.TransientSolution[0].Thickness,\
+	md.results.TransientSolution[0].GroundedArea,\
+	md.results.TransientSolution[0].FloatingArea,\
+	md.results.TransientSolution[0].TotalFloatingBmb,\
+	md.results.TransientSolution[0].TotalGroundedBmb,\
+	md.results.TransientSolution[0].TotalSmb,\
 	md.results.TransientSolution[1].Vx,\
 	md.results.TransientSolution[1].Vy,\
 	md.results.TransientSolution[1].Vel,\
@@ -34,6 +42,11 @@
 	md.results.TransientSolution[1].Base,\
 	md.results.TransientSolution[1].Surface,\
 	md.results.TransientSolution[1].Thickness,\
+	md.results.TransientSolution[1].GroundedArea,\
+	md.results.TransientSolution[1].FloatingArea,\
+	md.results.TransientSolution[1].TotalFloatingBmb,\
+	md.results.TransientSolution[1].TotalGroundedBmb,\
+	md.results.TransientSolution[1].TotalSmb,\
 	md.results.TransientSolution[2].Vx,\
 	md.results.TransientSolution[2].Vy,\
 	md.results.TransientSolution[2].Vel,\
@@ -41,4 +54,9 @@
 	md.results.TransientSolution[2].Base,\
 	md.results.TransientSolution[2].Surface,\
 	md.results.TransientSolution[2].Thickness,\
+	md.results.TransientSolution[2].GroundedArea,\
+	md.results.TransientSolution[2].FloatingArea,\
+	md.results.TransientSolution[2].TotalFloatingBmb,\
+	md.results.TransientSolution[2].TotalGroundedBmb,\
+	md.results.TransientSolution[2].TotalSmb,\
 	]

Modified: issm/trunk/test/NightlyRun/test409.m
===================================================================
--- issm/trunk/test/NightlyRun/test409.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/NightlyRun/test409.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -4,17 +4,18 @@
 md=parameterize(md,'../Par/SquareSheetShelf.par');
 md=extrude(md,3,1.);
 md=setflowequation(md,'SSA','../Exp/SquareHalfRight.exp','fill','HO','coupling','penalties');
-md.cluster=generic('name',oshostname(),'np',3);
+md.cluster=generic('name',oshostname(),'np',1);
+md.transient.requested_outputs={'default','GroundedArea'};
 md=solve(md,TransientSolutionEnum());
 
 %Fields and tolerances to track changes
-field_names     ={'Vx1','Vy1','Vz1','Vel1','Pressure1','Bed1','Surface1','Thickness1','Temperature1','BasalforcingsGroundediceMeltingRate1', ...
-				      'Vx2','Vy2','Vz2','Vel2','Pressure2','Bed2','Surface2','Thickness2','Temperature2','BasalforcingsGroundediceMeltingRate2', ...
-					   'Vx3','Vy3','Vz3','Vel3','Pressure3','Bed3','Surface3','Thickness3','Temperature3','BasalforcingsGroundediceMeltingRate3'};
+field_names     ={'Vx1','Vy1','Vz1','Vel1','Pressure1','Bed1','Surface1','Thickness1','Temperature1','BasalforcingsGroundediceMeltingRate1','GroundedArea1', ...
+				      'Vx2','Vy2','Vz2','Vel2','Pressure2','Bed2','Surface2','Thickness2','Temperature2','BasalforcingsGroundediceMeltingRate2','GroundedArea2', ...
+					   'Vx3','Vy3','Vz3','Vel3','Pressure3','Bed3','Surface3','Thickness3','Temperature3','BasalforcingsGroundediceMeltingRate3','GroundedArea3'};
 field_tolerances={...
-	1e-05,1e-05,1e-05,1e-05,1e-05,1e-05,1e-05,1e-05,1e-05,1e-05,...
-	1e-03,1e-03,1e-02,1e-03,1e-02,1e-04,1e-01,1e-03,1e-01,1e-01,...
-	1e-02,1e-02,1e-01,1e-02,1e-01,1e-04,1e-04,1e-04,1e-04,1e-01};
+	1e-05,1e-05,1e-05,1e-05,1e-05,1e-05,1e-05,1e-05,1e-05,1e-05,1e-6,...
+	1e-03,1e-03,1e-02,1e-03,1e-02,1e-04,1e-01,1e-03,1e-01,1e-01,1e-6,...
+	1e-02,1e-02,1e-01,1e-02,1e-01,1e-04,1e-04,1e-04,1e-04,1e-01,1e-6};
 field_values={...
 	(md.results.TransientSolution(1).Vx),...
 	(md.results.TransientSolution(1).Vy),...
@@ -26,6 +27,7 @@
 	(md.results.TransientSolution(1).Thickness),...
 	(md.results.TransientSolution(1).Temperature),...
 	(md.results.TransientSolution(1).BasalforcingsGroundediceMeltingRate),...
+	(md.results.TransientSolution(1).GroundedArea),...
 	(md.results.TransientSolution(2).Vx),...
 	(md.results.TransientSolution(2).Vy),...
 	(md.results.TransientSolution(2).Vz),...
@@ -36,6 +38,7 @@
 	(md.results.TransientSolution(2).Thickness),...
 	(md.results.TransientSolution(2).Temperature),...
 	(md.results.TransientSolution(2).BasalforcingsGroundediceMeltingRate),...
+	(md.results.TransientSolution(2).GroundedArea),...
 	(md.results.TransientSolution(3).Vx),...
 	(md.results.TransientSolution(3).Vy),...
 	(md.results.TransientSolution(3).Vz),...
@@ -46,4 +49,5 @@
 	(md.results.TransientSolution(3).Thickness),...
 	(md.results.TransientSolution(3).Temperature),...
 	(md.results.TransientSolution(3).BasalforcingsGroundediceMeltingRate),...
+	(md.results.TransientSolution(3).GroundedArea),...
 	};

Modified: issm/trunk/test/NightlyRun/test409.py
===================================================================
--- issm/trunk/test/NightlyRun/test409.py	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/NightlyRun/test409.py	2016-04-13 04:32:01 UTC (rev 20500)
@@ -15,16 +15,17 @@
 md.extrude(3,1.)
 md=setflowequation(md,'SSA','../Exp/SquareHalfRight.exp','fill','HO','coupling','penalties')
 md.cluster=generic('name',oshostname(),'np',3)
+md.transient.requested_outputs=['default','GroundedArea'];
 md=solve(md,TransientSolutionEnum())
 
 #Fields and tolerances to track changes
-field_names     =['Vx1','Vy1','Vz1','Vel1','Pressure1','Bed1','Surface1','Thickness1','Temperature1','BasalforcingsGroundediceMeltingRate1', \
-				      'Vx2','Vy2','Vz2','Vel2','Pressure2','Bed2','Surface2','Thickness2','Temperature2','BasalforcingsGroundediceMeltingRate2', \
-					   'Vx3','Vy3','Vz3','Vel3','Pressure3','Bed3','Surface3','Thickness3','Temperature3','BasalforcingsGroundediceMeltingRate3']
+field_names     =['Vx1','Vy1','Vz1','Vel1','Pressure1','Bed1','Surface1','Thickness1','Temperature1','BasalforcingsGroundediceMeltingRate1','GroundedArea1', \
+				      'Vx2','Vy2','Vz2','Vel2','Pressure2','Bed2','Surface2','Thickness2','Temperature2','BasalforcingsGroundediceMeltingRate2','GroundedArea2', \
+					   'Vx3','Vy3','Vz3','Vel3','Pressure3','Bed3','Surface3','Thickness3','Temperature3','BasalforcingsGroundediceMeltingRate3','GroundedArea3']
 field_tolerances=[\
-	1e-05,1e-05,1e-05,1e-05,1e-05,1e-05,1e-05,1e-05,1e-05,1e-05,\
-	1e-03,1e-03,1e-02,1e-03,1e-02,1e-04,1e-01,1e-03,1e-01,1e-01,\
-	1e-02,1e-02,1e-01,1e-02,1e-01,1e-04,1e-04,1e-04,1e-04,1e-01]
+	1e-05,1e-05,1e-05,1e-05,1e-05,1e-05,1e-05,1e-05,1e-05,1e-05,1e-6,\
+	1e-03,1e-03,1e-02,1e-03,1e-02,1e-04,1e-01,1e-03,1e-01,1e-01,1e-6,\
+	1e-02,1e-02,1e-01,1e-02,1e-01,1e-04,1e-04,1e-04,1e-04,1e-01,1e-6]
 field_values=[\
 	md.results.TransientSolution[0].Vx,\
 	md.results.TransientSolution[0].Vy,\
@@ -36,6 +37,7 @@
 	md.results.TransientSolution[0].Thickness,\
 	md.results.TransientSolution[0].Temperature,\
 	md.results.TransientSolution[0].BasalforcingsGroundediceMeltingRate,\
+	md.results.TransientSolution[0].GroundedArea,\
 	md.results.TransientSolution[1].Vx,\
 	md.results.TransientSolution[1].Vy,\
 	md.results.TransientSolution[1].Vz,\
@@ -46,6 +48,7 @@
 	md.results.TransientSolution[1].Thickness,\
 	md.results.TransientSolution[1].Temperature,\
 	md.results.TransientSolution[1].BasalforcingsGroundediceMeltingRate,\
+	md.results.TransientSolution[1].GroundedArea,\
 	md.results.TransientSolution[2].Vx,\
 	md.results.TransientSolution[2].Vy,\
 	md.results.TransientSolution[2].Vz,\
@@ -56,4 +59,5 @@
 	md.results.TransientSolution[2].Thickness,\
 	md.results.TransientSolution[2].Temperature,\
 	md.results.TransientSolution[2].BasalforcingsGroundediceMeltingRate,\
+	md.results.TransientSolution[2].GroundedArea,\
 	]

Modified: issm/trunk/test/NightlyRun/test410.m
===================================================================
--- issm/trunk/test/NightlyRun/test410.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/NightlyRun/test410.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -10,7 +10,7 @@
 
 %Fields and tolerances to track changes
 field_names     ={'Vx','Vy','Vz','Vel','Pressure','Temperature','BasalforcingsGroundediceMeltingRate'};
-field_tolerances={1e-09,1e-09,1e-08,3e-10,1e-13,3e-10,1e-06};
+field_tolerances={1e-09,1e-09,1e-08,3e-10,1e-13,5e-10,1e-06};
 field_values={...
 	(md.results.SteadystateSolution.Vx),...
 	(md.results.SteadystateSolution.Vy),...

Modified: issm/trunk/test/NightlyRun/test410.py
===================================================================
--- issm/trunk/test/NightlyRun/test410.py	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/NightlyRun/test410.py	2016-04-13 04:32:01 UTC (rev 20500)
@@ -20,7 +20,7 @@
 
 #Fields and tolerances to track changes
 field_names     =['Vx','Vy','Vz','Vel','Pressure','Temperature','BasalforcingsGroundediceMeltingRate']
-field_tolerances=[1e-09,1e-09,1e-08,1e-09,1e-13,3e-10,1e-06]
+field_tolerances=[1e-09,1e-09,1e-08,1e-09,1e-13,5e-10,1e-06]
 field_values=[\
 	md.results.SteadystateSolution.Vx,\
 	md.results.SteadystateSolution.Vy,\

Modified: issm/trunk/test/NightlyRun/test412.m
===================================================================
--- issm/trunk/test/NightlyRun/test412.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/NightlyRun/test412.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -13,6 +13,10 @@
 
 
 %Dakota options
+
+%dakota version
+version=IssmConfig('_DAKOTA_VERSION_'); version=version(1:3); version=str2num(version);
+
 %variables
 md.qmu.variables.rho_ice=normal_uncertain('MaterialsRhoIce',md.materials.rho_ice,0.01);
 md.qmu.variables.drag_coefficient=normal_uncertain('scaled_FrictionCoefficient',1,0.01);
@@ -25,10 +29,18 @@
 
 %parameters
 md.qmu.params.direct=true;
-md.qmu.params.analysis_driver='stressbalance';
-md.qmu.params.evaluation_concurrency=1;
 md.qmu.params.interval_type='forward';
 
+if version>=6,
+	md.qmu.params.analysis_driver='matlab';
+	md.qmu.params.evaluation_scheduling='master';
+	md.qmu.params.processors_per_evaluation=2;
+else
+	md.qmu.params.analysis_driver='stressbalance';
+	md.qmu.params.evaluation_concurrency=1;
+end
+
+
 %imperative! 
 md.stressbalance.reltol=10^-5; %tighten for qmu analysese
 

Modified: issm/trunk/test/NightlyRun/test413.m
===================================================================
--- issm/trunk/test/NightlyRun/test413.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/NightlyRun/test413.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -7,6 +7,9 @@
 
 %Dakota options
 
+%dakota version
+version=IssmConfig('_DAKOTA_VERSION_'); version=version(1:3); version=str2num(version);
+
 %partitioning
 md.qmu.numberofpartitions=20;
 md=partitioner(md,'package','chaco','npart',md.qmu.numberofpartitions,'weighting','on');
@@ -24,10 +27,16 @@
 
 %parameters
 md.qmu.params.direct=true;
-md.qmu.params.analysis_driver='stressbalance';
-md.qmu.params.evaluation_concurrency=1;
 md.qmu.params.interval_type='forward';
 
+if version>=6,
+	md.qmu.params.analysis_driver='matlab';
+	md.qmu.params.evaluation_scheduling='master';
+	md.qmu.params.processors_per_evaluation=2;
+else
+	md.qmu.params.analysis_driver='stressbalance';
+	md.qmu.params.evaluation_concurrency=1;
+end
 
 %imperative!
 md.stressbalance.reltol=10^-5; %tighten for qmu analyses

Modified: issm/trunk/test/NightlyRun/test414.m
===================================================================
--- issm/trunk/test/NightlyRun/test414.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/NightlyRun/test414.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -6,6 +6,7 @@
 md.cluster=generic('name',oshostname(),'np',3);
 md.materials.rho_ice=10^7; %involved in the mass flux, make it easy
 md.geometry.thickness(:)=1; %make it easy
+md.geometry.surface=md.geometry.base+md.geometry.thickness;
 
 %constrain all velocities to 1 m/yr, in the y-direction
 md.stressbalance.spcvx=zeros(md.mesh.numberofvertices,1);
@@ -14,6 +15,9 @@
 
 %Dakota options
 
+%dakota version
+version=IssmConfig('_DAKOTA_VERSION_'); version=version(1:3); version=str2num(version);
+
 %partitioning
 md.qmu.numberofpartitions=20;
 md=partitioner(md,'package','chaco','npart',md.qmu.numberofpartitions,'weighting','on');
@@ -41,12 +45,20 @@
 
 %parameters
 md.qmu.params.direct=true;
-md.qmu.params.analysis_driver='stressbalance';
-md.qmu.params.evaluation_concurrency=1;
 md.qmu.params.interval_type='forward';
 md.qmu.isdakota=1;
 md.stressbalance.reltol=10^-5; %tighten for qmu analyses
 
+if version>=6,
+	md.qmu.params.analysis_driver='matlab';
+	md.qmu.params.evaluation_scheduling='master';
+	md.qmu.params.processors_per_evaluation=2;
+else
+	md.qmu.params.analysis_driver='stressbalance';
+	md.qmu.params.evaluation_concurrency=1;
+end
+
+
 %solve
 md=solve(md,StressbalanceSolutionEnum(),'overwrite','y');
 md.qmu.results=md.results.dakota;

Modified: issm/trunk/test/NightlyRun/test417.m
===================================================================
--- issm/trunk/test/NightlyRun/test417.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/NightlyRun/test417.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -6,6 +6,7 @@
 md.cluster=generic('name',oshostname(),'np',3);
 md.materials.rho_ice=10^7; %involved in the mass flux, make it easy
 md.geometry.thickness(:)=1; %make it easy
+md.geometry.surface=md.geometry.base+md.geometry.thickness;
 
 %constrain all velocities to 1 m/yr, in the y-direction
 md.stressbalance.spcvx(:)=0;
@@ -13,6 +14,10 @@
 md.stressbalance.spcvz(:)=0;
 
 %Dakota options
+
+%dakota version
+version=IssmConfig('_DAKOTA_VERSION_'); version=version(1:3); version=str2num(version);
+
 md.qmu.variables.drag_coefficient=normal_uncertain('scaled_FrictionCoefficient',1,0.01);
 
 md.qmu.responses.MaxVel=response_function('MaxVel',[],[0.0001 0.001 0.01 0.25 0.5 0.75 0.99 0.999 0.9999]);
@@ -39,11 +44,19 @@
 
 %%  a variety of parameters
 md.qmu.params.direct=true;
-md.qmu.params.analysis_driver='';
 md.qmu.params.analysis_components='';
-md.qmu.params.evaluation_concurrency=1;
 md.qmu.params.tabular_graphics_data=true;
 
+if version>=6,
+	md.qmu.params.analysis_driver='matlab';
+	md.qmu.params.evaluation_scheduling='master';
+	md.qmu.params.processors_per_evaluation=2;
+else
+	md.qmu.params.analysis_driver='stressbalance';
+	md.qmu.params.evaluation_concurrency=1;
+end
+
+
 %partitioning
 md.qmu.numberofpartitions=20;
 md=partitioner(md,'package','chaco','npart',md.qmu.numberofpartitions,'weighting','on');

Modified: issm/trunk/test/NightlyRun/test420.m
===================================================================
--- issm/trunk/test/NightlyRun/test420.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/NightlyRun/test420.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -12,6 +12,10 @@
 md.qmu.isdakota=1;
 
 %Dakota options
+
+%dakota version
+version=IssmConfig('_DAKOTA_VERSION_'); version=version(1:3); version=str2num(version);
+
 %variables
 md.qmu.variables.rho_ice=normal_uncertain('MaterialsRhoIce',md.materials.rho_ice,0.01);
 
@@ -23,11 +27,19 @@
 
 %parameters
 md.qmu.params.direct=true;
-md.qmu.params.analysis_driver='stressbalance';
-md.qmu.params.evaluation_concurrency=1;
 md.qmu.params.interval_type='forward';
 
+if version>=6,
+	md.qmu.params.analysis_driver='matlab';
+	md.qmu.params.evaluation_scheduling='master';
+	md.qmu.params.processors_per_evaluation=2;
+else
+	md.qmu.params.analysis_driver='stressbalance';
+	md.qmu.params.evaluation_concurrency=1;
+end
 
+
+
 %imperative! 
 md.stressbalance.reltol=10^-5; %tighten for qmu analysese
 

Modified: issm/trunk/test/NightlyRun/test422.m
===================================================================
--- issm/trunk/test/NightlyRun/test422.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/NightlyRun/test422.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -10,7 +10,7 @@
 
 %Fields and tolerances to track changes
 field_names     ={'Vx','Vy','Vz','Vel','Pressure'};
-field_tolerances={3e-07,2e-07,2e-06,2e-07,5e-07};
+field_tolerances={4e-07,4e-07,2e-06,2e-07,5e-07};
 field_values={...
 	(md.results.StressbalanceSolution.Vx),...
 	(md.results.StressbalanceSolution.Vy),...

Modified: issm/trunk/test/NightlyRun/test422.py
===================================================================
--- issm/trunk/test/NightlyRun/test422.py	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/NightlyRun/test422.py	2016-04-13 04:32:01 UTC (rev 20500)
@@ -20,7 +20,7 @@
 
 #Fields and tolerances to track changes
 field_names     =['Vx','Vy','Vz','Vel','Pressure']
-field_tolerances=[3e-07,2e-07,2e-06,2e-07,5e-07]
+field_tolerances=[4e-07,4e-07,2e-06,2e-07,5e-07]
 field_values=[\
 	md.results.StressbalanceSolution.Vx,\
 	md.results.StressbalanceSolution.Vy,\

Modified: issm/trunk/test/NightlyRun/test423.m
===================================================================
--- issm/trunk/test/NightlyRun/test423.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/NightlyRun/test423.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -20,6 +20,7 @@
 
 md.transient.isthermal=0;
 md.transient.ismasstransport=0;
+md.transient.issmb=1;
 md.transient.isstressbalance=1;
 md.transient.isgroundingline=1;
 

Modified: issm/trunk/test/NightlyRun/test423.py
===================================================================
--- issm/trunk/test/NightlyRun/test423.py	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/NightlyRun/test423.py	2016-04-13 04:32:01 UTC (rev 20500)
@@ -31,6 +31,7 @@
 
 md.transient.isthermal=False
 md.transient.ismasstransport=False
+md.transient.issmb=True
 md.transient.isstressbalance=True
 md.transient.isgroundingline=True
 

Modified: issm/trunk/test/NightlyRun/test424.m
===================================================================
--- issm/trunk/test/NightlyRun/test424.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/NightlyRun/test424.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -9,7 +9,7 @@
 md.geometry.bed =-700.-abs(md.mesh.y-500000.)/1000.;
 md.geometry.thickness(:)=1000.;
 md.geometry.surface=md.geometry.base+md.geometry.thickness;
-md.surfaceforcings.mass_balance(:)=100.;
+md.smb.mass_balance(:)=100.;
 md.transient.isstressbalance=0;
 md.transient.isgroundingline=1;
 md.groundingline.migration='AggressiveMigration';

Modified: issm/trunk/test/NightlyRun/test424.py
===================================================================
--- issm/trunk/test/NightlyRun/test424.py	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/NightlyRun/test424.py	2016-04-13 04:32:01 UTC (rev 20500)
@@ -19,7 +19,7 @@
 md.geometry.bed =-700.-abs(md.mesh.y.reshape(-1,1)-500000.)/1000.
 md.geometry.thickness[:]=1000.
 md.geometry.surface=md.geometry.base+md.geometry.thickness
-md.surfaceforcings.mass_balance[:]=100.
+md.smb.mass_balance[:]=100.
 md.transient.isstressbalance=False
 md.transient.isgroundingline=True
 md.groundingline.migration='AggressiveMigration'

Modified: issm/trunk/test/NightlyRun/test425.m
===================================================================
--- issm/trunk/test/NightlyRun/test425.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/NightlyRun/test425.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -9,7 +9,7 @@
 md.geometry.bed =-700.-abs(md.mesh.y-500000.)/1000.;
 md.geometry.thickness(:)=1300.;
 md.geometry.surface=md.geometry.base+md.geometry.thickness;
-md.surfaceforcings.mass_balance(:)=-150.;
+md.smb.mass_balance(:)=-150.;
 md.transient.isstressbalance=0;
 md.transient.isgroundingline=1;
 md.groundingline.migration='SoftMigration';

Modified: issm/trunk/test/NightlyRun/test425.py
===================================================================
--- issm/trunk/test/NightlyRun/test425.py	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/NightlyRun/test425.py	2016-04-13 04:32:01 UTC (rev 20500)
@@ -19,7 +19,7 @@
 md.geometry.bed =-700.-abs(md.mesh.y.reshape(-1,1)-500000.)/1000.
 md.geometry.thickness[:]=1300.
 md.geometry.surface=md.geometry.base+md.geometry.thickness
-md.surfaceforcings.mass_balance[:]=-150.
+md.smb.mass_balance[:]=-150.
 md.transient.isstressbalance=False
 md.transient.isgroundingline=True
 md.groundingline.migration='SoftMigration'

Modified: issm/trunk/test/NightlyRun/test426.m
===================================================================
--- issm/trunk/test/NightlyRun/test426.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/NightlyRun/test426.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -8,7 +8,7 @@
 md.geometry.bed =-700.-abs(md.mesh.y-500000.)/1000.;
 md.geometry.thickness(:)=1000.;
 md.geometry.surface=md.geometry.base+md.geometry.thickness;
-md.surfaceforcings.mass_balance(:)=100.;
+md.smb.mass_balance(:)=100.;
 md=extrude(md,3,1.);
 md=setflowequation(md,'SSA','all');
 md.transient.isstressbalance=0;

Modified: issm/trunk/test/NightlyRun/test426.py
===================================================================
--- issm/trunk/test/NightlyRun/test426.py	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/NightlyRun/test426.py	2016-04-13 04:32:01 UTC (rev 20500)
@@ -18,7 +18,7 @@
 md.geometry.bed =-700.-abs(md.mesh.y.reshape(-1,1)-500000.)/1000.
 md.geometry.thickness[:]=1000.
 md.geometry.surface=md.geometry.base+md.geometry.thickness
-md.surfaceforcings.mass_balance[:]=100.
+md.smb.mass_balance[:]=100.
 md.extrude(3,1.);
 md=setflowequation(md,'SSA','all');
 md.transient.isstressbalance=False

Modified: issm/trunk/test/NightlyRun/test427.m
===================================================================
--- issm/trunk/test/NightlyRun/test427.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/NightlyRun/test427.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -11,7 +11,7 @@
 md=setflowequation(md,'SSA','all');
 md=extrude(md,3,1.);
 
-md.surfaceforcings.mass_balance(:)=-150;
+md.smb.mass_balance(:)=-150;
 md.transient.isstressbalance=0;
 md.transient.isgroundingline=1;
 md.groundingline.migration='SoftMigration';

Modified: issm/trunk/test/NightlyRun/test427.py
===================================================================
--- issm/trunk/test/NightlyRun/test427.py	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/NightlyRun/test427.py	2016-04-13 04:32:01 UTC (rev 20500)
@@ -21,7 +21,7 @@
 md=setflowequation(md,'SSA','all')
 md.extrude(3,1.)
 
-md.surfaceforcings.mass_balance[:]=-150
+md.smb.mass_balance[:]=-150
 md.transient.isstressbalance=False
 md.transient.isgroundingline=True
 md.groundingline.migration='SoftMigration'

Modified: issm/trunk/test/NightlyRun/test431.m
===================================================================
--- issm/trunk/test/NightlyRun/test431.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/NightlyRun/test431.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -14,7 +14,7 @@
 
 %Fields and tolerances to track changes
 field_names     ={'Vx','Vy','Vz','Vel','Pressure','Temperature','Waterfraction','Enthalpy'};
-field_tolerances={8e-5,5e-5,5e-5,5e-5,1e-13,1e-5,5e-5,5e-5};
+field_tolerances={8e-4,5e-4,5e-4,5e-4,1e-13,1e-4,5e-4,5e-4};
 field_values={...
 	(md.results.SteadystateSolution.Vx),...
 	(md.results.SteadystateSolution.Vy),...

Modified: issm/trunk/test/NightlyRun/test431.py
===================================================================
--- issm/trunk/test/NightlyRun/test431.py	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/NightlyRun/test431.py	2016-04-13 04:32:01 UTC (rev 20500)
@@ -24,7 +24,7 @@
 
 #Fields and tolerances to track changes
 field_names     =['Vx','Vy','Vz','Vel','Pressure','Temperature','Waterfraction','Enthalpy']
-field_tolerances=[8e-5,5e-5,5e-5,5e-5,1e-13,1e-5,5e-5,5e-5]
+field_tolerances=[8e-4,5e-4,5e-4,5e-4,1e-13,1e-4,5e-4,5e-4]
 field_values=[\
 	md.results.SteadystateSolution.Vx,\
 	md.results.SteadystateSolution.Vy,\

Modified: issm/trunk/test/NightlyRun/test432.m
===================================================================
--- issm/trunk/test/NightlyRun/test432.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/NightlyRun/test432.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -13,7 +13,7 @@
 
 %Fields and tolerances to track changes
 field_names     ={'Vx','Vy','Vz','Vel','Pressure','Temperature','Waterfraction','Enthalpy'};
-field_tolerances={3e-09,1e-09,1e-09,1e-09,1e-13,1e-10,3e-10,3e-10};
+field_tolerances={3e-09,1e-09,1e-09,1e-09,1e-13,1e-10,3.2e-10,3e-9};
 field_values={...
 	(md.results.SteadystateSolution.Vx),...
 	(md.results.SteadystateSolution.Vy),...

Modified: issm/trunk/test/NightlyRun/test432.py
===================================================================
--- issm/trunk/test/NightlyRun/test432.py	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/NightlyRun/test432.py	2016-04-13 04:32:01 UTC (rev 20500)
@@ -23,7 +23,7 @@
 
 #Fields and tolerances to track changes
 field_names     =['Vx','Vy','Vz','Vel','Pressure','Temperature','Waterfraction','Enthalpy']
-field_tolerances=[3e-09,1e-09,1e-09,1e-09,1e-13,1e-10,3e-10,3e-10]
+field_tolerances=[3e-09,1e-09,1e-09,1e-09,1e-13,1e-10,3.2e-10,3e-9]
 field_values=[\
 	md.results.SteadystateSolution.Vx,\
 	md.results.SteadystateSolution.Vy,\

Modified: issm/trunk/test/NightlyRun/test433.m
===================================================================
--- issm/trunk/test/NightlyRun/test433.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/NightlyRun/test433.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -21,6 +21,7 @@
 
 md.transient.isthermal=0;
 md.transient.ismasstransport=0;
+md.transient.issmb=1;
 md.transient.isstressbalance=0;
 md.transient.isgroundingline=1;
 
@@ -38,6 +39,8 @@
 element_on_iceshelf_subelement=(md.results.TransientSolution.MaskGroundediceLevelset);
 
 md.groundingline.migration='SubelementMigration2';
+md.transient.isstressbalance=1;
+md=setflowequation(md,'SSA','all');
 md=solve(md,TransientSolutionEnum());
 element_on_iceshelf_subelement2=(md.results.TransientSolution.MaskGroundediceLevelset);
 

Modified: issm/trunk/test/NightlyRun/test433.py
===================================================================
--- issm/trunk/test/NightlyRun/test433.py	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/NightlyRun/test433.py	2016-04-13 04:32:01 UTC (rev 20500)
@@ -32,6 +32,7 @@
 
 md.transient.isthermal=False
 md.transient.ismasstransport=False
+md.transient.issmb=True
 md.transient.isstressbalance=False
 md.transient.isgroundingline=True
 

Modified: issm/trunk/test/NightlyRun/test435.m
===================================================================
--- issm/trunk/test/NightlyRun/test435.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/NightlyRun/test435.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -30,13 +30,14 @@
 md.materials.rheology_law='None';
 md.friction.coefficient(:)=sqrt(10^7)*ones(md.mesh.numberofvertices,1);
 md.friction.p=3*ones(md.mesh.numberofelements,1);
-md.surfaceforcings.mass_balance(:)=1;
+md.smb.mass_balance(:)=1;
 md.basalforcings.groundedice_melting_rate(:)=0;
 md.basalforcings.floatingice_melting_rate(:)=0;
 md.transient.isthermal=0;
 md.transient.isstressbalance=1;
 md.transient.isgroundingline=1;
 md.transient.ismasstransport=1;
+md.transient.issmb=1;
 md.groundingline.migration='SubelementMigration';
 md.timestepping.final_time=30;
 md.timestepping.time_step=10;

Modified: issm/trunk/test/NightlyRun/test437.m
===================================================================
--- issm/trunk/test/NightlyRun/test437.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/NightlyRun/test437.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -37,6 +37,7 @@
 %Additional settings
 md.transient.ismasstransport=0;
 md.transient.isstressbalance=0;
+md.transient.issmb=1;
 md.transient.isthermal=1;
 md.thermal.stabilization = 0;
 

Modified: issm/trunk/test/NightlyRun/test438.m
===================================================================
--- issm/trunk/test/NightlyRun/test438.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/NightlyRun/test438.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -7,6 +7,7 @@
 md.friction.water_layer=zeros(md.mesh.numberofvertices,2);
 md.friction.water_layer(:,2)=1;
 md.friction.water_layer(md.mesh.numberofvertices+1,:)=[1 2];
+md.friction.f=0.8;
 md.cluster=generic('name',oshostname(),'np',3);
 md=solve(md,TransientSolutionEnum());
 

Modified: issm/trunk/test/NightlyRun/test439.m
===================================================================
--- issm/trunk/test/NightlyRun/test439.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/NightlyRun/test439.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -8,6 +8,7 @@
 md.friction.water_layer=zeros(md.mesh.numberofvertices,2);
 md.friction.water_layer(:,2)=1;
 md.friction.water_layer(md.mesh.numberofvertices+1,:)=[1 2];
+md.friction.f=0.8;
 md.cluster=generic('name',oshostname(),'np',3);
 md=solve(md,TransientSolutionEnum());
 

Modified: issm/trunk/test/NightlyRun/test455.m
===================================================================
--- issm/trunk/test/NightlyRun/test455.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/NightlyRun/test455.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -13,7 +13,7 @@
 	md.flowequation.fe_HO=i{1};
 	md=solve(md,StressbalanceSolutionEnum());
 	field_names     ={field_names{:},['Vx' i{1}],['Vy' i{1}],['Vz' i{1}],['Vel' i{1}],['Pressure' i{1}]};
-	field_tolerances={field_tolerances{:},5e-08,4e-08,1e-08,4e-08,3e-13};
+	field_tolerances={field_tolerances{:},5e-08,5e-08,5e-08,5e-08,3e-13};
 	field_values={field_values{:},...
 	(md.results.StressbalanceSolution.Vx),...
 	(md.results.StressbalanceSolution.Vy),...

Modified: issm/trunk/test/NightlyRun/test455.py
===================================================================
--- issm/trunk/test/NightlyRun/test455.py	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/NightlyRun/test455.py	2016-04-13 04:32:01 UTC (rev 20500)
@@ -23,7 +23,7 @@
 	md.flowequation.fe_HO=i
 	md=solve(md,StressbalanceSolutionEnum())
 	field_names     =field_names+['Vx'+i,'Vy'+i,'Vz'+i,'Vel'+i,'Pressure'+i]
-	field_tolerances=field_tolerances+[5e-08,4e-08,1e-08,4e-08,3e-13]
+	field_tolerances=field_tolerances+[5e-08,5e-08,5e-08,5e-08,3e-13]
 	field_values=field_values+[\
 			md.results.StressbalanceSolution.Vx,\
 			md.results.StressbalanceSolution.Vy,\

Modified: issm/trunk/test/NightlyRun/test505.py
===================================================================
--- issm/trunk/test/NightlyRun/test505.py	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/NightlyRun/test505.py	2016-04-13 04:32:01 UTC (rev 20500)
@@ -19,8 +19,8 @@
 # Fields and tolerances to track changes
 field_names     =['Vx1','Vy1','Vz1','Vel1','Pressure1','Bed1','Surface1','Thickness1','Temperature1','BasalforcingsGroundediceMeltingRate1', \
 				      'Vx2','Vy2','Vz2','Vel2','Pressure2','Bed2','Surface2','Thickness2','Temperature2','BasalforcingsGroundediceMeltingRate2']
-field_tolerances=[1e-12,1e-12,1e-10,1e-12,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13, \
-						1e-13,1e-12,1e-10,1e-12,1e-13,1e-11,1e-11,2e-12,1e-11,1e-8]
+field_tolerances=[1e-12,1e-12,1e-10,1e-12,1e-13,3e-13,7e-13,3e-13,1e-13,6e-10, \
+						2e-12,5e-12,1e-10,4e-12,3e-13,1e-11,1e-11,2e-12,1e-11,1e-8]
 field_values=[\
 	md.results.TransientSolution[0].Vx,\
 	md.results.TransientSolution[0].Vy,\

Modified: issm/trunk/test/NightlyRun/test513.m
===================================================================
--- issm/trunk/test/NightlyRun/test513.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/NightlyRun/test513.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -25,7 +25,7 @@
 
 %Fields and tolerances to track changes
 field_names     ={'Gradient','Misfits','FrictionCoefficient','Pressure','Vel','Vx','Vy','Vz','Temperature','BasalforcingsGroundediceMeltingRate'};
-field_tolerances={5e-08,2e-10,1e-10,1e-10,3e-6,3e-6,3e-6,3e-6,2e-6,2e-06};
+field_tolerances={5e-08,4e-10,1e-10,1e-10,3e-6,4e-6,4e-6,3e-6,2e-6,2e-06};
 field_values={...
 	(md.results.SteadystateSolution.Gradient1),...
 	md.results.SteadystateSolution.J,...

Modified: issm/trunk/test/NightlyRun/test513.py
===================================================================
--- issm/trunk/test/NightlyRun/test513.py	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/NightlyRun/test513.py	2016-04-13 04:32:01 UTC (rev 20500)
@@ -36,7 +36,7 @@
 
 # Fields and tolerances to track changes
 field_names     =['Gradient','Misfits','FrictionCoefficient','Pressure','Vel','Vx','Vy','Vz','Temperature','BasalforcingsGroundediceMeltingRate']
-field_tolerances=[5e-08,2e-10,1e-10,1e-10,3e-6,3e-6,3e-6,3e-6,2e-6,2e-06]
+field_tolerances=[5e-08,4e-10,1e-10,1e-10,3e-6,4e-6,3.4e-6,3e-6,2e-6,2e-06]
 field_values=[\
 	md.results.SteadystateSolution.Gradient1,\
 	md.results.SteadystateSolution.J,\

Modified: issm/trunk/test/NightlyRun/test515.m
===================================================================
--- issm/trunk/test/NightlyRun/test515.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/NightlyRun/test515.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -8,6 +8,7 @@
 md.cluster=generic('name',oshostname(),'np',3);
 md.transient.isstressbalance=0;
 md.transient.ismasstransport=0;
+md.transient.issmb=1;
 md.transient.isthermal=1;
 md.transient.isgroundingline=0;
 md=solve(md,TransientSolutionEnum());
@@ -15,7 +16,7 @@
 %Fields and tolerances to track changes
 field_names     ={'Temperature1','BasalforcingsGroundediceMeltingRate1', ...
 				      'Temperature2','BasalforcingsGroundediceMeltingRate2'};
-field_tolerances={1e-13,1e-8,1e-13,3e-8};
+field_tolerances={1e-13,1e-8,1e-13,5e-8};
 field_values={...
 	(md.results.TransientSolution(1).Temperature),...
 	(md.results.TransientSolution(1).BasalforcingsGroundediceMeltingRate),...

Modified: issm/trunk/test/NightlyRun/test515.py
===================================================================
--- issm/trunk/test/NightlyRun/test515.py	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/NightlyRun/test515.py	2016-04-13 04:32:01 UTC (rev 20500)
@@ -17,6 +17,7 @@
 md.cluster=generic('name',oshostname(),'np',3)
 md.transient.isstressbalance=False
 md.transient.ismasstransport=False
+md.transient.issmb=True
 md.transient.isthermal=True
 md.transient.isgroundingline=False
 md=solve(md,TransientSolutionEnum())
@@ -24,7 +25,7 @@
 # Fields and tolerances to track changes
 field_names     =['Temperature1','BasalforcingsGroundediceMeltingRate1', \
 				      'Temperature2','BasalforcingsGroundediceMeltingRate2']
-field_tolerances=[1e-13,1e-8,1e-13,2e-8]
+field_tolerances=[1e-13,1e-8,1e-13,5e-8]
 field_values=[\
 	md.results.TransientSolution[0].Temperature,\
 	md.results.TransientSolution[0].BasalforcingsGroundediceMeltingRate,\

Modified: issm/trunk/test/NightlyRun/test701.m
===================================================================
--- issm/trunk/test/NightlyRun/test701.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/NightlyRun/test701.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -57,7 +57,7 @@
 	md.flowequation.fe_FS=i{1};
 	md=solve(md,StressbalanceSolutionEnum());
 	field_names     ={field_names{:},['Vx' i{1}],['Vy' i{1}],['Vel' i{1}],['Pressure' i{1}]};
-	field_tolerances={field_tolerances{:},9e-5,8e-5,9e-5,1e-10};
+	field_tolerances={field_tolerances{:},9e-5,9e-5,9e-5,1e-10};
 	field_values={field_values{:},...
 		(md.results.StressbalanceSolution.Vx),...
 		(md.results.StressbalanceSolution.Vy),...

Modified: issm/trunk/test/NightlyRun/test703.m
===================================================================
--- issm/trunk/test/NightlyRun/test703.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/NightlyRun/test703.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -42,7 +42,7 @@
 md.timestepping.time_step=0.000001;
 md.timestepping.final_time=0.000005;
 md.stressbalance.shelf_dampening=1;
-md.surfaceforcings.mass_balance=zeros(md.mesh.numberofvertices,1);
+md.smb.mass_balance=zeros(md.mesh.numberofvertices,1);
 md.basalforcings.groundedice_melting_rate=zeros(md.mesh.numberofvertices,1);
 md.basalforcings.floatingice_melting_rate=zeros(md.mesh.numberofvertices,1);
 md.basalforcings.geothermalflux=zeros(md.mesh.numberofvertices,1);

Modified: issm/trunk/test/NightlyRun/test801.m
===================================================================
--- issm/trunk/test/NightlyRun/test801.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/NightlyRun/test801.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -7,9 +7,9 @@
 
 %Transient;
 md.transient.isstressbalance=1;
-md.transient.islevelset=1;
-md.transient.iscalving=1;
+md.transient.ismovingfront=1;
 md.transient.ismasstransport=1;
+md.transient.issmb=1;
 md.transient.isthermal=0;
 md.transient.isgroundingline=1;
 md.transient.isgia=0;

Modified: issm/trunk/test/NightlyRun/test801.py
===================================================================
--- issm/trunk/test/NightlyRun/test801.py	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/NightlyRun/test801.py	2016-04-13 04:32:01 UTC (rev 20500)
@@ -17,9 +17,9 @@
 
 #Transient
 md.transient.isstressbalance=True
-md.transient.islevelset=True
-md.transient.iscalving=True
+md.transient.ismovingfront=True
 md.transient.ismasstransport=True
+md.transient.issmb=True
 md.transient.isthermal=False
 md.transient.isgroundingline=True
 md.transient.isgia=False

Modified: issm/trunk/test/NightlyRun/test802.m
===================================================================
--- issm/trunk/test/NightlyRun/test802.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/NightlyRun/test802.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -12,9 +12,9 @@
 
 %Transient
 md.transient.isstressbalance=1;
-md.transient.islevelset=1;
-md.transient.iscalving=1;
+md.transient.ismovingfront=1;
 md.transient.ismasstransport=1;
+md.transient.issmb=1;
 md.transient.isthermal=1;
 md.transient.isgroundingline=1;
 md.transient.isgia=0;
@@ -26,7 +26,7 @@
 		'Vx2','Vy2','Vel2','Pressure2','Thickness2','Surface2','MaskIceLevelset2','Temperature2',...
 		'Vx3','Vy3','Vel3','Pressure3','Thickness3','Surface3','MaskIceLevelset3','Temperature3'};
 field_tolerances={1e-12,1e-12,1e-12,1e-12,1e-12,1e-12,1e-12,1e-12,...
-		1e-10,1e-10,1e-10,1e-10,1e-10,1e-10,1e-10,1e-10,...
+		1e-9,1e-9,1e-10,1e-10,1e-10,1e-10,1e-10,1e-9,...
 		1e-11,1e-11,1e-11,1e-11,1e-11,1e-11,1e-11,1e-11};
 field_values={...
 	md.results.TransientSolution(1).Vx,...

Modified: issm/trunk/test/NightlyRun/test802.py
===================================================================
--- issm/trunk/test/NightlyRun/test802.py	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/NightlyRun/test802.py	2016-04-13 04:32:01 UTC (rev 20500)
@@ -22,9 +22,9 @@
 
 #Transient
 md.transient.isstressbalance=True
-md.transient.islevelset=True
-md.transient.iscalving=True
+md.transient.ismovingfront=True
 md.transient.ismasstransport=True
+md.transient.issmb=True
 md.transient.isthermal=True
 md.transient.isgroundingline=True
 md.transient.isgia=False
@@ -36,7 +36,7 @@
 		'Vx2','Vy2','Vel2','Pressure2','Thickness2','Surface2','MaskIceLevelset2','Temperature2',\
 		'Vx3','Vy3','Vel3','Pressure3','Thickness3','Surface3','MaskIceLevelset3','Temperature3']
 field_tolerances=[1e-12,1e-12,1e-12,1e-12,1e-12,1e-12,1e-12,1e-12,\
-		1e-10,1e-10,1e-10,1e-10,1e-10,1e-10,1e-10,1e-10,\
+		1e-9,1e-9,1e-10,1e-10,1e-10,1e-10,1e-10,1e-9,\
 		1e-10,1e-10,1e-10,1e-10,1e-10,1e-10,1e-10,1e-10]
 field_values=[\
 	md.results.TransientSolution[0].Vx,\

Modified: issm/trunk/test/NightlyRun/test803.m
===================================================================
--- issm/trunk/test/NightlyRun/test803.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/NightlyRun/test803.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -14,9 +14,9 @@
 
 %Transient
 md.transient.isstressbalance=1;
-md.transient.islevelset=1;
-md.transient.iscalving=1;
+md.transient.ismovingfront=1;
 md.transient.ismasstransport=1;
+md.transient.issmb=1;
 md.transient.isthermal=1;
 md.transient.isgroundingline=1;
 md.transient.isgia=0;
@@ -28,7 +28,7 @@
 		'Vx2','Vy2','Vel2','Pressure2','Thickness2','Surface2','MaskIceLevelset2','Enthalpy2','Watercolumn2',...
 		'Vx3','Vy3','Vel3','Pressure3','Thickness3','Surface3','MaskIceLevelset3','Enthalpy3','Watercolumn3'};
 field_tolerances={1e-10,1e-10,1e-10,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,...
-		1e-10,1e-10,1e-10,1e-10,1e-10,1e-10,1e-10,1e-10,1e-10,...
+		1e-9,1e-9,1e-10,1e-10,1e-10,1e-10,1e-10,1e-9,1e-10,...
 		1e-10,1e-10,1e-10,1e-10,1e-10,1e-10,1e-10,1e-10,1e-10};
 field_values={...
 	md.results.TransientSolution(1).Vx,...

Modified: issm/trunk/test/NightlyRun/test803.py
===================================================================
--- issm/trunk/test/NightlyRun/test803.py	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/NightlyRun/test803.py	2016-04-13 04:32:01 UTC (rev 20500)
@@ -24,9 +24,9 @@
 
 #Transient
 md.transient.isstressbalance=True
-md.transient.islevelset=True
-md.transient.iscalving=True
+md.transient.ismovingfront=True
 md.transient.ismasstransport=True
+md.transient.issmb=True
 md.transient.isthermal=True
 md.transient.isgroundingline=True
 md.transient.isgia=False
@@ -38,7 +38,7 @@
 		'Vx2','Vy2','Vel2','Pressure2','Thickness2','Surface2','MaskIceLevelset2','Enthalpy2','Watercolumn2',\
 		'Vx3','Vy3','Vel3','Pressure3','Thickness3','Surface3','MaskIceLevelset3','Enthalpy3','Watercolumn3']
 field_tolerances=[1e-10,1e-10,1e-10,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,\
-		1e-10,1e-10,1e-10,1e-10,1e-10,1e-10,1e-10,1e-10,1e-10,\
+		1e-9,1e-9,1e-10,1e-10,1e-10,1e-10,1e-10,1e-9,1e-10,\
 		1e-10,1e-10,1e-10,1e-10,1e-10,1e-10,1e-10,1e-10,1e-10]
 field_values=[\
 	md.results.TransientSolution[0].Vx,\

Modified: issm/trunk/test/NightlyRun/test804.m
===================================================================
--- issm/trunk/test/NightlyRun/test804.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/NightlyRun/test804.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -7,12 +7,12 @@
 
 %Transient
 md.transient.isstressbalance=1;
-md.transient.islevelset=1;
 md.transient.ismasstransport=1;
+md.transient.issmb=1;
 md.transient.isthermal=0;
 md.transient.isgroundingline=1;
 md.transient.isgia=0;
-md.transient.iscalving=1;
+md.transient.ismovingfront=1;
 
 md.calving.calvingrate=1000.*ones(md.mesh.numberofvertices,1);
 md.calving.meltingrate=zeros(md.mesh.numberofvertices,1);

Modified: issm/trunk/test/NightlyRun/test804.py
===================================================================
--- issm/trunk/test/NightlyRun/test804.py	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/NightlyRun/test804.py	2016-04-13 04:32:01 UTC (rev 20500)
@@ -17,12 +17,12 @@
 
 #Transient
 md.transient.isstressbalance=True
-md.transient.islevelset=True
 md.transient.ismasstransport=True
+md.transient.issmb=True
 md.transient.isthermal=False
 md.transient.isgroundingline=True
 md.transient.isgia=False
-md.transient.iscalving=True;
+md.transient.ismovingfront=True;
 
 md.calving.calvingrate=1000.*numpy.ones((md.mesh.numberofvertices,1))
 md.calving.meltingrate=numpy.zeros((md.mesh.numberofvertices,1))

Modified: issm/trunk/test/NightlyRun/test805.m
===================================================================
--- issm/trunk/test/NightlyRun/test805.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/NightlyRun/test805.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -14,12 +14,12 @@
 
 %Transient
 md.transient.isstressbalance=1;
-md.transient.islevelset=1;
 md.transient.ismasstransport=1;
+md.transient.issmb=1;
 md.transient.isthermal=1;
 md.transient.isgroundingline=1;
 md.transient.isgia=0;
-md.transient.iscalving=1;
+md.transient.ismovingfront=1;
 
 md.calving.calvingrate=1000.*ones(md.mesh.numberofvertices,1);
 md.calving.meltingrate=zeros(md.mesh.numberofvertices,1);
@@ -31,7 +31,7 @@
 		'Vx2','Vy2','Vel2','Pressure2','Thickness2','Surface2','MaskIceLevelset2','Enthalpy2','Watercolumn2',...
 		'Vx3','Vy3','Vel3','Pressure3','Thickness3','Surface3','MaskIceLevelset3','Enthalpy3','Watercolumn3'};
 field_tolerances={1e-11,1e-11,1e-11,1e-11,1e-11,1e-11,1e-11,1e-11,1e-11,...
-		1e-10,1e-10,1e-10,1e-10,1e-10,1e-10,1e-10,1e-10,1e-10,...
+		1e-9,1e-9,1e-10,1e-10,1e-10,1e-10,1e-10,1e-9,1e-10,...
 		1e-10,1e-10,1e-10,1e-10,1e-10,1e-10,1e-10,1e-10,1e-10};
 field_values={...
 	md.results.TransientSolution(1).Vx,...

Modified: issm/trunk/test/NightlyRun/test805.py
===================================================================
--- issm/trunk/test/NightlyRun/test805.py	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/NightlyRun/test805.py	2016-04-13 04:32:01 UTC (rev 20500)
@@ -24,12 +24,12 @@
 
 #Transient
 md.transient.isstressbalance=True
-md.transient.islevelset=True
 md.transient.ismasstransport=True
+md.transient.issmb=True
 md.transient.isthermal=True
 md.transient.isgroundingline=True
 md.transient.isgia=False
-md.transient.iscalving=True;
+md.transient.ismovingfront=True;
 
 md.calving.calvingrate=1000.*numpy.ones((md.mesh.numberofvertices,1))
 md.calving.meltingrate=numpy.zeros((md.mesh.numberofvertices,1))
@@ -41,7 +41,7 @@
 		'Vx2','Vy2','Vel2','Pressure2','Thickness2','Surface2','MaskIceLevelset2','Enthalpy2','Watercolumn2',\
 		'Vx3','Vy3','Vel3','Pressure3','Thickness3','Surface3','MaskIceLevelset3','Enthalpy3','Watercolumn3']
 field_tolerances=[1e-11,1e-11,1e-11,1e-11,1e-11,1e-11,1e-11,1e-11,1e-11,\
-		1e-10,1e-10,1e-10,1e-10,1e-10,1e-10,1e-10,1e-10,1e-10,\
+		1e-9,1e-9,1e-10,1e-10,1e-10,1e-10,1e-10,1e-9,1e-10,\
 		1e-10,1e-10,1e-10,1e-10,1e-10,1e-10,1e-10,1e-10,1e-10]
 field_values=[\
 	md.results.TransientSolution[0].Vx,\

Modified: issm/trunk/test/NightlyRun/test806.m
===================================================================
--- issm/trunk/test/NightlyRun/test806.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/NightlyRun/test806.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -17,16 +17,17 @@
 
 %Transient
 md.transient.isstressbalance=1;
-md.transient.islevelset=1;
 md.transient.ismasstransport=1;
+md.transient.issmb=1;
 md.transient.isthermal=0;
 md.transient.isgroundingline=0;
 md.transient.isgia=0;
-md.transient.iscalving=1;
+md.transient.ismovingfront=1;
 
 md.calving=calvinglevermann();
 md.calving.coeff=4.89e13*ones(md.mesh.numberofvertices,1);
 md.calving.meltingrate=zeros(md.mesh.numberofvertices,1);
+md.levelset.spclevelset=NaN(md.mesh.numberofvertices,1);
 
 md.transient.requested_outputs={'default','StrainRateparallel','StrainRateperpendicular','Calvingratex','Calvingratey','CalvingCalvingrate'};
 
@@ -38,7 +39,7 @@
 		'Vx3','Vy3','Vel3','Pressure3','Thickness3','Surface3','MaskIceLevelset3','StrainRateparallel3','StrainRateperpendicular3','CalvingCalvingrate3'};
 field_tolerances={1e-11,1e-11,1e-11,1e-11,1e-11,1e-11,1e-11,1e-11,1e-11,1e-11,...
 		2e-11,2e-11,2e-11,1e-11,1e-11,1e-11,1e-11,1e-11,1e-11,1e-11,...
-		2e-11,2e-11,2e-11,1e-11,1e-11,1e-11,1e-11,1e-11,1e-11,1e-11};
+		2e-11,2e-11,2e-11,1e-11,1e-11,1e-11,1e-11,5e-11,5e-11,5e-11};
 field_values={...
 	md.results.TransientSolution(1).Vx,...
 	md.results.TransientSolution(1).Vy,...

Modified: issm/trunk/test/NightlyRun/test806.py
===================================================================
--- issm/trunk/test/NightlyRun/test806.py	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/NightlyRun/test806.py	2016-04-13 04:32:01 UTC (rev 20500)
@@ -26,20 +26,19 @@
 md.timestepping.time_step=10
 md.timestepping.final_time=30
 
-
-
 #Transient
 md.transient.isstressbalance=True
-md.transient.islevelset=True
 md.transient.ismasstransport=True
+md.transient.issmb=True
 md.transient.isthermal=False
 md.transient.isgroundingline=False
 md.transient.isgia=False
-md.transient.iscalving=True;
+md.transient.ismovingfront=True;
 
 md.calving=calvinglevermann()
 md.calving.coeff=4.89e13*numpy.ones((md.mesh.numberofvertices,1))
 md.calving.meltingrate=numpy.zeros((md.mesh.numberofvertices,1))
+md.levelset.spclevelset=numpy.float('NaN')*numpy.ones((md.mesh.numberofvertices,1))
 
 md.transient.requested_outputs=['default','StrainRateparallel','StrainRateperpendicular','Calvingratex','Calvingratey','CalvingCalvingrate']
 
@@ -51,7 +50,7 @@
 		'Vx3','Vy3','Vel3','Pressure3','Thickness3','Surface3','MaskIceLevelset3','StrainRateparallel3','StrainRateperpendicular3','CalvingCalvingrate3']
 field_tolerances=[1e-11,1e-11,1e-11,1e-11,1e-11,1e-11,1e-11,1e-11,1e-11,1e-11,\
 		2e-11,2e-11,2e-11,1e-11,1e-11,1e-11,1e-11,1e-11,1e-11,1e-11,\
-		2e-11,2e-11,2e-11,1e-11,1e-11,1e-11,1e-11,1e-11,1e-11,1e-11]
+		2e-11,2e-11,2e-11,1e-11,1e-11,1e-11,1e-11,5e-11,5e-11,1e-11]
 field_values=[\
 	md.results.TransientSolution[0].Vx,\
 	md.results.TransientSolution[0].Vy,\

Modified: issm/trunk/test/NightlyRun/test807.m
===================================================================
--- issm/trunk/test/NightlyRun/test807.m	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/NightlyRun/test807.m	2016-04-13 04:32:01 UTC (rev 20500)
@@ -17,15 +17,16 @@
 
 %Transient
 md.transient.isstressbalance=1;
-md.transient.islevelset=1;
 md.transient.ismasstransport=1;
+md.transient.issmb=1;
 md.transient.isthermal=0;
 md.transient.isgroundingline=0;
 md.transient.isgia=0;
-md.transient.iscalving=1;
+md.transient.ismovingfront=1;
 
 md.calving.calvingrate=zeros(md.mesh.numberofvertices,1);
 md.calving.meltingrate=10000*ones(md.mesh.numberofvertices,1);
+md.levelset.spclevelset=NaN(md.mesh.numberofvertices,1);
 
 md=solve(md,TransientSolutionEnum());
 
@@ -34,8 +35,8 @@
 		'Vx2','Vy2','Vel2','Pressure2','Thickness2','Surface2','MaskIceLevelset2'...
 		'Vx3','Vy3','Vel3','Pressure3','Thickness3','Surface3','MaskIceLevelset3'};
 field_tolerances={1e-11,1e-11,1e-11,1e-11,1e-11,1e-11,1e-11,...
-		2e-11,2e-11,2e-11,1e-11,1e-11,1e-11,1e-11,...
-		2e-11,2e-11,2e-11,1e-11,1e-11,1e-11,1e-11};
+		2e-11,2e-11,2e-11,1e-11,1e-11,1e-11,5e-11,...
+		2e-11,2e-11,2e-11,1e-11,1e-11,1e-11,5e-11};
 field_values={...
 	md.results.TransientSolution(1).Vx,...
 	md.results.TransientSolution(1).Vy,...

Modified: issm/trunk/test/NightlyRun/test807.py
===================================================================
--- issm/trunk/test/NightlyRun/test807.py	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/NightlyRun/test807.py	2016-04-13 04:32:01 UTC (rev 20500)
@@ -26,19 +26,18 @@
 md.timestepping.time_step=10
 md.timestepping.final_time=30
 
-
-
 #Transient
 md.transient.isstressbalance=True
-md.transient.islevelset=True
 md.transient.ismasstransport=True
+md.transient.issmb=True
 md.transient.isthermal=False
 md.transient.isgroundingline=False
 md.transient.isgia=False
-md.transient.iscalving=True;
+md.transient.ismovingfront=True;
 
 md.calving.calvingrate=numpy.zeros((md.mesh.numberofvertices,1))
 md.calving.meltingrate=10000*numpy.ones((md.mesh.numberofvertices,1))
+md.levelset.spclevelset=numpy.float('NaN')*numpy.ones((md.mesh.numberofvertices,1))
 
 md=solve(md,TransientSolutionEnum())
 
@@ -47,8 +46,8 @@
 		'Vx2','Vy2','Vel2','Pressure2','Thickness2','Surface2','MaskIceLevelset2',\
 		'Vx3','Vy3','Vel3','Pressure3','Thickness3','Surface3','MaskIceLevelset3']
 field_tolerances=[1e-11,1e-11,1e-11,1e-11,1e-11,1e-11,1e-11,\
-		2e-11,2e-11,2e-11,1e-11,1e-11,1e-11,1e-11,\
-		2e-11,2e-11,2e-11,1e-11,1e-11,1e-11,1e-11]
+		2e-11,2e-11,2e-11,1e-11,1e-11,1e-11,5e-11,\
+		2e-11,2e-11,2e-11,1e-11,1e-11,1e-11,5e-11]
 field_values=[\
 	md.results.TransientSolution[0].Vx,\
 	md.results.TransientSolution[0].Vy,\

Modified: issm/trunk/test/Par/79North.par
===================================================================
--- issm/trunk/test/Par/79North.par	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/Par/79North.par	2016-04-13 04:32:01 UTC (rev 20500)
@@ -30,7 +30,7 @@
 md.basalforcings.floatingice_melting_rate=zeros(md.mesh.numberofvertices,1);
 md.basalforcings.floatingice_melting_rate(find(md.mask.groundedice_levelset<0.))=0.;
 md.basalforcings.groundedice_melting_rate=zeros(md.mesh.numberofvertices,1);
-md.surfaceforcings.mass_balance=15.*ones(md.mesh.numberofvertices,1);
+md.smb.mass_balance=15.*ones(md.mesh.numberofvertices,1);
 
 %Numerical parameters
 md.stressbalance.viscosity_overshoot=0.3;

Modified: issm/trunk/test/Par/79North.py
===================================================================
--- issm/trunk/test/Par/79North.py	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/Par/79North.py	2016-04-13 04:32:01 UTC (rev 20500)
@@ -42,7 +42,7 @@
 md.basalforcings.floatingice_melting_rate=numpy.zeros((md.mesh.numberofvertices,1))
 md.basalforcings.floatingice_melting_rate[numpy.nonzero(md.mask.groundedice_levelset<0.)[0]]=0.
 md.basalforcings.groundedice_melting_rate=numpy.zeros((md.mesh.numberofvertices,1))
-md.surfaceforcings.mass_balance=15*numpy.ones((md.mesh.numberofvertices,1))
+md.smb.mass_balance=15*numpy.ones((md.mesh.numberofvertices,1))
 
 #Numerical parameters
 md.stressbalance.viscosity_overshoot=0.3

Modified: issm/trunk/test/Par/RoundSheetEISMINT.par
===================================================================
--- issm/trunk/test/Par/RoundSheetEISMINT.par	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/Par/RoundSheetEISMINT.par	2016-04-13 04:32:01 UTC (rev 20500)
@@ -24,7 +24,7 @@
 smb_max=0.5; %m/yr
 sb=10^-2/1000.; %m/yr/m
 rel=450.*1000.; %m
-md.surfaceforcings.mass_balance=min(smb_max,sb*(rel-radius));
+md.smb.mass_balance=min(smb_max,sb*(rel-radius));
 
 disp('      creating velocities');
 constant=0.3;

Modified: issm/trunk/test/Par/RoundSheetEISMINT.py
===================================================================
--- issm/trunk/test/Par/RoundSheetEISMINT.py	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/Par/RoundSheetEISMINT.py	2016-04-13 04:32:01 UTC (rev 20500)
@@ -27,7 +27,7 @@
 smb_max=0.5    #m/yr
 sb=10**-2/1000.    #m/yr/m
 rel=450.*1000.    #m
-md.surfaceforcings.mass_balance=numpy.minimum(smb_max*numpy.ones_like(radius),sb*(rel-radius))
+md.smb.mass_balance=numpy.minimum(smb_max*numpy.ones_like(radius),sb*(rel-radius))
 
 print "      creating velocities"
 constant=0.3

Modified: issm/trunk/test/Par/RoundSheetShelf.par
===================================================================
--- issm/trunk/test/Par/RoundSheetShelf.par	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/Par/RoundSheetShelf.par	2016-04-13 04:32:01 UTC (rev 20500)
@@ -61,7 +61,7 @@
 md.materials.rheology_n=3.*ones(md.mesh.numberofelements,1);
 
 %Surface mass balance and basal melting
-md.surfaceforcings.mass_balance=-10.*ones(md.mesh.numberofvertices,1);
+md.smb.mass_balance=-10.*ones(md.mesh.numberofvertices,1);
 md.basalforcings.groundedice_melting_rate=zeros(md.mesh.numberofvertices,1);
 pos=find(md.mask.groundedice_levelset>0.);md.basalforcings.groundedice_melting_rate(pos)=10.;
 md.basalforcings.floatingice_melting_rate=zeros(md.mesh.numberofvertices,1);

Modified: issm/trunk/test/Par/RoundSheetShelf.py
===================================================================
--- issm/trunk/test/Par/RoundSheetShelf.py	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/Par/RoundSheetShelf.py	2016-04-13 04:32:01 UTC (rev 20500)
@@ -68,7 +68,7 @@
 md.materials.rheology_n=3.*numpy.ones((md.mesh.numberofelements,1))
 
 #Surface mass balance and basal melting
-md.surfaceforcings.mass_balance=-10.*numpy.ones((md.mesh.numberofvertices,1))
+md.smb.mass_balance=-10.*numpy.ones((md.mesh.numberofvertices,1))
 md.basalforcings.groundedice_melting_rate=numpy.zeros((md.mesh.numberofvertices,1))
 pos=numpy.nonzero(md.mask.groundedice_levelset>0.)[0]
 md.basalforcings.groundedice_melting_rate[pos]=10.

Modified: issm/trunk/test/Par/RoundSheetStaticEISMINT.par
===================================================================
--- issm/trunk/test/Par/RoundSheetStaticEISMINT.par	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/Par/RoundSheetStaticEISMINT.par	2016-04-13 04:32:01 UTC (rev 20500)
@@ -28,7 +28,7 @@
 smb_max=0.5; %m/yr
 sb=10^-2/1000.; %m/yr/m
 rel=450.*1000.; %m
-md.surfaceforcings.mass_balance=min(smb_max,sb*(rel-radius));
+md.smb.mass_balance=min(smb_max,sb*(rel-radius));
 
 disp('      creating velocities');
 constant=0.3;

Modified: issm/trunk/test/Par/RoundSheetStaticEISMINT.py
===================================================================
--- issm/trunk/test/Par/RoundSheetStaticEISMINT.py	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/Par/RoundSheetStaticEISMINT.py	2016-04-13 04:32:01 UTC (rev 20500)
@@ -31,7 +31,7 @@
 smb_max=0.5    #m/yr
 sb=10**-2/1000.    #m/yr/m
 rel=450.*1000.    #m
-md.surfaceforcings.mass_balance=numpy.minimum(smb_max*numpy.ones_like(radius),sb*(rel-radius))
+md.smb.mass_balance=numpy.minimum(smb_max*numpy.ones_like(radius),sb*(rel-radius))
 
 print "      creating velocities"
 constant=0.3

Modified: issm/trunk/test/Par/SquareEISMINT.par
===================================================================
--- issm/trunk/test/Par/SquareEISMINT.par	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/Par/SquareEISMINT.par	2016-04-13 04:32:01 UTC (rev 20500)
@@ -26,7 +26,7 @@
 md.materials.rheology_n=3.*ones(md.mesh.numberofelements,1);
 
 disp('      creating surface mass balance');
-md.surfaceforcings.mass_balance=0.2*ones(md.mesh.numberofvertices,1); %0m/a
+md.smb.mass_balance=0.2*ones(md.mesh.numberofvertices,1); %0m/a
 md.basalforcings.floatingice_melting_rate=0.*ones(md.mesh.numberofvertices,1); %0m/a
 md.basalforcings.groundedice_melting_rate=0.*ones(md.mesh.numberofvertices,1); %0m/a
 

Modified: issm/trunk/test/Par/SquareEISMINT.py
===================================================================
--- issm/trunk/test/Par/SquareEISMINT.py	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/Par/SquareEISMINT.py	2016-04-13 04:32:01 UTC (rev 20500)
@@ -29,7 +29,7 @@
 md.materials.rheology_n=3.*numpy.ones((md.mesh.numberofelements,1))
 
 print "      creating surface mass balance"
-md.surfaceforcings.mass_balance=0.2*numpy.ones((md.mesh.numberofvertices,1))    #0m/a
+md.smb.mass_balance=0.2*numpy.ones((md.mesh.numberofvertices,1))    #0m/a
 md.basalforcings.floatingice_melting_rate=0.*numpy.ones((md.mesh.numberofvertices,1))    #0m/a
 md.basalforcings.groundedice_melting_rate=0.*numpy.ones((md.mesh.numberofvertices,1))    #0m/a
 

Modified: issm/trunk/test/Par/SquareSheetConstrained.par
===================================================================
--- issm/trunk/test/Par/SquareSheetConstrained.par	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/Par/SquareSheetConstrained.par	2016-04-13 04:32:01 UTC (rev 20500)
@@ -31,6 +31,7 @@
 
 %Calving
 md.calving.calvingrate=zeros(md.mesh.numberofvertices,1);
+md.levelset.spclevelset=NaN(md.mesh.numberofvertices,1);
 
 %Friction
 md.friction.coefficient=20.*ones(md.mesh.numberofvertices,1);

Modified: issm/trunk/test/Par/SquareSheetConstrained.py
===================================================================
--- issm/trunk/test/Par/SquareSheetConstrained.py	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/Par/SquareSheetConstrained.py	2016-04-13 04:32:01 UTC (rev 20500)
@@ -41,6 +41,7 @@
 
 #Calving
 md.calving.calvingrate=0.*numpy.ones((md.mesh.numberofvertices,1))
+md.levelset.spclevelset=float('NaN')*numpy.ones((md.mesh.numberofvertices,1))
 
 #Friction
 md.friction.coefficient=20.*numpy.ones((md.mesh.numberofvertices,1))

Modified: issm/trunk/test/Par/SquareSheetShelf.par
===================================================================
--- issm/trunk/test/Par/SquareSheetShelf.par	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/Par/SquareSheetShelf.par	2016-04-13 04:32:01 UTC (rev 20500)
@@ -32,7 +32,7 @@
 md.materials.rheology_n=3.*ones(md.mesh.numberofelements,1);
 
 %Accumulation and melting
-md.surfaceforcings.mass_balance=10.*ones(md.mesh.numberofvertices,1);
+md.smb.mass_balance=10.*ones(md.mesh.numberofvertices,1);
 md.basalforcings.groundedice_melting_rate=5.*ones(md.mesh.numberofvertices,1);
 md.basalforcings.floatingice_melting_rate=5.*ones(md.mesh.numberofvertices,1);
 

Modified: issm/trunk/test/Par/SquareSheetShelf.py
===================================================================
--- issm/trunk/test/Par/SquareSheetShelf.py	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/Par/SquareSheetShelf.py	2016-04-13 04:32:01 UTC (rev 20500)
@@ -43,7 +43,7 @@
 md.materials.rheology_n=3.*numpy.ones((md.mesh.numberofelements,1))
 
 #Accumulation and melting
-md.surfaceforcings.mass_balance=10.*numpy.ones((md.mesh.numberofvertices,1))
+md.smb.mass_balance=10.*numpy.ones((md.mesh.numberofvertices,1))
 md.basalforcings.groundedice_melting_rate=5.*numpy.ones((md.mesh.numberofvertices,1))
 md.basalforcings.floatingice_melting_rate=5.*numpy.ones((md.mesh.numberofvertices,1))
 

Modified: issm/trunk/test/Par/SquareShelfConstrained.par
===================================================================
--- issm/trunk/test/Par/SquareShelfConstrained.par	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/Par/SquareShelfConstrained.par	2016-04-13 04:32:01 UTC (rev 20500)
@@ -10,13 +10,14 @@
 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     = transpose(ncread('../Data/SquareShelfConstrained.nc','x'));
-y     = transpose(ncread('../Data/SquareShelfConstrained.nc','y'));
-vx    = transpose(ncread('../Data/SquareShelfConstrained.nc','vx'));
-vy    = transpose(ncread('../Data/SquareShelfConstrained.nc','vy'));
-index = transpose(ncread('../Data/SquareShelfConstrained.nc','index'));
+x     = transpose(ncread([issmdir() '/test/Data/SquareShelfConstrained.nc'],'x'));
+y     = transpose(ncread([issmdir() '/test/Data/SquareShelfConstrained.nc'],'y'));
+vx    = transpose(ncread([issmdir() '/test/Data/SquareShelfConstrained.nc'],'vx'));
+vy    = transpose(ncread([issmdir() '/test/Data/SquareShelfConstrained.nc'],'vy'));
+index = transpose(ncread([issmdir() '/test/Data/SquareShelfConstrained.nc'],'index'));
 md.initialization.vx=InterpFromMeshToMesh2d(index,x,y,vx,md.mesh.x,md.mesh.y);
 md.initialization.vy=InterpFromMeshToMesh2d(index,x,y,vy,md.mesh.x,md.mesh.y);
 clear vx vy x y index;
@@ -29,7 +30,7 @@
 md.materials.rheology_n=3*ones(md.mesh.numberofelements,1);
 
 %Surface mass balance and basal melting
-md.surfaceforcings.mass_balance=10*ones(md.mesh.numberofvertices,1);
+md.smb.mass_balance=10*ones(md.mesh.numberofvertices,1);
 md.basalforcings.floatingice_melting_rate=5*ones(md.mesh.numberofvertices,1);
 md.basalforcings.groundedice_melting_rate=5*ones(md.mesh.numberofvertices,1);
 

Modified: issm/trunk/test/Par/SquareShelfConstrained.py
===================================================================
--- issm/trunk/test/Par/SquareShelfConstrained.py	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/Par/SquareShelfConstrained.py	2016-04-13 04:32:01 UTC (rev 20500)
@@ -40,7 +40,7 @@
 md.materials.rheology_n=3.*numpy.ones((md.mesh.numberofelements,1))
 
 #Surface mass balance and basal melting
-md.surfaceforcings.mass_balance=10.*numpy.ones((md.mesh.numberofvertices,1))
+md.smb.mass_balance=10.*numpy.ones((md.mesh.numberofvertices,1))
 md.basalforcings.groundedice_melting_rate=5.*numpy.ones((md.mesh.numberofvertices,1))
 md.basalforcings.floatingice_melting_rate=5.*numpy.ones((md.mesh.numberofvertices,1))
 

Modified: issm/trunk/test/Par/SquareThermal.par
===================================================================
--- issm/trunk/test/Par/SquareThermal.par	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/Par/SquareThermal.par	2016-04-13 04:32:01 UTC (rev 20500)
@@ -30,7 +30,7 @@
 md.materials.rheology_n=3.*ones(md.mesh.numberofelements,1);
 
 disp('      creating surface mass balance');
-md.surfaceforcings.mass_balance=ones(md.mesh.numberofvertices,1)/md.constants.yts; %1m/a
+md.smb.mass_balance=ones(md.mesh.numberofvertices,1)/md.constants.yts; %1m/a
 md.basalforcings.groundedice_melting_rate=0.*ones(md.mesh.numberofvertices,1)/md.constants.yts; %1m/a
 md.basalforcings.floatingice_melting_rate=0.*ones(md.mesh.numberofvertices,1)/md.constants.yts; %1m/a
 

Modified: issm/trunk/test/Par/SquareThermal.py
===================================================================
--- issm/trunk/test/Par/SquareThermal.py	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/Par/SquareThermal.py	2016-04-13 04:32:01 UTC (rev 20500)
@@ -31,7 +31,7 @@
 md.materials.rheology_n=3.*numpy.ones((md.mesh.numberofelements,1))
 
 print "      creating surface mass balance"
-md.surfaceforcings.mass_balance=numpy.ones((md.mesh.numberofvertices,1))/md.constants.yts    #1m/a
+md.smb.mass_balance=numpy.ones((md.mesh.numberofvertices,1))/md.constants.yts    #1m/a
 md.basalforcings.melting_rate=0.*numpy.ones((md.mesh.numberofvertices,1))/md.constants.yts    #1m/a
 
 #Deal with boundary conditions:

Modified: issm/trunk/test/Par/ValleyGlacierShelf.par
===================================================================
--- issm/trunk/test/Par/ValleyGlacierShelf.par	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/Par/ValleyGlacierShelf.par	2016-04-13 04:32:01 UTC (rev 20500)
@@ -48,9 +48,9 @@
 md.groundingline.migration = 'SubelementMigration';
 
 %Surface mass balance and basal melting
-md.surfaceforcings.mass_balance = 0.3*ones(md.mesh.numberofvertices,1);
-md.basalforcings.floatingice_melting_rate = md.surfaceforcings.mass_balance;
-md.basalforcings.groundedice_melting_rate = md.surfaceforcings.mass_balance;
+md.smb.mass_balance = 0.3*ones(md.mesh.numberofvertices,1);
+md.basalforcings.floatingice_melting_rate = md.smb.mass_balance;
+md.basalforcings.groundedice_melting_rate = md.smb.mass_balance;
 
 %Friction
 md.friction.coefficient = 20.*ones(md.mesh.numberofvertices,1);
@@ -60,7 +60,7 @@
 
 %Transient
 md.transient.isstressbalance = 1;
-md.transient.islevelset = 1;
+md.transient.ismovingfront = 1;
 md.transient.ismasstransport = 0;
 md.transient.isthermal = 0;
 md.transient.isgroundingline = 1;
@@ -76,6 +76,7 @@
 %Masstransport;
 md.calving.calvingrate = 0.*ones(md.mesh.numberofvertices,1);
 md.calving.meltingrate = 0.*ones(md.mesh.numberofvertices,1);
+md.levelset.spclevelset=NaN(md.mesh.numberofvertices,1);
 md.masstransport.stabilization = 1.;
 
 %Numerical parameters

Modified: issm/trunk/test/Par/ValleyGlacierShelf.py
===================================================================
--- issm/trunk/test/Par/ValleyGlacierShelf.py	2016-04-13 04:11:30 UTC (rev 20499)
+++ issm/trunk/test/Par/ValleyGlacierShelf.py	2016-04-13 04:32:01 UTC (rev 20500)
@@ -55,9 +55,9 @@
 md.groundingline.migration='SubelementMigration'
 
 #Surface mass balance and basal melting
-md.surfaceforcings.mass_balance=0.3*numpy.ones((md.mesh.numberofvertices,1))
-md.basalforcings.groundedice_melting_rate=md.surfaceforcings.mass_balance
-md.basalforcings.floatingice_melting_rate=md.surfaceforcings.mass_balance
+md.smb.mass_balance=0.3*numpy.ones((md.mesh.numberofvertices,1))
+md.basalforcings.groundedice_melting_rate=md.smb.mass_balance
+md.basalforcings.floatingice_melting_rate=md.smb.mass_balance
 
 #Friction
 md.friction.coefficient=20.*numpy.ones((md.mesh.numberofvertices,1))
@@ -67,7 +67,7 @@
 
 #Transient
 md.transient.isstressbalance=True
-md.transient.islevelset=True
+md.transient.ismovingfront=True
 md.transient.ismasstransport=False
 md.transient.isthermal=False
 md.transient.isgroundingline=True
@@ -83,6 +83,7 @@
 #Masstransport
 md.calving.calvingrate=0.*numpy.ones((md.mesh.numberofvertices,1))
 md.calving.meltingrate=0.*numpy.ones((md.mesh.numberofvertices,1))
+md.levelset.spclevelset=float('NaN')*numpy.ones((md.mesh.numberofvertices,1))
 md.masstransport.stabilization=1.
 
 #Numerical parameters



More information about the issm-svn mailing list