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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 4154 - (show annotations)
Tue Jan 22 09:30:23 2013 UTC (6 years, 9 months ago) by jfenwick
File MIME type: text/x-python
File size: 2112 byte(s)
Round 1 of copyright fixes
1
2 ##############################################################################
3 #
4 # Copyright (c) 2003-2013 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 since 2012 by School of Earth Sciences
13 #
14 ##############################################################################
15
16 __copyright__="""Copyright (c) 2003-2013 by University of Queensland
17 http://www.uq.edu.au
18 Primary Business: Queensland, Australia"""
19 __license__="""Licensed under the Open Software License version 3.0
20 http://www.opensource.org/licenses/osl-3.0.php"""
21 __url__="https://launchpad.net/escript-finley"
22
23 from esys.escript import *
24 from esys.escript.linearPDEs import LinearPDE
25 from esys.finley import Brick
26 from esys.weipa import saveVTK
27 #... set some parameters ...
28 lam=1.
29 mu=0.1
30 alpha=1.e-6
31 xc=[0.3,0.3,1.]
32 beta=8.
33 T_ref=0.
34 T_0=1.
35 #... generate domain ...
36 mydomain = Brick(l0=1.,l1=1., l2=1.,n0=10, n1=10, n2=10)
37 x=mydomain.getX()
38 #... set temperature ...
39 T=T_0*exp(-beta*length(x-xc))
40 #... open symmetric PDE ...
41 mypde=LinearPDE(mydomain)
42 mypde.setSymmetryOn()
43 #... set coefficients ...
44 C=Tensor4(0.,Function(mydomain))
45 for i in range(mydomain.getDim()):
46 for j in range(mydomain.getDim()):
47 C[i,i,j,j]+=lam
48 C[i,j,i,j]+=mu
49 C[i,j,j,i]+=mu
50 msk=whereZero(x[0])*[1.,0.,0.] \
51 +whereZero(x[1])*[0.,1.,0.] \
52 +whereZero(x[2])*[0.,0.,1.]
53 sigma0=(lam+2./3.*mu)*alpha*(T-T_ref)*kronecker(mydomain)
54 mypde.setValue(A=C,X=sigma0,q=msk)
55 mypde.getSolverOptions().setVerbosityOn()
56 #... solve pde ...
57 u=mypde.getSolution()
58 #... calculate von-Misses
59 g=grad(u)
60 sigma=mu*(g+transpose(g))+lam*trace(g)*kronecker(mydomain)-sigma0
61 sigma_mises=sqrt(((sigma[0,0]-sigma[1,1])**2+(sigma[1,1]-sigma[2,2])**2+ \
62 (sigma[2,2]-sigma[0,0])**2)/2. \
63 +3*(sigma[0,1]**2 + sigma[1,2]**2 + sigma[2,0]**2))
64 #... output ...
65 saveVTK("deform.vtu",disp=u,stress=sigma_mises)
66

Properties

Name Value
svn:mergeinfo /branches/lapack2681/doc/examples/usersguide/heatedblock.py:2682-2741 /branches/pasowrap/doc/examples/usersguide/heatedblock.py:3661-3674 /branches/py3_attempt2/doc/examples/usersguide/heatedblock.py:3871-3891 /branches/restext/doc/examples/usersguide/heatedblock.py:2610-2624 /branches/ripleygmg_from_3668/doc/examples/usersguide/heatedblock.py:3669-3791 /branches/symbolic_from_3470/doc/examples/usersguide/heatedblock.py:3471-3974 /branches/symbolic_from_3470/ripley/test/python/doc/examples/usersguide/heatedblock.py:3517-3974 /trunk/doc/examples/usersguide/heatedblock.py:1388-2483 /trunk/ripley/test/python/doc/examples/usersguide/heatedblock.py:3480-3515

  ViewVC Help
Powered by ViewVC 1.1.26