/[escript]/trunk/doc/examples/geotutorial/steadystate_variablek.py
ViewVC logotype

Contents of /trunk/doc/examples/geotutorial/steadystate_variablek.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2344 - (show annotations)
Mon Mar 30 02:13:58 2009 UTC (10 years, 4 months ago) by jfenwick
File MIME type: text/x-python
File size: 1605 byte(s)
Change __url__ to launchpad site

1 ########################################################
2 #
3 # Copyright (c) 2003-2008 by University of Queensland
4 # Earth Systems Science Computational Center (ESSCC)
5 # http://www.uq.edu.au/esscc
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 ########################################################
12
13 __copyright__="""Copyright (c) 2003-2008 by University of Queensland
14 Earth Systems Science Computational Center (ESSCC)
15 http://www.uq.edu.au/esscc
16 Primary Business: Queensland, Australia"""
17 __license__="""Licensed under the Open Software License version 3.0
18 http://www.opensource.org/licenses/osl-3.0.php"""
19 __url__="https://launchpad.net/escript-finley"
20
21 # import tools
22 from esys.escript import *
23 from esys.escript.linearPDEs import LinearPDE
24 from esys.finley import Rectangle
25 # dimensions:
26 L0=1.;L1=1.;
27 # height of k interface:
28 H=L1*0.75
29 # bottom temperature:
30 T_bot=100
31 # location, size and value of heat source
32 xc=[0.3,0.4]; r=0.1; Qc=3000
33 # two values for k
34 k0=1; k1=10
35 # create domain:
36 mydomain=Rectangle(l0=L0,l1=L1,n0=20,n1=20)
37 x=mydomain.getX()
38 # set variable k
39 k=k0+(k1-k0)*wherePositive(x[1]-H)
40 # boundary temperature
41 T_D=T_bot/L1*(L1-x[1])
42 # heat source
43 Q=Qc*whereNegative(length(x-xc)-r)
44 # create PDE and set coefficients:
45 mypde=LinearPDE(mydomain)
46 mypde.setSymmetryOn()
47 # set PDE coefficients:
48 mypde.setValue(A=k*kronecker(mydomain),Y=Q, r=T_D, \
49 q=whereZero(x[1])+whereZero(x[1]-L1))
50 # get temperature:
51 T=mypde.getSolution()
52 # save to VTK for mayavi:
53 saveVTK("u.xml",T=T)

  ViewVC Help
Powered by ViewVC 1.1.26