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

Contents of /trunk/doc/examples/usersguide/darcy.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 4853 - (show annotations)
Wed Apr 9 05:41:57 2014 UTC (5 years, 6 months ago) by jfenwick
File MIME type: text/x-python
File size: 1721 byte(s)
Added import division and changed a few / to //

1 from __future__ import division
2 ##############################################################################
3 #
4 # Copyright (c) 2003-2014 by University of Queensland
5 # http://www.uq.edu.au
6 #
7 # Primary Business: Queensland, Australia
8 # Licensed under the Open Software License version 3.0
9 # 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 __copyright__="""Copyright (c) 2003-2014 by University of Queensland
18 http://www.uq.edu.au
19 Primary Business: Queensland, Australia"""
20 __license__="""Licensed under the Open Software License version 3.0
21 http://www.opensource.org/licenses/osl-3.0.php"""
22 __url__="https://launchpad.net/escript-finley"
23
24 from esys.escript import *
25 from esys.escript.models import DarcyFlow
26 from esys.finley import Rectangle
27 from esys.weipa import saveVTK
28 # generate domain:
29 mydomain = Rectangle(l0=2.,l1=1.,n0=40, n1=20)
30 # normal flux is given
31 x = mydomain.getX()
32
33 # set location of fixed pressure and flux:
34 p_BC=whereZero(x[1]-1.)*wherePositive(x[0]-1.)
35 u_BC=(whereZero(x[0])+whereZero(x[0]-2.)) * [1.,0.] + \
36 (whereZero(x[1]) + whereZero(x[1]-1.)*whereNonPositive(x[0]-1.0)) * [0., 1.]
37
38 # define darcy flow solver:
39 mypde = DarcyFlow(domain=mydomain)
40
41 mypde.setValue(g=[0., 2],
42 location_of_fixed_pressure=p_BC,
43 location_of_fixed_flux=u_BC,
44 permeability=100.)
45
46 u,p=mypde.solve(u0=x[1]*[0., -1.], p0=0)
47
48 # write u to an external file
49 saveVTK("u.vtu",flux=u, pressure=p)
50

  ViewVC Help
Powered by ViewVC 1.1.26