/[escript]/trunk/escript/py_src/flows.py
ViewVC logotype

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

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

revision 2288 by gross, Tue Feb 24 06:11:48 2009 UTC revision 2351 by gross, Tue Mar 31 08:26:41 2009 UTC
# Line 16  http://www.uq.edu.au/esscc Line 16  http://www.uq.edu.au/esscc
16  Primary Business: Queensland, Australia"""  Primary Business: Queensland, Australia"""
17  __license__="""Licensed under the Open Software License version 3.0  __license__="""Licensed under the Open Software License version 3.0
18  http://www.opensource.org/licenses/osl-3.0.php"""  http://www.opensource.org/licenses/osl-3.0.php"""
19  __url__="http://www.uq.edu.au/esscc/escript-finley"  __url__="https://launchpad.net/escript-finley"
20    
21  """  """
22  Some models for flow  Some models for flow
# Line 48  class DarcyFlow(object): Line 48  class DarcyFlow(object):
48      @note: The problem is solved in a least squares formulation.      @note: The problem is solved in a least squares formulation.
49      """      """
50    
51      def __init__(self, domain,useReduced=False):      def __init__(self, domain, weight=None, useReduced=False):
52          """          """
53          initializes the Darcy flux problem          initializes the Darcy flux problem
54          @param domain: domain of the problem          @param domain: domain of the problem
55          @type domain: L{Domain}          @type domain: L{Domain}
56          """          """
57          self.domain=domain          self.domain=domain
58          self.__l=util.longestEdge(self.domain)**2          if weight == None:
59               self.__l=10.*util.longestEdge(self.domain)**2
60            else:
61               self.__l=weight
62          self.__pde_v=LinearPDESystem(domain)          self.__pde_v=LinearPDESystem(domain)
63          if useReduced: self.__pde_v.setReducedOrderOn()          if useReduced: self.__pde_v.setReducedOrderOn()
64          self.__pde_v.setSymmetryOn()          self.__pde_v.setSymmetryOn()
65          self.__pde_v.setValue(D=util.kronecker(domain), A=self.__l*util.outer(util.kronecker(domain),util.kronecker(domain)))          self.__pde_v.setValue(D=util.kronecker(domain), A=self.__l*util.outer(util.kronecker(domain),util.kronecker(domain)))
66            # self.__pde_v.setSolverMethod(preconditioner=self.__pde_v.ILU0)
67          self.__pde_p=LinearSinglePDE(domain)          self.__pde_p=LinearSinglePDE(domain)
68          self.__pde_p.setSymmetryOn()          self.__pde_p.setSymmetryOn()
69          if useReduced: self.__pde_p.setReducedOrderOn()          if useReduced: self.__pde_p.setReducedOrderOn()
# Line 327  class DarcyFlow(object): Line 331  class DarcyFlow(object):
331            if self.show_details: print "DarcyFlux: Applying operator"            if self.show_details: print "DarcyFlux: Applying operator"
332            Qdp=self.__Q(dp)            Qdp=self.__Q(dp)
333            self.__pde_v.setValue(Y=-Qdp,X=Data(), r=Data())            self.__pde_v.setValue(Y=-Qdp,X=Data(), r=Data())
334            du=self.__pde_v.getSolution(verbose=self.show_details)            du=self.__pde_v.getSolution(verbose=self.show_details, iter_max = 100000)
335            return Qdp+du            return Qdp+du
336      def __inner_GMRES(self,r,s):      def __inner_GMRES(self,r,s):
337           return util.integrate(util.inner(r,s))           return util.integrate(util.inner(r,s))
# Line 339  class DarcyFlow(object): Line 343  class DarcyFlow(object):
343            self.__pde_p.setTolerance(self.getSubProblemTolerance())            self.__pde_p.setTolerance(self.getSubProblemTolerance())
344            if self.show_details: print "DarcyFlux: Applying preconditioner"            if self.show_details: print "DarcyFlux: Applying preconditioner"
345            self.__pde_p.setValue(X=util.transposed_tensor_mult(self.__permeability,r), Y=Data(), r=Data())            self.__pde_p.setValue(X=util.transposed_tensor_mult(self.__permeability,r), Y=Data(), r=Data())
346            return self.__pde_p.getSolution(verbose=self.show_details)            return self.__pde_p.getSolution(verbose=self.show_details, iter_max = 100000)
347    
348      def getFlux(self,p=None, fixed_flux=Data(), show_details=False):      def getFlux(self,p=None, fixed_flux=Data(), show_details=False):
349          """          """
# Line 366  class DarcyFlow(object): Line 370  class DarcyFlow(object):
370             self.__pde_v.setValue(Y=g)             self.__pde_v.setValue(Y=g)
371          else:          else:
372             self.__pde_v.setValue(Y=g-self.__Q(p))             self.__pde_v.setValue(Y=g-self.__Q(p))
373          return self.__pde_v.getSolution(verbose=show_details)          return self.__pde_v.getSolution(verbose=show_details, iter_max=100000)
374    
375  class StokesProblemCartesian(HomogeneousSaddlePointProblem):  class StokesProblemCartesian(HomogeneousSaddlePointProblem):
376       """       """
# Line 401  class StokesProblemCartesian(Homogeneous Line 405  class StokesProblemCartesian(Homogeneous
405           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())
406           self.__pde_u.setSymmetryOn()           self.__pde_u.setSymmetryOn()
407           # self.__pde_u.setSolverMethod(self.__pde_u.DIRECT)           # self.__pde_u.setSolverMethod(self.__pde_u.DIRECT)
408           # self.__pde_u.setSolverMethod(preconditioner=LinearPDE.RILU)           # self.__pde_u.setSolverMethod(preconditioner=LinearPDE.ILU0)
409    
410           self.__pde_prec=LinearPDE(domain)           self.__pde_prec=LinearPDE(domain)
411           self.__pde_prec.setReducedOrderOn()           self.__pde_prec.setReducedOrderOn()

Legend:
Removed from v.2288  
changed lines
  Added in v.2351

  ViewVC Help
Powered by ViewVC 1.1.26