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

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

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

revision 4575 by jfenwick, Tue Jan 22 09:30:23 2013 UTC revision 4576 by sshaw, Mon Dec 9 23:35:30 2013 UTC
# Line 45  from esys.finley import ReadMesh Line 45  from esys.finley import ReadMesh
45    
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
53  # where to save output data  # where to save output data
# Line 162  n=0 # iteration counter Line 162  n=0 # iteration counter
162  t=0 # time counter  t=0 # time counter
163  ##############################################################ITERATION  ##############################################################ITERATION
164  while t<tend:  while t<tend:
165      # get current stress      # get current stress
166      g=grad(u); stress=lam*trace(g)*kmat+mu*(g+transpose(g))#*abc      g=grad(u); stress=lam*trace(g)*kmat+mu*(g+transpose(g))#*abc
167      mypde.setValue(X=-stress) # set PDE values      mypde.setValue(X=-stress) # set PDE values
168      accel = mypde.getSolution() #get PDE solution for accelleration      accel = mypde.getSolution() #get PDE solution for accelleration
169      u_p1=(2.*u-u_m1)+h*h*accel #calculate displacement      u_p1=(2.*u-u_m1)+h*h*accel #calculate displacement
170      u_p1=u_p1#*abc          # apply boundary conditions      u_p1=u_p1#*abc          # apply boundary conditions
171      u_m1=u; u=u_p1 # shift values by 1      u_m1=u; u=u_p1 # shift values by 1
172      # save current displacement, acceleration and pressure      # save current displacement, acceleration and pressure
173      if (t >= rtime):      if (t >= rtime):

Legend:
Removed from v.4575  
changed lines
  Added in v.4576

  ViewVC Help
Powered by ViewVC 1.1.26