/[escript]/trunk/doc/examples/usersguide/fluid.py
ViewVC logotype

Diff of /trunk/doc/examples/usersguide/fluid.py

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

revision 2793 by gross, Tue Dec 1 06:10:10 2009 UTC revision 4848 by jfenwick, Wed Apr 9 00:26:32 2014 UTC
# Line 1  Line 1 
1  ########################################################  from __future__ import print_function
2    ##############################################################################
3  #  #
4  # Copyright (c) 2008-2009 by University of Queensland  # Copyright (c) 2008-2014 by University of Queensland
5  # Earth Systems Science Computational Center (ESSCC)  # http://www.uq.edu.au
 # http://www.uq.edu.au/esscc  
6  #  #
7  # Primary Business: Queensland, Australia  # Primary Business: Queensland, Australia
8  # Licensed under the Open Software License version 3.0  # Licensed under the Open Software License version 3.0
9  # http://www.opensource.org/licenses/osl-3.0.php  # http://www.opensource.org/licenses/osl-3.0.php
10  #  #
11  ########################################################  # Development until 2012 by Earth Systems Science Computational Center (ESSCC)
12    # Development 2012-2013 by School of Earth Sciences
13    # Development from 2014 by Centre for Geoscience Computing (GeoComp)
14    #
15    ##############################################################################
16    
17  ########      August 2008      ########  ########      August 2008      ########
18  ##########    Leon Graham    ##########  ##########    Leon Graham    ##########
# Line 18  from esys.escript import * Line 22  from esys.escript import *
22  import esys.finley  import esys.finley
23  from esys.escript.linearPDEs import LinearPDE  from esys.escript.linearPDEs import LinearPDE
24  from esys.escript.models import StokesProblemCartesian  from esys.escript.models import StokesProblemCartesian
25    from esys.weipa import saveVTK
26    
27  #physical constants  #physical constants
28  eta=1.0  eta=1.0
# Line 37  useUzawa='TRUE' Line 42  useUzawa='TRUE'
42  H=2.0  H=2.0
43  L=1.0  L=1.0
44  W=1.0  W=1.0
45  mesh = esys.finley.Rectangle(l0=L, l1=H, order=-1, n0=20, n1=20) # use linear macro elements for pressure  mesh = esys.finley.Rectangle(l0=L, l1=H, order=-1, n0=20, n1=20, useElementsOnFace=0) # use linear macro elements for pressure
46  coordinates = mesh.getX()  coordinates = mesh.getX()
47    
48  #gravitational force  #gravitational force
# Line 60  solution.setTolerance(tolerance) Line 65  solution.setTolerance(tolerance)
65    
66  while t <= t_end:  while t <= t_end:
67    
68    print " ----- Time step = %s -----"%( t )    print(" ----- Time step = %s -----"%( t ))
69    print "Time = %s seconds"%( time )      print("Time = %s seconds"%( time ))  
70    
71    solution.initialize(fixed_u_mask=boundary_cond,eta=eta,f=Y)    solution.initialize(fixed_u_mask=boundary_cond,eta=eta,f=Y)
72    velocity,pressure=solution.solve(velocity,pressure,max_iter=max_iter,verbose=verbose,usePCG=True)    velocity,pressure=solution.solve(velocity,pressure,max_iter=max_iter,verbose=verbose,usePCG=True)
73        
74    print "Max velocity =", Lsup(velocity), "m/s"    print("Max velocity =", Lsup(velocity), "m/s")
75        
76    #Courant condition    #Courant condition
77    dt=0.4*h/(Lsup(velocity))    dt=0.4*h/(Lsup(velocity))
78    print "dt", dt    print("dt", dt)
79        
80    #displace the mesh    #displace the mesh
81    displacement = velocity * dt    displacement = velocity * dt
82    coordinates = mesh.getX()    coordinates = mesh.getX()
83    mesh.setX(coordinates + displacement)      newx=interpolate(coordinates + displacement, ContinuousFunction(mesh))
84      mesh.setX(newx)  
85        
86    time += dt    time += dt
87        

Legend:
Removed from v.2793  
changed lines
  Added in v.4848

  ViewVC Help
Powered by ViewVC 1.1.26