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

revision 1392 by gross, Mon Jan 21 06:20:54 2008 UTC revision 1400 by gross, Thu Jan 24 06:04:31 2008 UTC
# Line 56  class TransportPDE(object): Line 56  class TransportPDE(object):
56       def setInitialSolution(self,u):       def setInitialSolution(self,u):
57           self.__transport_problem.setInitialValue(interpolate(u,self.getFunctionSpace()))           self.__transport_problem.setInitialValue(interpolate(u,self.getFunctionSpace()))
58       def solve(self,dt):       def solve(self,dt):
59         return self.__transport_problem.solve(self.__source,dt,{"verbose" : True })         return self.__transport_problem.solve(self.__source,dt,{"verbose" : True , "tolerance" : 1.e-6})
60  from esys.finley import Rectangle  from esys.finley import Rectangle
61
62  dom=Rectangle(40,20,l0=2)  dom=Rectangle(30,20,l0=1.5)
63  fc=TransportPDE(dom,num_equations=1,theta=1.0,dt_max=2.5e-2/10)  dom=Rectangle(120,80,l0=1.5)
64    fc=TransportPDE(dom,num_equations=1,theta=0.5,dt_max=2.5e-2)
65  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])
66  x=dom.getX()  x=dom.getX()
67  x_0=[0.3,0.3]  x_0=[0.3,0.3]
# Line 77  fc.setInitialSolution(u) Line 78  fc.setInitialSolution(u)
78
79  dt=2.5e-2  dt=2.5e-2
80  t=0.  t=0.
81  while t<25*dt:  while t<50*dt:
82      print "time step t=",t+dt        print "time step t=",t+dt
83      u=fc.solve(dt)        u=fc.solve(dt)
84      print "range u",inf(u),sup(u),integrate(u,Function(dom))      print "range u",inf(u),sup(u),integrate(u,Function(dom))
85      c+=1      c+=1
86      saveVTK("u.%s.xml"%c,u=u)      saveVTK("u.%s.xml"%c,u=u)
87      t+=dt      t+=dt
88        if c == 20: 1/0

Legend:
 Removed from v.1392 changed lines Added in v.1400

 ViewVC Help Powered by ViewVC 1.1.26