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

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

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

revision 3891 by ahallam, Thu Nov 25 04:41:33 2010 UTC revision 3892 by jfenwick, Tue Apr 10 08:57:23 2012 UTC
# Line 45  import pylab as pl #Plotting package Line 45  import pylab as pl #Plotting package
45  ########################################################MPI WORLD CHECK  ########################################################MPI WORLD CHECK
46  if getMPISizeWorld() > 1:  if getMPISizeWorld() > 1:
47      import sys      import sys
48      print "This example will not run in an MPI world."      print("This example will not run in an MPI world.")
49      sys.exit(0)      sys.exit(0)
50    
51  #################################################ESTABLISHING VARIABLES  #################################################ESTABLISHING VARIABLES
# Line 121  d.addItems(PropertySet("top",tblock),Pro Line 121  d.addItems(PropertySet("top",tblock),Pro
121  d.setScriptFileName(os.path.join(save_path,"example05.geo"))  d.setScriptFileName(os.path.join(save_path,"example05.geo"))
122  d.setMeshFileName(os.path.join(save_path,"example05.msh"))  d.setMeshFileName(os.path.join(save_path,"example05.msh"))
123  domain=MakeDomain(d, optimizeLabeling=True)  domain=MakeDomain(d, optimizeLabeling=True)
124  print "Domain has been generated ..."  print("Domain has been generated ...")
125  ##############################################################SOLVE PDE  ##############################################################SOLVE PDE
126  mypde=LinearPDE(domain)  mypde=LinearPDE(domain)
127  mypde.getSolverOptions().setVerbosityOn()  mypde.getSolverOptions().setVerbosityOn()
# Line 135  mypde.setValue(q=whereZero(x[1]-sup(x[1] Line 135  mypde.setValue(q=whereZero(x[1]-sup(x[1]
135  qS=Scalar(0,FunctionOnBoundary(domain))  qS=Scalar(0,FunctionOnBoundary(domain))
136  qS.setTaggedValue("linebottom",qin)  qS.setTaggedValue("linebottom",qin)
137  mypde.setValue(y=qS)  mypde.setValue(y=qS)
138  print "PDE has been generated ..."  print("PDE has been generated ...")
139  ###########################################################GET SOLUTION  ###########################################################GET SOLUTION
140  T=mypde.getSolution()  T=mypde.getSolution()
141  print "PDE has been solved  ..."  print("PDE has been solved  ...")
142    
143  #######################################################################  #######################################################################
144  xi, yi, zi = toRegGrid(T, nx=50, ny=50)  xi, yi, zi = toRegGrid(T, nx=50, ny=50)
# Line 147  pl.contourf(xi,yi,zi,10) Line 147  pl.contourf(xi,yi,zi,10)
147  pl.xlabel("Horizontal Displacement (m)")  pl.xlabel("Horizontal Displacement (m)")
148  pl.ylabel("Depth (m)")  pl.ylabel("Depth (m)")
149  pl.savefig(os.path.join(save_path,"Tcontour.png"))  pl.savefig(os.path.join(save_path,"Tcontour.png"))
150  print "Solution has been plotted  ..."  print("Solution has been plotted  ...")

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

  ViewVC Help
Powered by ViewVC 1.1.26