# [cig-commits] r15652 - short/3D/PyLith/branches/pylith-friction/playpen/friction

brad at geodynamics.org brad at geodynamics.org
Fri Sep 4 15:50:13 PDT 2009

```Author: brad
Date: 2009-09-04 15:50:12 -0700 (Fri, 04 Sep 2009)
New Revision: 15652

Modified:
short/3D/PyLith/branches/pylith-friction/playpen/friction/spring_example.py
Log:
Begin adjusting example to work like code.

Modified: short/3D/PyLith/branches/pylith-friction/playpen/friction/spring_example.py
===================================================================
--- short/3D/PyLith/branches/pylith-friction/playpen/friction/spring_example.py	2009-09-04 22:07:56 UTC (rev 15651)
+++ short/3D/PyLith/branches/pylith-friction/playpen/friction/spring_example.py	2009-09-04 22:50:12 UTC (rev 15652)
@@ -54,12 +54,13 @@
Ai = numpy.linalg.inv(A)

# ----------------------------------------------------------------------
-def reformResidual(disp):
+def reformResidual(disp, incr):
"""
Calculate residual
"""
-    residual = b - numpy.dot(A, disp)
-    residual[4] += k[4]*u5
+    calcFriction(disp, incr) # FaultCohesiveDyn::integrateResidual()
+    residual = b - numpy.dot(A, disp+incr)
+    residual[4] += k[4]*u5 # Dirichlet BC
return residual

@@ -89,8 +90,8 @@
print "Interation: %d" % iter
dincr = numpy.dot(Ai, residual) # Increment to disp increment.
incr += dincr
-        calcFriction(disp, incr)
-        residual = reformResidual(disp+incr)
+        #calcFriction(disp, incr)
+        residual = reformResidual(disp, incr)
print "Disp(t):",disp
print "Incr(t):",incr
print "b:",b
@@ -102,7 +103,7 @@
# ----------------------------------------------------------------------
# main
incr = 0*disp
-residual = reformResidual(disp + incr)
+residual = reformResidual(disp, incr)
solve(incr, A, residual, disp)
disp += incr
print "Solution:",disp

```

More information about the CIG-COMMITS mailing list