/[escript]/trunk/doc/examples/geotutorial/forward_euler.py
ViewVC logotype

Diff of /trunk/doc/examples/geotutorial/forward_euler.py

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

revision 3891 by caltinay, Fri Nov 12 01:19:02 2010 UTC revision 3892 by jfenwick, Tue Apr 10 08:57:23 2012 UTC
# Line 1  Line 1 
1    
2    from __future__ import print_function
3  ########################################################  ########################################################
4  #  #
5  # Copyright (c) 2003-2010 by University of Queensland  # Copyright (c) 2003-2010 by University of Queensland
# Line 43  Q=Qc*whereNegative(length(x-xc)-r) Line 45  Q=Qc*whereNegative(length(x-xc)-r)
45  # time step size:  # time step size:
46  dt=0.01  dt=0.01
47  # or use adaptive choice dt=0.05*inf(rhocp*mydomain.getSize()**2/k)  # or use adaptive choice dt=0.05*inf(rhocp*mydomain.getSize()**2/k)
48  print "time step size = ",dt  print("time step size = ",dt)
49  # generate domain:  # generate domain:
50  mypde=LinearPDE(mydomain)  mypde=LinearPDE(mydomain)
51  mypde.setSymmetryOn()  mypde.setSymmetryOn()
# Line 56  T=T_D Line 58  T=T_D
58  N=0; t=0  N=0; t=0
59  # stop when t_end is reached:  # stop when t_end is reached:
60  while t<t_end:  while t<t_end:
61      print N,"-th time step t=",t," T_max=", Lsup(T)      print(N,"-th time step t=",t," T_max=", Lsup(T))
62      # update PDE coefficient:      # update PDE coefficient:
63      mypde.setValue(Y=rhocp*T+dt*Q, X=-k*dt*grad(T))      mypde.setValue(Y=rhocp*T+dt*Q, X=-k*dt*grad(T))
64      # new temperature:      # new temperature:

Legend:
Removed from v.3891  
changed lines
  Added in v.3892

  ViewVC Help
Powered by ViewVC 1.1.26