/[escript]/branches/windows_from_1456_trunk_1522_merged_in/escript/py_src/pdetools.py
ViewVC logotype

Diff of /branches/windows_from_1456_trunk_1522_merged_in/escript/py_src/pdetools.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1544 by phornby, Tue Apr 22 06:15:31 2008 UTC revision 1545 by phornby, Thu May 1 07:08:20 2008 UTC
# Line 474  class IterationHistory(object): Line 474  class IterationHistory(object):
474    
475         """         """
476         self.history.append(norm_r)         self.history.append(norm_r)
477         if self.verbose: print "iter: #s:  inner(rhat,r) = #e"#(len(self.history)-1, self.history[-1])         if self.verbose: print "iter: %s:  inner(rhat,r) = %e"%(len(self.history)-1, self.history[-1])
478         return self.history[-1]<=self.tolerance * self.history[0]         return self.history[-1]<=self.tolerance * self.history[0]
479    
480     def stoppingcriterium2(self,norm_r,norm_b,solver="GMRES",TOL=None):     def stoppingcriterium2(self,norm_r,norm_b,solver="GMRES",TOL=None):
# Line 493  class IterationHistory(object): Line 493  class IterationHistory(object):
493         if TOL==None:         if TOL==None:
494            TOL=self.tolerance            TOL=self.tolerance
495         self.history.append(norm_r)         self.history.append(norm_r)
496         if self.verbose: print "iter: #s:  norm(r) = #e"#(len(self.history)-1, self.history[-1])         if self.verbose: print "iter: %s:  norm(r) = %e"%(len(self.history)-1, self.history[-1])
497         return self.history[-1]<=TOL * norm_b         return self.history[-1]<=TOL * norm_b
498    
499  def PCG(b, Aprod, Msolve, bilinearform, stoppingcriterium, x=None, iter_max=100):  def PCG(b, Aprod, Msolve, bilinearform, stoppingcriterium, x=None, iter_max=100):
# Line 1483  class SaddlePointProblem(object): Line 1483  class SaddlePointProblem(object):
1483         @param text: a text message         @param text: a text message
1484         @type text: C{str}         @type text: C{str}
1485         """         """
1486         if self.__verbose: print "#s: #s"%(str(self),text)         if self.__verbose: print "%s: %s"%(str(self),text)
1487    
1488     def solve_f(self,u,p,tol=1.e-8):     def solve_f(self,u,p,tol=1.e-8):
1489         """         """
# Line 1633  class SaddlePointProblem(object): Line 1633  class SaddlePointProblem(object):
1633              norm_u_new = util.Lsup(u_new)              norm_u_new = util.Lsup(u_new)
1634              p_new=p+self.relaxation*g_new              p_new=p+self.relaxation*g_new
1635              norm_p_new = util.sqrt(self.inner(p_new,p_new))              norm_p_new = util.sqrt(self.inner(p_new,p_new))
             self.trace("%s th step: f = %s, f/u = %s, g = %s, g/p = %s, relaxation = %s."%(self.iter, norm_f_new ,norm_f_new/norm_u_new, norm_g_new, norm_g_new/norm_p_new, self.relaxation))  
1636    
1637                self.trace("step %d: f = %e, f/u = %e, g = %e, g/p = %e, relaxation = %e."%(self.iter, norm_f_new ,norm_f_new/norm_u_new, norm_g_new, norm_g_new/norm_p_new, self.relaxation))
1638              if self.iter>1:              if self.iter>1:
1639                 dg2=g_new-g                 dg2=g_new-g
1640                 df2=f_new-f                 df2=f_new-f

Legend:
Removed from v.1544  
changed lines
  Added in v.1545

  ViewVC Help
Powered by ViewVC 1.1.26