Index: /issm/trunk-jpl/src/jl/solve/analyses.jl
===================================================================
--- /issm/trunk-jpl/src/jl/solve/analyses.jl	(revision 26651)
+++ /issm/trunk-jpl/src/jl/solve/analyses.jl	(revision 26652)
@@ -80,5 +80,28 @@
 
 end#}}}
+function InputUpdateFromSolution(analysis::StressbalanceAnalysis,ug::Vector{Float64},element::Tria) #{{{
 
+	#Get dofs for this finite element
+	doflist = GetDofList(element,GsetEnum)
+
+	#Get solution vector for this element
+	numdof   = 3*2
+	values = Vector{Float64}(undef,numdof)
+	for i in 1:numdof values[i]=ug[doflist[i]] end
+
+	#Now split solution vector into x and y components
+	numnodes = 3
+	vx= Vector{Float64}(undef,numnodes)
+	vy= Vector{Float64}(undef,numnodes)
+	for i in 1:numnodes 
+		vx[i]=values[2*i-1] 
+		vy[i]=values[2*i] 
+		@assert isfinite(vx[i])
+		@assert isfinite(vy[i])
+	end
+
+	AddInput(element,VxEnum,vx,P1Enum)
+	AddInput(element,VyEnum,vy,P1Enum)
+end#}}}
 function Core(analysis::StressbalanceAnalysis,femmodel::FemModel)# {{{
 
@@ -95,29 +118,2 @@
 
 
-function solutionsequence_nonlinear(femmodel::FemModel,analysis::Analysis,maxiter::Int64,restol::Float64,reltol::Float64,abstol::Float64) # {{{
-
-	#Initialize number of iterations
-	count = 0
-	converged = false
-
-	#Get existing solution
-	ug = GetSolutionFromInputsx(analysis,femmodel)
-
-	print(ug)
-
-	#Loop until we reach convergence
-	while(~converged)
-
-		error("not implemented yet")
-
-		#Increase count
-		count += 1
-		if(count>maxiter)
-			println("   maximum number of nonlinear iterations (",maxiter,") exceeded")
-			converged = true
-		end
-	end
-
-	error("STOP")
-
-end# }}}
Index: /issm/trunk-jpl/src/jl/solve/elements.jl
===================================================================
--- /issm/trunk-jpl/src/jl/solve/elements.jl	(revision 26651)
+++ /issm/trunk-jpl/src/jl/solve/elements.jl	(revision 26652)
@@ -21,4 +21,12 @@
 	else
 		error("size ",size(data,1)," not supported yet");
+	end
+end #}}}
+function AddInput(element::Tria,inputenum::IssmEnum,data::Vector{Float64},interpolation::IssmEnum) #{{{
+	if interpolation==P1Enum
+		@assert length(data)==3
+		SetTriaInput(element.inputs,inputenum,P1Enum,element.vertexids,data)
+	else
+		error("interpolation ", interpolation, " not supported yet");
 	end
 end #}}}
Index: /issm/trunk-jpl/src/jl/solve/modules.jl
===================================================================
--- /issm/trunk-jpl/src/jl/solve/modules.jl	(revision 26651)
+++ /issm/trunk-jpl/src/jl/solve/modules.jl	(revision 26652)
@@ -134,2 +134,28 @@
 
 end#}}}
+function InputUpdateFromSolutionx(analysis::Analysis,ug::Vector{Float64},femmodel::FemModel) #{{{
+
+	#Go through elements and plug in solution
+	for i=1:length(femmodel.elements)
+		InputUpdateFromSolution(analysis,ug,femmodel.elements[i])
+	end
+
+	return ug
+
+end#}}}
+function Reducevectorgtofx(ug::Vector{Float64},nodes::Vector{Node}) #{{{
+
+	#Get size of output vector
+	fsize = NumberOfDofs(nodes,FsetEnum)
+
+	#Initialize output vector
+	uf = Vector{Float64}(undef,fsize)
+
+	#Go through elements and plug in solution
+	for i=1:length(nodes)
+		VecReduce(nodes[i],ug,uf)
+	end
+
+	return ug
+
+end#}}}
Index: /issm/trunk-jpl/src/jl/solve/nodes.jl
===================================================================
--- /issm/trunk-jpl/src/jl/solve/nodes.jl	(revision 26651)
+++ /issm/trunk-jpl/src/jl/solve/nodes.jl	(revision 26652)
@@ -114,4 +114,13 @@
 
 end# }}}
+function VecReduce(node::Node,ug::Vector{Float64},uf::Vector{Float64}) #{{{
+
+	for i=1:node.gsize
+		if node.fdoflist[i]!=-1
+			uf[node.fdoflist[i]] = ug[node.gdoflist[i]]
+		end
+	end
+
+end# }}}
 
 #Nodes functions
Index: /issm/trunk-jpl/src/jl/solve/solutionsequences.jl
===================================================================
--- /issm/trunk-jpl/src/jl/solve/solutionsequences.jl	(revision 26652)
+++ /issm/trunk-jpl/src/jl/solve/solutionsequences.jl	(revision 26652)
@@ -0,0 +1,29 @@
+function solutionsequence_nonlinear(femmodel::FemModel,analysis::Analysis,maxiter::Int64,restol::Float64,reltol::Float64,abstol::Float64) # {{{
+
+	#Initialize number of iterations
+	count = 0
+	converged = false
+
+	#Get existing solution
+	ug = GetSolutionFromInputsx(analysis,femmodel)
+	uf = Reducevectorgtofx(ug,femmodel.nodes)
+
+	#Update once again the solution to make sure that vx and vxold are similar (for next step in transient or steadystate)
+	InputUpdateFromSolutionx(analysis,ug,femmodel)
+
+	#Loop until we reach convergence
+	while(~converged)
+
+		error("not implemented yet")
+
+		#Increase count
+		count += 1
+		if(count>maxiter)
+			println("   maximum number of nonlinear iterations (",maxiter,") exceeded")
+			converged = true
+		end
+	end
+
+	error("STOP")
+
+end# }}}
Index: /issm/trunk-jpl/src/jl/solve/solve.jl
===================================================================
--- /issm/trunk-jpl/src/jl/solve/solve.jl	(revision 26651)
+++ /issm/trunk-jpl/src/jl/solve/solve.jl	(revision 26652)
@@ -10,4 +10,5 @@
 include("./femmodel.jl")
 include("./analyses.jl")
+include("./solutionsequences.jl")
 include("./modules.jl")
 
