/[escript]/trunk/finley/test/python/convection.py
ViewVC logotype

Diff of /trunk/finley/test/python/convection.py

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

revision 1673 by gross, Fri Jul 18 02:28:13 2008 UTC revision 1674 by artak, Fri Jul 25 00:47:16 2008 UTC
# Line 18  import sys Line 18  import sys
18  import time  import time
19  t1 = time.time()  t1 = time.time()
20    
21  if (len(sys.argv)>=3):  extratol=1
  NE=int(sys.argv[2])  
 else:  
  NE=20  
 NE=64  
 NE=20  
22    
23  if (len(sys.argv)>=2):  # read options:
24   solver=sys.argv[1]  parser = OptionParser(usage="%prog [-r [DIR]] [-e [NE]] [-s [solver]]")
25  else:  parser.add_option("-s", "--solver", dest="solver", help="solver to be used for saddle point problem. The possible options are PCG, GMRES, NewtonGMRES, MINRES and TFQMR.", metavar="solver", default="PCG")
26   solver='PCG'  parser.add_option("-e", "--elements", dest="NE", help="number of elements in one direction.",metavar="NE", default=16)
27    
28  if solver!='PCG':  parser.add_option("-r", "--restart", dest="restart", help="restart from latest directory. It will be deleted after a new directory has been created.", default=False, action="store_true")
29   extratol=0.001  parser.add_option("-d", "--dir", dest="restart_dir", help="restart from directory DIR. The directory will not be deleted but new restart directories are created.",metavar="DIR", default=None)
30  else:  (options, args) = parser.parse_args()
31   extratol=1  restart=options.restart or (options.restart_dir !=None)
 extratol=0.1  
32    
33    solver=options.solver
34    NE=int(options.NE)
35    
36  DIM=2  DIM=2
37  H=1.  H=1.
# Line 91  else: Line 87  else:
87    
88  print "total number of elements = ",NE**DIM*int(L/H)**(DIM-1)  print "total number of elements = ",NE**DIM*int(L/H)**(DIM-1)
89    
 # read options:  
 parser = OptionParser(usage="%prog [-r [DIR]]")  
 parser.add_option("-r", "--restart", dest="restart", help="restart from latest directory. It will be deleted after a new directory has been created.", default=False, action="store_true")  
 parser.add_option("-d", "--dir", dest="restart_dir", help="restart from directory DIR. The directory will not be deleted but new restart directories are created.",metavar="DIR", default=None)  
 (options, args) = parser.parse_args()  
 restart=options.restart or (options.restart_dir !=None)  
90  #  #
91  #   set up domain:  #   set up domain:
92  #  #
# Line 206  while t<T_END: Line 196  while t<T_END:
196      FF=exp(A*(1./(1+T.interpolate(Function(dom)))-1./2.))      FF=exp(A*(1./(1+T.interpolate(Function(dom)))-1./2.))
197      print "viscosity range :", inf(FF)*ETA0, sup(FF)*ETA0      print "viscosity range :", inf(FF)*ETA0, sup(FF)*ETA0
198      sp.initialize(eta_N=ETA0*FF, eta_0=ETA0*FF, F=T*(RA*unitVector(DIM-1,DIM)))      sp.initialize(eta_N=ETA0*FF, eta_0=ETA0*FF, F=T*(RA*unitVector(DIM-1,DIM)))
199      sp.update(dt,max_inner_iter=20, verbose=VERBOSE, show_details=False, tol=10., solver='PCG')      sp.update(dt,max_inner_iter=20, verbose=VERBOSE, show_details=False, tol=10., solver=solver)
200      v=sp.getVelocity()      v=sp.getVelocity()
201    
202      for d in range(DIM):      for d in range(DIM):

Legend:
Removed from v.1673  
changed lines
  Added in v.1674

  ViewVC Help
Powered by ViewVC 1.1.26