Fields calculation in Richards. Calculation of the diagonals of the Jacobian.

This commit is contained in:
Rowan Cockett
2013-11-14 15:29:25 -08:00
parent a5032e07b1
commit 61e175cd12
4 changed files with 128 additions and 31 deletions
+13 -10
View File
@@ -663,12 +663,13 @@ class NewtonRoot(object):
"""
tol = 1.000e-06;
solveTol = 0; # Default direct solve.
maxIter = 20;
stepDcr = 0.5;
maxLS = 30;
comments = False;
tol = 1.000e-06
solveTol = 0 # Default direct solve.
maxIter = 20
stepDcr = 0.5
maxLS = 30
comments = False
doLS = True
def __init__(self, **kwargs):
setKwargs(self, **kwargs)
@@ -688,14 +689,14 @@ class NewtonRoot(object):
# M = @(x) tril(J)\(diag(J).*(triu(J)\x));
# [dh, ~] = bicgstab(J,-r,O.solveTol,500,M);
muLS = 1
muLS = 1.
LScnt = 1
xt = x + dh
rt, Jt = fun(xt) # TODO: get rid of Jt
if self.comments: print '\tLinesearch:\n'
# Enter Linesearch
while True:
xt = x + muLS*dh
rt, Jt = fun(xt) # TODO: get rid of Jt
while True and self.doLS:
if self.comments:
print '\t\tResid: %e\n'%norm(rt)
if norm(rt) <= norm(r) or norm(rt) < self.tol:
@@ -708,6 +709,8 @@ class NewtonRoot(object):
print 'Newton Method: Line search break.'
root = NaN
return
xt = x + muLS*dh
rt, Jt = fun(xt) # TODO: get rid of Jt
x = xt
self._iter += 1