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

Diff of /trunk/doc/examples/cookbook/example01c.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 43  import os, sys #This package is necessar Line 43  import os, sys #This package is necessar
43  ########################################################MPI WORLD CHECK  ########################################################MPI WORLD CHECK
44  if getMPISizeWorld() > 1:  if getMPISizeWorld() > 1:
45      import sys      import sys
46      print "This example will not run in an MPI world."      print("This example will not run in an MPI world.")
47      sys.exit(0)      sys.exit(0)
48    
49  #################################################ESTABLISHING VARIABLES  #################################################ESTABLISHING VARIABLES
# Line 68  tend=50 * yr # - time to end simulation Line 68  tend=50 * yr # - time to end simulation
68  outputs = 200 # number of time steps required.  outputs = 200 # number of time steps required.
69  h=(tend-t)/outputs #size of time step  h=(tend-t)/outputs #size of time step
70  #user warning statement  #user warning statement
71  print "Expected Number of time outputs is: ", (tend-t)/h  print("Expected Number of time outputs is: ", (tend-t)/h)
72  i=0 #loop counter  i=0 #loop counter
73  #the folder to put our outputs in, leave blank "" for script path  #the folder to put our outputs in, leave blank "" for script path
74  save_path= os.path.join("data","example01")  save_path= os.path.join("data","example01")
# Line 103  while t<tend: Line 103  while t<tend:
103        mypde.setValue(Y=qH+rhocp/h*T)        mypde.setValue(Y=qH+rhocp/h*T)
104        T=mypde.getSolution()        T=mypde.getSolution()
105        totE=integrate(rhocp*T)        totE=integrate(rhocp*T)
106        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))
107        t_list.append(t)        t_list.append(t)
108        E_list.append(totE)        E_list.append(totE)
109    

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

  ViewVC Help
Powered by ViewVC 1.1.26