/[escript]/trunk/doc/examples/cookbook/example01a.py
ViewVC logotype

Diff of /trunk/doc/examples/cookbook/example01a.py

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

revision 3891 by ahallam, Tue Nov 23 00:30:20 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) 2009 by University of Queensland  # Copyright (c) 2009 by University of Queensland
# Line 57  tend=50 * yr # - time to end simulation Line 58  tend=50 * yr # - time to end simulation
58  outputs = 200 # number of time steps required.  outputs = 200 # number of time steps required.
59  h=(tend-t)/outputs #size of time step  h=(tend-t)/outputs #size of time step
60  #user warning statement  #user warning statement
61  print "Expected Number of time outputs is: ", (tend-t)/h  print("Expected Number of time outputs is: ", (tend-t)/h)
62  i=0 #loop counter  i=0 #loop counter
63  #the folder to put our outputs in, leave blank "" for script path  #the folder to put our outputs in, leave blank "" for script path
64  save_path= os.path.join("data","example01")  save_path= os.path.join("data","example01")
# Line 85  while t<tend: Line 86  while t<tend:
86        mypde.setValue(Y=qH+rhocp/h*T)        mypde.setValue(Y=qH+rhocp/h*T)
87        T=mypde.getSolution()        T=mypde.getSolution()
88        totE=integrate(rhocp*T)        totE=integrate(rhocp*T)
89        print "time step %s at t=%e days completed. total energy = %e."%(i,t/day,totE)        print("time step %s at t=%e days completed. total energy = %e."%(i,t/day,totE))

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

  ViewVC Help
Powered by ViewVC 1.1.26