 # Diff of /trunk/doc/examples/cookbook/wavesolver2d004.py

revision 3891 by caltinay, Fri Nov 12 01:19:02 2010 UTC revision 3892 by jfenwick, Tue Apr 10 08:57:23 2012 UTC
# Line 59  tend=0.5    #end time Line 59  tend=0.5    #end time
59  #calculating )the timestep  #calculating )the timestep
60  h=(1./5.)*sqrt(rho/(lam+2*mu))*(mx/ndx)  h=(1./5.)*sqrt(rho/(lam+2*mu))*(mx/ndx)
61  #Check to make sure number of time steps is not too large.  #Check to make sure number of time steps is not too large.
62  print "Time step size= ",h, "Expected number of outputs= ",tend/h  print("Time step size= ",h, "Expected number of outputs= ",tend/h)
63
64  #uncomment the following lines to give the user a chance to stop  #uncomment the following lines to give the user a chance to stop
65  #proceeder = raw_input("Is this ok?(y/n)")  #proceeder = raw_input("Is this ok?(y/n)")
# Line 181  mypde.setValue(D=kmat*rho) Line 181  mypde.setValue(D=kmat*rho)
181  # define small radius around point xc  # define small radius around point xc
182  # Lsup(x) returns the maximum value of the argument x  # Lsup(x) returns the maximum value of the argument x
183  src_radius = 50#2*Lsup(domain.getSize())  src_radius = 50#2*Lsup(domain.getSize())
185
186  #dunit=numpy.array([0.,1.]) # defines direction of point source  #dunit=numpy.array([0.,1.]) # defines direction of point source
187  dunit=(x-xc)  dunit=(x-xc)
# Line 205  u=x*0. Line 205  u=x*0.
205  #~  #~
206  #~ y2=np.exp(-50.*x2)*np.sin(40*3.14157*x2)  #~ y2=np.exp(-50.*x2)*np.sin(40*3.14157*x2)
207
208  print u  print(u)
209  u_m1=u  u_m1=u
210  t=0  t=0
211
# Line 246  while t<tend: Line 246  while t<tend:
246      #stress =      #stress =
247      t+=h      t+=h
248      n+=1      n+=1
249      print n,"-th time step t ",t      print(n,"-th time step t ",t)
250      #~ u_pot = cbphones(domain,u,[[300.,200.],[500.,200.],[750.,200.]],2)      #~ u_pot = cbphones(domain,u,[[300.,200.],[500.,200.],[750.,200.]],2)
251      #~      #~
252      #~ #     print "u at point charge=",u_pc      #~ #     print "u at point charge=",u_pc

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