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

Diff of /trunk/doc/examples/cookbook/example02.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 44  import os, sys #This package is necessar Line 44  import os, sys #This package is necessar
44  ########################################################MPI WORLD CHECK  ########################################################MPI WORLD CHECK
45  if getMPISizeWorld() > 1:  if getMPISizeWorld() > 1:
46      import sys      import sys
47      print "This example will not run in an MPI world."      print("This example will not run in an MPI world.")
48      sys.exit(0)      sys.exit(0)
49    
50  #################################################ESTABLISHING VARIABLES  #################################################ESTABLISHING VARIABLES
# Line 68  tend= 0.5 *day  # - time to end simulati Line 68  tend= 0.5 *day  # - time to end simulati
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","example02")  save_path= os.path.join("data","example02")
# Line 101  while t<tend: Line 101  while t<tend:
101        mypde.setValue(Y=qH+rhocp/h*T)        mypde.setValue(Y=qH+rhocp/h*T)
102        T=mypde.getSolution()        T=mypde.getSolution()
103        totE=integrate(rhocp*T)        totE=integrate(rhocp*T)
104        print "time step %s at t=%e minutes completed. total energy = %e."%(i,t/minute,totE)        print("time step %s at t=%e minutes completed. total energy = %e."%(i,t/minute,totE))
105        t_list.append(t)        t_list.append(t)
106        E_list.append(totE)        E_list.append(totE)
107    

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

  ViewVC Help
Powered by ViewVC 1.1.26