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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 5288 - (hide annotations)
Tue Dec 2 23:18:40 2014 UTC (4 years, 10 months ago) by sshaw
File MIME type: text/x-python
File size: 1933 byte(s)
fixing tests for cases where required domains not built
1 jfenwick 4853 from __future__ import division
2 jfenwick 3981 ##############################################################################
3 gross 3629 #
4 jfenwick 4657 # Copyright (c) 2003-2014 by University of Queensland
5 jfenwick 3981 # http://www.uq.edu.au
6 gross 3629 #
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 jfenwick 3981 # Development until 2012 by Earth Systems Science Computational Center (ESSCC)
12 jfenwick 4657 # Development 2012-2013 by School of Earth Sciences
13     # Development from 2014 by Centre for Geoscience Computing (GeoComp)
14 jfenwick 3981 #
15     ##############################################################################
16 gross 3629
17 jfenwick 4657 __copyright__="""Copyright (c) 2003-2014 by University of Queensland
18 jfenwick 3981 http://www.uq.edu.au
19 gross 3629 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 sshaw 5288 try:
27     from esys.finley import Rectangle
28     HAVE_FINLEY = True
29     except ImportError:
30     HAVE_FINLEY = False
31 gross 3629 from esys.weipa import saveVTK
32    
33 sshaw 5288 if not HAVE_FINLEY:
34     print("Finley module not available")
35     else:
36     # generate domain:
37     mydomain = Rectangle(l0=2.,l1=1.,n0=40, n1=20)
38     # normal flux is given
39     x = mydomain.getX()
40 gross 3629
41 sshaw 5288 # set location of fixed pressure and flux:
42     p_BC=whereZero(x[1]-1.)*wherePositive(x[0]-1.)
43     u_BC=(whereZero(x[0])+whereZero(x[0]-2.)) * [1.,0.] + \
44     (whereZero(x[1]) + whereZero(x[1]-1.)*whereNonPositive(x[0]-1.0)) * [0., 1.]
45 gross 3629
46 sshaw 5288 # define darcy flow solver:
47     mypde = DarcyFlow(domain=mydomain)
48 gross 3629
49 sshaw 5288 mypde.setValue(g=[0., 2],
50     location_of_fixed_pressure=p_BC,
51     location_of_fixed_flux=u_BC,
52     permeability=100.)
53 gross 3629
54 sshaw 5288 u,p=mypde.solve(u0=x[1]*[0., -1.], p0=0)
55 gross 3629
56 sshaw 5288 # write u to an external file
57     saveVTK("u.vtu",flux=u, pressure=p)
58    

  ViewVC Help
Powered by ViewVC 1.1.26