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

Diff of /trunk/doc/examples/cookbook/example05c.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 48  import numpy as np Line 48  import numpy as np
48  ########################################################MPI WORLD CHECK  ########################################################MPI WORLD CHECK
49  if getMPISizeWorld() > 1:  if getMPISizeWorld() > 1:
50      import sys      import sys
51      print "This example will not run in an MPI world."      print("This example will not run in an MPI world.")
52      sys.exit(0)      sys.exit(0)
53    
54  #################################################ESTABLISHING VARIABLES  #################################################ESTABLISHING VARIABLES
# Line 123  d.addItems(PropertySet("top",tblock),Pro Line 123  d.addItems(PropertySet("top",tblock),Pro
123  d.setScriptFileName(os.path.join(save_path,"example05.geo"))  d.setScriptFileName(os.path.join(save_path,"example05.geo"))
124  d.setMeshFileName(os.path.join(save_path,"example05.msh"))  d.setMeshFileName(os.path.join(save_path,"example05.msh"))
125  domain=MakeDomain(d, optimizeLabeling=True)  domain=MakeDomain(d, optimizeLabeling=True)
126  print "Domain has been generated ..."  print("Domain has been generated ...")
127  ##############################################################SOLVE PDE  ##############################################################SOLVE PDE
128  mypde=LinearPDE(domain)  mypde=LinearPDE(domain)
129  mypde.getSolverOptions().setVerbosityOn()  mypde.getSolverOptions().setVerbosityOn()
# Line 137  mypde.setValue(q=whereZero(x[1]-sup(x[1] Line 137  mypde.setValue(q=whereZero(x[1]-sup(x[1]
137  qS=Scalar(0,FunctionOnBoundary(domain))  qS=Scalar(0,FunctionOnBoundary(domain))
138  qS.setTaggedValue("linebottom",qin)  qS.setTaggedValue("linebottom",qin)
139  mypde.setValue(y=qS)  mypde.setValue(y=qS)
140  print "PDE has been generated ..."  print("PDE has been generated ...")
141  ###########################################################GET SOLUTION  ###########################################################GET SOLUTION
142  T=mypde.getSolution()  T=mypde.getSolution()
143  print "PDE has been solved  ..."  print("PDE has been solved  ...")
144  ###############################################################PLOTTING  ###############################################################PLOTTING
145  # show temperature:  # show temperature:
146  xi, yi, zi = toRegGrid(T, nx=50, ny=50)  xi, yi, zi = toRegGrid(T, nx=50, ny=50)
# Line 160  pl.xlabel("Horizontal Displacement (m)") Line 160  pl.xlabel("Horizontal Displacement (m)")
160  pl.ylabel("Depth (m)")  pl.ylabel("Depth (m)")
161  pl.legend()  pl.legend()
162  pl.savefig(os.path.join(save_path,"flux.png"))  pl.savefig(os.path.join(save_path,"flux.png"))
163  print "Flux has been plotted  ..."  print("Flux has been plotted  ...")

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

  ViewVC Help
Powered by ViewVC 1.1.26