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

Diff of /trunk/doc/examples/cookbook/example05b.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 46  import pylab as pl #Plotting package Line 46  import pylab as pl #Plotting package
46  ########################################################MPI WORLD CHECK  ########################################################MPI WORLD CHECK
47  if getMPISizeWorld() > 1:  if getMPISizeWorld() > 1:
48      import sys      import sys
49      print "This example will not run in an MPI world."      print("This example will not run in an MPI world.")
50      sys.exit(0)      sys.exit(0)
51    
52  #################################################ESTABLISHING VARIABLES  #################################################ESTABLISHING VARIABLES
# Line 122  d.addItems(PropertySet("top",tblock),Pro Line 122  d.addItems(PropertySet("top",tblock),Pro
122  d.setScriptFileName(os.path.join(save_path,"example05.geo"))  d.setScriptFileName(os.path.join(save_path,"example05.geo"))
123  d.setMeshFileName(os.path.join(save_path,"example05.msh"))  d.setMeshFileName(os.path.join(save_path,"example05.msh"))
124  domain=MakeDomain(d, optimizeLabeling=True)  domain=MakeDomain(d, optimizeLabeling=True)
125  print "Domain has been generated ..."  print("Domain has been generated ...")
126  ##############################################################SOLVE PDE  ##############################################################SOLVE PDE
127  mypde=LinearPDE(domain)  mypde=LinearPDE(domain)
128  mypde.getSolverOptions().setVerbosityOn()  mypde.getSolverOptions().setVerbosityOn()
# Line 136  mypde.setValue(q=whereZero(x[1]-sup(x[1] Line 136  mypde.setValue(q=whereZero(x[1]-sup(x[1]
136  qS=Scalar(0,FunctionOnBoundary(domain))  qS=Scalar(0,FunctionOnBoundary(domain))
137  qS.setTaggedValue("linebottom",qin)  qS.setTaggedValue("linebottom",qin)
138  mypde.setValue(y=qS)  mypde.setValue(y=qS)
139  print "PDE has been generated ..."  print("PDE has been generated ...")
140  ###########################################################GET SOLUTION  ###########################################################GET SOLUTION
141  T=mypde.getSolution()  T=mypde.getSolution()
142  print "PDE has been solved  ..."  print("PDE has been solved  ...")
143    
144  ##################################################REGRIDDING & PLOTTING  ##################################################REGRIDDING & PLOTTING
145  xi, yi, zi = toRegGrid(T, nx=50, ny=50)  xi, yi, zi = toRegGrid(T, nx=50, ny=50)
# Line 148  pl.contourf(xi,yi,zi,10) Line 148  pl.contourf(xi,yi,zi,10)
148  pl.xlabel("Horizontal Displacement (m)")  pl.xlabel("Horizontal Displacement (m)")
149  pl.ylabel("Depth (m)")  pl.ylabel("Depth (m)")
150  pl.savefig(os.path.join(save_path,"Tcontour.png"))  pl.savefig(os.path.join(save_path,"Tcontour.png"))
151  print "Solution has been plotted  ..."  print("Solution has been plotted  ...")
152  ##########################################################VISUALISATION  ##########################################################VISUALISATION
153  # calculate gradient of solution for quiver plot  # calculate gradient of solution for quiver plot
154  #Projector is used to smooth the data.  #Projector is used to smooth the data.
# Line 197  pl.ylabel("Depth (m)") Line 197  pl.ylabel("Depth (m)")
197  pl.axis([1,5,-6000,0])  pl.axis([1,5,-6000,0])
198  pl.savefig(os.path.join(save_path,"tcdp.png"))  pl.savefig(os.path.join(save_path,"tcdp.png"))
199  pl.clf()  pl.clf()
200  print "vertical profiles created ..."  print("vertical profiles created ...")

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

  ViewVC Help
Powered by ViewVC 1.1.26