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

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

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

revision 2977 by ahallam, Tue Mar 9 00:33:28 2010 UTC revision 3892 by jfenwick, Tue Apr 10 08:57:23 2012 UTC
# Line 44  import os, sys Line 44  import os, sys
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  #################################################ESTABLISHING VARIABLES  #################################################ESTABLISHING VARIABLES
50  # where to put output files  # where to put output files
# Line 111  d.setScriptFileName(os.path.join(save_pa Line 111  d.setScriptFileName(os.path.join(save_pa
111    
112  d.setMeshFileName(os.path.join(save_path,"example06.msh"))  d.setMeshFileName(os.path.join(save_path,"example06.msh"))
113  domain=MakeDomain(d)  domain=MakeDomain(d)
114  print "Domain has been generated ..."  print("Domain has been generated ...")
115    
116  # set up kappa (thermal conductivity across domain) using tags  # set up kappa (thermal conductivity across domain) using tags
117  kappa=Scalar(0,Function(domain))  kappa=Scalar(0,Function(domain))
# Line 128  mypde.setValue(q=whereZero(x[1]-sup(x[1] Line 128  mypde.setValue(q=whereZero(x[1]-sup(x[1]
128  qS=Scalar(0,FunctionOnBoundary(domain))  qS=Scalar(0,FunctionOnBoundary(domain))
129  qS.setTaggedValue("linebottom",qin)  qS.setTaggedValue("linebottom",qin)
130  mypde.setValue(y=qS)  mypde.setValue(y=qS)
131  print "PDE has been generated ..."  print("PDE has been generated ...")
132  ###########################################################GET SOLUTION  ###########################################################GET SOLUTION
133  T=mypde.getSolution()  T=mypde.getSolution()
134  print "PDE has been solved ..."  print("PDE has been solved ...")
135  ###############################################################PLOTTING  ###############################################################PLOTTING
136  # show temperature:  # show temperature:
137  xi, yi, zi = toRegGrid(T, nx=50, ny=50)  xi, yi, zi = toRegGrid(T, nx=50, ny=50)
# Line 153  pl.xlabel("Horizontal Displacement (m)") Line 153  pl.xlabel("Horizontal Displacement (m)")
153  pl.ylabel("Depth (m)")  pl.ylabel("Depth (m)")
154  pl.legend()  pl.legend()
155  pl.savefig(os.path.join(save_path,"flux.png"))  pl.savefig(os.path.join(save_path,"flux.png"))
156  print "Flux has been plotted  ..."  print("Flux has been plotted  ...")

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

  ViewVC Help
Powered by ViewVC 1.1.26