/[escript]/trunk/finley/test/python/tp.py
ViewVC logotype

Diff of /trunk/finley/test/python/tp.py

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

revision 1406 by gross, Thu Jan 24 06:04:31 2008 UTC revision 1407 by gross, Mon Feb 4 06:45:48 2008 UTC
# Line 1  Line 1 
1  from esys.escript import *  from esys.escript import *
2    
3  class TransportPDE(object):  class TransportPDE(object):
4       def __init__(self,domain,num_equations=1,theta=0.,dt_max=-1.,trace=True):       def __init__(self,domain,num_equations=1,theta=0.,trace=True):
5          self.__domain=domain          self.__domain=domain
6          self.__num_equations=num_equations          self.__num_equations=num_equations
7          self.__theta=theta          self.__theta=theta
         self.__dt_max=dt_max  
8          self.__transport_problem=None          self.__transport_problem=None
9      self.__trace=trace      self.__trace=trace
10      self.__matrix_type=0      self.__matrix_type=0
# Line 16  class TransportPDE(object): Line 15  class TransportPDE(object):
15          return self.__domain          return self.__domain
16       def getTheta(self):       def getTheta(self):
17          return self.__theta          return self.__theta
      def getDt_max(self):  
         return self.__dt_max  
18       def getNumEquations(self):       def getNumEquations(self):
19          return self.__num_equations          return self.__num_equations
20       def reduced(self):       def reduced(self):
# Line 28  class TransportPDE(object): Line 25  class TransportPDE(object):
25          else:          else:
26             return Solution(self.getDomain())             return Solution(self.getDomain())
27    
28         def getSafeTimeStepSize(self):
29            return self.__transport_problem.getSafeTimeStepSize()
30    
31    
32       def __getNewTransportProblem(self):       def __getNewTransportProblem(self):
33         """         """
# Line 36  class TransportPDE(object): Line 36  class TransportPDE(object):
36         self.trace("New Transport problem is allocated.")         self.trace("New Transport problem is allocated.")
37         return self.getDomain().newTransportProblem( \         return self.getDomain().newTransportProblem( \
38                                 self.getTheta(),                                 self.getTheta(),
                                self.getDt_max(),  
39                                 self.getNumEquations(), \                                 self.getNumEquations(), \
40                                 self.getFunctionSpace(), \                                 self.getFunctionSpace(), \
41                                 self.__matrix_type)                                 self.__matrix_type)
# Line 59  class TransportPDE(object): Line 58  class TransportPDE(object):
58         return self.__transport_problem.solve(self.__source,dt,{"verbose" : True , "tolerance" : 1.e-6})         return self.__transport_problem.solve(self.__source,dt,{"verbose" : True , "tolerance" : 1.e-6})
59  from esys.finley import Rectangle  from esys.finley import Rectangle
60    
61  dom=Rectangle(30,20,l0=1.5)  dom=Rectangle(6,3,l0=1.5)
62  dom=Rectangle(120,80,l0=1.5)  # dom=Rectangle(120,80,l0=1.5)
63  fc=TransportPDE(dom,num_equations=1,theta=0.5,dt_max=2.5e-2)  fc=TransportPDE(dom,num_equations=1,theta=0.5)
64  fc.setValue(M=Scalar(1.,Function(dom)),C=Scalar(1.,Function(dom))*[-1.,0])  fc.setValue(M=Scalar(1.,Function(dom)),C=Scalar(1.,Function(dom))*[-1.,0])
65  x=dom.getX()  x=dom.getX()
66  x_0=[0.3,0.3]  x_0=[0.3,0.3]

Legend:
Removed from v.1406  
changed lines
  Added in v.1407

  ViewVC Help
Powered by ViewVC 1.1.26