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

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

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

trunk/escript/py_src/flows.py revision 4154 by jfenwick, Tue Jan 22 09:30:23 2013 UTC trunk/escriptcore/py_src/flows.py revision 4507 by jfenwick, Wed Jul 24 02:50:22 2013 UTC
# Line 33  Some models for flow Line 33  Some models for flow
33    
34  __author__="Lutz Gross, l.gross@uq.edu.au"  __author__="Lutz Gross, l.gross@uq.edu.au"
35    
36  from . import escriptcpp  from . import escriptcpp as escore
 escore=escriptcpp  
 #from . import escript  
37  from . import util  from . import util
38  from .linearPDEs import LinearPDE, LinearPDESystem, LinearSinglePDE, SolverOptions  from . import linearPDEs as lpe
39  from .pdetools import HomogeneousSaddlePointProblem,Projector, ArithmeticTuple, PCG, NegativeNorm, GMRES  from . import pdetools as pdt
40    
41  class DarcyFlow(object):  class DarcyFlow(object):
42     """     """
# Line 84  class DarcyFlow(object): Line 82  class DarcyFlow(object):
82        self.l=None        self.l=None
83        self.w=None        self.w=None
84            
85        self.__pde_p=LinearSinglePDE(domain)        self.__pde_p=lpe.LinearSinglePDE(domain)
86        self.__pde_p.setSymmetryOn()        self.__pde_p.setSymmetryOn()
87        if self.useReduced: self.__pde_p.setReducedOrderOn()        if self.useReduced: self.__pde_p.setReducedOrderOn()
88    
# Line 96  class DarcyFlow(object): Line 94  class DarcyFlow(object):
94           if util.inf(w)<0.:           if util.inf(w)<0.:
95              raise ValueError("Weighting factor must be non-negative.")              raise ValueError("Weighting factor must be non-negative.")
96           if self.verbose: print("DarcyFlow: global postprocessing of flux is used.")           if self.verbose: print("DarcyFlow: global postprocessing of flux is used.")
97           self.__pde_v=LinearPDESystem(domain)           self.__pde_v=lpe.LinearPDESystem(domain)
98           self.__pde_v.setSymmetryOn()           self.__pde_v.setSymmetryOn()
99           if self.useReduced: self.__pde_v.setReducedOrderOn()           if self.useReduced: self.__pde_v.setReducedOrderOn()
100           self.w=w           self.w=w
# Line 105  class DarcyFlow(object): Line 103  class DarcyFlow(object):
103           #self.l=util.vol(self.domain)**(1./self.domain.getDim()) # length scale           #self.l=util.vol(self.domain)**(1./self.domain.getDim()) # length scale
104    
105        elif self.solver  == self.SMOOTH:        elif self.solver  == self.SMOOTH:
106           self.__pde_v=LinearPDESystem(domain)           self.__pde_v=lpe.LinearPDESystem(domain)
107           self.__pde_v.setSymmetryOn()           self.__pde_v.setSymmetryOn()
108           if self.useReduced: self.__pde_v.setReducedOrderOn()           if self.useReduced: self.__pde_v.setReducedOrderOn()
109           if self.verbose: print("DarcyFlow: flux smoothing is used.")           if self.verbose: print("DarcyFlow: flux smoothing is used.")
# Line 308  class DarcyFlow(object): Line 306  class DarcyFlow(object):
306             u = self.__g - util.tensor_mult(self.__permeability, self.perm_scale * (util.grad(pp) + self.__permeability_invXg_ref))             u = self.__g - util.tensor_mult(self.__permeability, self.perm_scale * (util.grad(pp) + self.__permeability_invXg_ref))
307          elif self.solver  == self.POST or self.solver  == self.SMOOTH:          elif self.solver  == self.POST or self.solver  == self.SMOOTH:
308              self.__pde_v.setValue(Y= self.__permeability_invXg - (util.grad(pp) + self.__permeability_invXg_ref))              self.__pde_v.setValue(Y= self.__permeability_invXg - (util.grad(pp) + self.__permeability_invXg_ref))
309              print  
310              if u0 == None:              if u0 == None:
311                 self.__pde_v.setValue(r=escore.Data())                 self.__pde_v.setValue(r=escore.Data())
312              else:              else:
# Line 317  class DarcyFlow(object): Line 315  class DarcyFlow(object):
315              u= self.__pde_v.getSolution() * self.perm_scale              u= self.__pde_v.getSolution() * self.perm_scale
316          return u          return u
317                
318  class StokesProblemCartesian(HomogeneousSaddlePointProblem):  class StokesProblemCartesian(pdt.HomogeneousSaddlePointProblem):
319       """       """
320       solves       solves
321    
# Line 349  class StokesProblemCartesian(Homogeneous Line 347  class StokesProblemCartesian(Homogeneous
347           :param domain: domain of the problem.           :param domain: domain of the problem.
348           :type domain: `Domain`           :type domain: `Domain`
349           """           """
350           HomogeneousSaddlePointProblem.__init__(self,**kwargs)           pdt.HomogeneousSaddlePointProblem.__init__(self,**kwargs)
351           self.domain=domain           self.domain=domain
352           self.__pde_v=LinearPDE(domain,numEquations=self.domain.getDim(),numSolutions=self.domain.getDim())           self.__pde_v=lpe.LinearPDE(domain,numEquations=self.domain.getDim(),numSolutions=self.domain.getDim())
353           self.__pde_v.setSymmetryOn()           self.__pde_v.setSymmetryOn()
354            
355           self.__pde_prec=LinearPDE(domain)           self.__pde_prec=lpe.LinearPDE(domain)
356           self.__pde_prec.setReducedOrderOn()           self.__pde_prec.setReducedOrderOn()
357           self.__pde_prec.setSymmetryOn()           self.__pde_prec.setSymmetryOn()
358    
359           self.__pde_proj=LinearPDE(domain)           self.__pde_proj=lpe.LinearPDE(domain)
360           self.__pde_proj.setReducedOrderOn()           self.__pde_proj.setReducedOrderOn()
361           self.__pde_proj.setValue(D=1)           self.__pde_proj.setValue(D=1)
362           self.__pde_proj.setSymmetryOn()           self.__pde_proj.setSymmetryOn()

Legend:
Removed from v.4154  
changed lines
  Added in v.4507

  ViewVC Help
Powered by ViewVC 1.1.26