mirror of
https://github.com/wassname/simpeg.git
synced 2026-08-16 11:28:21 +08:00
Fields calculation in Richards. Calculation of the diagonals of the Jacobian.
This commit is contained in:
+13
-10
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user