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

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

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

revision 3374 by ahallam, Tue Nov 23 00:30:20 2010 UTC revision 3389 by ahallam, Wed Dec 1 23:03:35 2010 UTC
# Line 36  from esys.finley import Brick # This imp Line 36  from esys.finley import Brick # This imp
36  from esys.weipa import saveVTK # This imports the VTK file saver from weipa  from esys.weipa import saveVTK # This imports the VTK file saver from weipa
37  import os, sys #This package is necessary to handle saving our data.  import os, sys #This package is necessary to handle saving our data.
38    
39    from esys.escript.pdetools import Projector, Locator
40    import numpy as np
41    
42  ########################################################MPI WORLD CHECK  ########################################################MPI WORLD CHECK
43  if getMPISizeWorld() > 1:  if getMPISizeWorld() > 1:
44      import sys      import sys
# Line 44  if getMPISizeWorld() > 1: Line 47  if getMPISizeWorld() > 1:
47    
48  #################################################ESTABLISHING VARIABLES  #################################################ESTABLISHING VARIABLES
49  #Domain related.  #Domain related.
50  mx = 2000*m #meters - model length  mx = 500*m #meters - model length
51  my = 2000*m #meters - model width  my = 500*m #meters - model width
52  mz = -2000*m  mz = -4000*m
53  ndx = 100 # mesh steps in x direction  ndx = 150 # mesh steps in x direction
54  ndy = 100 # mesh steps in y direction - one dimension means one element  ndy = 150 # mesh steps in y direction - one dimension means one element
55  ndz = 100  ndz = 100
56  #PDE related  #PDE related
57  rho=100.0  rho=100.0
# Line 70  mask=wherePositive(100-length(x-rholoc)) Line 73  mask=wherePositive(100-length(x-rholoc))
73  rho=rho*mask  rho=rho*mask
74  kro=kronecker(domain)  kro=kronecker(domain)
75    
76    mass=rho*vol(domain)
77    ipot=FunctionOnBoundary(domain)
78    xb=ipot.getX()
79    
80  q=whereZero(x[2]-inf(x[2]))  q=whereZero(x[2]-inf(x[2]))
81  ###############################################ESCRIPT PDE CONSTRUCTION  ###############################################ESCRIPT PDE CONSTRUCTION
82    
# Line 83  saveVTK(os.path.join(save_path,"ex10b.vt Line 90  saveVTK(os.path.join(save_path,"ex10b.vt
90          g_fieldz=-grad(sol)*[0,0,1],\          g_fieldz=-grad(sol)*[0,0,1],\
91          gz=length(-grad(sol)*[0,0,1]))          gz=length(-grad(sol)*[0,0,1]))
92    
93    ################################################MODEL SIZE SAMPLING
94    sampler=[]
95    for i in range(-250,250,1):
96        sampler.append([i,0,250])
97    
98    sample=[] # array to hold values
99    rec=Locator(domain,sampler) #location to record
100    psol=rec.getValue(sol)
101    np.savetxt(os.path.join(save_path,"example10b_%04d.asc"%mx),psol)
102    

Legend:
Removed from v.3374  
changed lines
  Added in v.3389

  ViewVC Help
Powered by ViewVC 1.1.26