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

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

  ViewVC Help
Powered by ViewVC 1.1.26