# Diff of /trunk/escript/py_src/flows.py

revision 1516 by artak, Wed Apr 9 00:45:47 2008 UTC revision 1517 by artak, Fri Apr 18 02:36:37 2008 UTC
# Line 63  class StokesProblemCartesian(Homogeneous Line 63  class StokesProblemCartesian(Homogeneous
63           self.vol=util.integrate(1.,Function(self.domain))           self.vol=util.integrate(1.,Function(self.domain))
64           self.__pde_u=LinearPDE(domain,numEquations=self.domain.getDim(),numSolutions=self.domain.getDim())           self.__pde_u=LinearPDE(domain,numEquations=self.domain.getDim(),numSolutions=self.domain.getDim())
65           self.__pde_u.setSymmetryOn()           self.__pde_u.setSymmetryOn()
66           self.__pde_u.setSolverMethod(preconditioner=LinearPDE.ILU0)  #         self.__pde_u.setSolverMethod(preconditioner=LinearPDE.ILU0)
67
68           self.__pde_prec=LinearPDE(domain)           self.__pde_prec=LinearPDE(domain)
69           self.__pde_prec.setReducedOrderOn()           self.__pde_prec.setReducedOrderOn()
# Line 123  class StokesProblemCartesian(Homogeneous Line 123  class StokesProblemCartesian(Homogeneous
123                return True                return True
124            else:            else:
125                return False                return False
126        def stoppingcriterium_GMRES(self,norm_r,norm_b):        def stoppingcriterium2(self,norm_r,norm_b,solver='GMRES'):
127            if self.verbose: print "GMRES step %s: L2(r) = %s, L2(b)*TOL=%s"%(self.iter,norm_r,norm_b*self.getTolerance())        if self.verbose: print "%s step %s: L2(r) = %s, L2(b)*TOL=%s"%(solver,self.iter,norm_r,norm_b*self.getTolerance())
128            self.iter+=1            self.iter+=1
129            if norm_r <= norm_b*self.getTolerance():            if norm_r <= norm_b*self.getTolerance():
130                if self.verbose: print "GMRES terminated after %s steps."%self.iter                if self.verbose: print "%s terminated after %s steps."%(solver,self.iter)
131                return True                return True
132            else:            else:
133                return False                return False
134
135        def stoppingcriterium_MINRES(self,norm_r,norm_Ax):
if self.verbose: print "MINRES step %s: L2(r) = %s, L2(b)*TOL=%s"%(self.iter,norm_r,norm_Ax*self.getTolerance())
self.iter+=1
if norm_r <= norm_Ax*self.getTolerance():
if self.verbose: print "MINRES terminated after %s steps."%self.iter
return True
else:
return False

Legend:
 Removed from v.1516 changed lines Added in v.1517