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

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

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

revision 3644 by gross, Thu Oct 27 06:42:56 2011 UTC revision 3892 by jfenwick, Tue Apr 10 08:57:23 2012 UTC
# Line 44  import os Line 44  import os
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  # make sure path exists  # make sure path exists
# Line 83  d.addItems(rec, PropertySet("linebottom" Line 83  d.addItems(rec, PropertySet("linebottom"
83  d.addItems(l01, l23, l30) # just in case we need them  d.addItems(l01, l23, l30) # just in case we need them
84  #############################################MAKE THE DOMAIN  #############################################MAKE THE DOMAIN
85  domain=MakeDomain(d, optimizeLabeling=True)  domain=MakeDomain(d, optimizeLabeling=True)
86  print "Domain has been generated ..."  print("Domain has been generated ...")
87  ##############################################################SOLVE PDE  ##############################################################SOLVE PDE
88  mypde=LinearPDE(domain)  mypde=LinearPDE(domain)
89  mypde.getSolverOptions().setVerbosityOn()  mypde.getSolverOptions().setVerbosityOn()
# Line 94  mypde.setValue(q=whereZero(x[1]-sup(x[1] Line 94  mypde.setValue(q=whereZero(x[1]-sup(x[1]
94  qS=Scalar(0,FunctionOnBoundary(domain))  qS=Scalar(0,FunctionOnBoundary(domain))
95  qS.setTaggedValue("linebottom",qin)  qS.setTaggedValue("linebottom",qin)
96  mypde.setValue(y=-qS)  mypde.setValue(y=-qS)
97  print "PDE has been generated ..."  print("PDE has been generated ...")
98  ###########################################################GET SOLUTION  ###########################################################GET SOLUTION
99  T=mypde.getSolution()  T=mypde.getSolution()
100  print "PDE has been solved  ..."  print("PDE has been solved  ...")
101  ###########################################################  ###########################################################
102  xi, yi, zi = toRegGrid(T, nx=50, ny=50)  xi, yi, zi = toRegGrid(T, nx=50, ny=50)
103  pl.matplotlib.pyplot.autumn()  pl.matplotlib.pyplot.autumn()
# Line 105  pl.contourf(xi,yi,zi,10) Line 105  pl.contourf(xi,yi,zi,10)
105  pl.xlabel("Horizontal Displacement (m)")  pl.xlabel("Horizontal Displacement (m)")
106  pl.ylabel("Depth (m)")  pl.ylabel("Depth (m)")
107  pl.savefig(os.path.join(save_path,"example04.png"))  pl.savefig(os.path.join(save_path,"example04.png"))
108  print "Solution has been plotted  ..."  print("Solution has been plotted  ...")

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

  ViewVC Help
Powered by ViewVC 1.1.26