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

revision 3773 by caltinay, Fri Nov 12 01:19:02 2010 UTC revision 3774 by jfenwick, Wed Jan 18 06:29:34 2012 UTC
# Line 57  dt=2.49999e-2*0+6.2499999e-02/4 Line 57  dt=2.49999e-2*0+6.2499999e-02/4
57  dt_out=2.49999e-2*0+6.2499999e-02/4  dt_out=2.49999e-2*0+6.2499999e-02/4
58  c_stop=1  c_stop=1
59  n_out=int(t_end/dt+0.5)  n_out=int(t_end/dt+0.5)
60  print n_out  print(n_out)
61  t=0.  t=0.
62  t_out=0  t_out=0
63  c_out=0  c_out=0
64  c=0  c=0
65  print t,": range u",inf(u0),sup(u0),integrate(u0,Function(dom))  print(t,": range u",inf(u0),sup(u0),integrate(u0,Function(dom)))
66  while t<t_end and c< c_stop:  while t<t_end and c< c_stop:
67      print "time step t=",t+dt        print("time step t=",t+dt)
68      u=fc.solve(dt)        u=fc.solve(dt)
69      print t+dt,": range u",inf(u),sup(u),integrate(u,Function(dom))      print(t+dt,": range u",inf(u),sup(u),integrate(u,Function(dom)))
70      c+=1      c+=1
71      t+=dt      t+=dt
72      if t>=t_out+dt_out:      if t>=t_out+dt_out:
73           c_out,t_out=c_out+1,t_out+dt_out           c_out,t_out=c_out+1,t_out+dt_out
74           saveVTK("u.%s.vtu"%c_out,u=u)           saveVTK("u.%s.vtu"%c_out,u=u)
75           print "write time step ",c,"(t=%s) to file u.%s.vtu"%(t,c_out)           print("write time step ",c,"(t=%s) to file u.%s.vtu"%(t,c_out))
76
77  if True:  if True:
78     pde=LinearPDE(dom)     pde=LinearPDE(dom)
# Line 83  if True: Line 83  if True:
83     c_out=0     c_out=0
84     c=0     c=0
85     u=u0     u=u0
86     print t,": range u2",inf(u0),sup(u0),integrate(u0,Function(dom))     print(t,": range u2",inf(u0),sup(u0),integrate(u0,Function(dom)))
87     while t<t_end and c< c_stop:     while t<t_end and c< c_stop:
88         print "time step t=",t+dt             print("time step t=",t+dt)
89         pde.setValue(Y=u+(1.-THETA)*dt*inner(V,grad(u)))         pde.setValue(Y=u+(1.-THETA)*dt*inner(V,grad(u)))
90         u=pde.getSolution(verbose=True)         u=pde.getSolution(verbose=True)
91         print t+dt,": range u2",inf(u),sup(u),integrate(u,Function(dom))         print(t+dt,": range u2",inf(u),sup(u),integrate(u,Function(dom)))
92         c+=1         c+=1
93         t+=dt         t+=dt
94         if t>=t_out+dt_out:         if t>=t_out+dt_out:
95           c_out,t_out=c_out+1,t_out+dt_out           c_out,t_out=c_out+1,t_out+dt_out
96           saveVTK("u2.%s.vtu"%c_out,u=u)           saveVTK("u2.%s.vtu"%c_out,u=u)
97           print "write time step ",c,"(t=%s) to file u2.%s.vtu"%(t,c_out)           print("write time step ",c,"(t=%s) to file u2.%s.vtu"%(t,c_out))

Legend:
 Removed from v.3773 changed lines Added in v.3774

 ViewVC Help Powered by ViewVC 1.1.26