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

Annotation of /trunk/doc/examples/geotutorial/steadystate.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 6756 - (hide annotations)
Thu Nov 29 07:23:43 2018 UTC (2 years, 10 months ago) by aellery
File MIME type: text/x-python
File size: 1895 byte(s)
Temporarily undoing last commit.
1 jfenwick 4853 from __future__ import division
2 jfenwick 3981 ##############################################################################
3 gross 2156 #
4 jfenwick 6651 # Copyright (c) 2003-2018 by The University of Queensland
5 jfenwick 3981 # http://www.uq.edu.au
6 gross 2156 #
7     # Primary Business: Queensland, Australia
8 jfenwick 6112 # Licensed under the Apache License, version 2.0
9     # http://www.apache.org/licenses/LICENSE-2.0
10 gross 2156 #
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 2156
17 jfenwick 6651 __copyright__="""Copyright (c) 2003-2018 by The University of Queensland
18 jfenwick 3981 http://www.uq.edu.au
19 gross 2156 Primary Business: Queensland, Australia"""
20 jfenwick 6112 __license__="""Licensed under the Apache License, version 2.0
21     http://www.apache.org/licenses/LICENSE-2.0"""
22 jfenwick 2344 __url__="https://launchpad.net/escript-finley"
23 gross 2156
24     # import tools
25     from esys.escript import *
26     from esys.escript.linearPDEs import LinearPDE
27 sshaw 5288 try:
28     from esys.dudley import Rectangle
29     HAVE_DUDLEY = True
30     except ImportError:
31     HAVE_DUDLEY = False
32 caltinay 3346 from esys.weipa import saveVTK
33 caltinay 2534
34 sshaw 5288 if not HAVE_DUDLEY:
35     print("Dudley module not available")
36     else:
37     # set dimensions
38     L0=1.;L1=1.
39     # bottom temperature:
40     T_bot=100
41     # location, size and value of heat source
42     xc=[0.3,0.4]; r=0.1; Qc=3000
43     # create domain
44     mydomain=Rectangle(l0=L0,l1=L1,n0=20,n1=20)
45     x=mydomain.getX()
46     k=1
47     # temperature for boundary condition
48     T_D=T_bot/L1*(L1-x[1])
49     # heat source
50     Q=Qc*whereNegative(length(x-xc)-r)
51     # create PDE:
52     mypde=LinearPDE(mydomain)
53     mypde.setSymmetryOn()
54     # set coefficients:
55     mypde.setValue(A=k*kronecker(mydomain),Y=Q, r=T_D, \
56     q=whereZero(x[1])+whereZero(x[1]-L1))
57     # get temperature:
58     T=mypde.getSolution()
59     # write to file:
60     saveVTK("u.vtu",T=T)
61    

  ViewVC Help
Powered by ViewVC 1.1.26