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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 6756 - (hide annotations)
Thu Nov 29 07:23:43 2018 UTC (3 months, 3 weeks ago) by aellery
File MIME type: text/x-python
File size: 2504 byte(s)
Temporarily undoing last commit.
1 jfenwick 4853 from __future__ import division
2 jfenwick 3981 ##############################################################################
3 ksteube 1811 #
4 jfenwick 6651 # Copyright (c) 2003-2018 by The University of Queensland
5 jfenwick 3981 # http://www.uq.edu.au
6 ksteube 1811 #
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 ksteube 1811 #
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 ksteube 1811
17 jfenwick 6651 __copyright__="""Copyright (c) 2003-2018 by The University of Queensland
18 jfenwick 3981 http://www.uq.edu.au
19 ksteube 1811 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 ksteube 1811
24 gross 578 from esys.escript import *
25     from esys.escript.linearPDEs import LinearPDE
26 caltinay 3346 from esys.weipa import saveVTK
27 sshaw 5294
28     try:
29     from esys.finley import Brick
30     HAVE_FINLEY = True
31     except ImportError:
32     print("Finley module required but not available")
33     HAVE_FINLEY = False
34    
35     if HAVE_FINLEY:
36    
37     #... set some parameters ...
38     lam=1.
39     mu=0.1
40     alpha=1.e-6
41     xc=[0.3,0.3,1.]
42     beta=8.
43     T_ref=0.
44     T_0=1.
45     #... generate domain ...
46     mydomain = Brick(l0=1.,l1=1., l2=1.,n0=10, n1=10, n2=10)
47     x=mydomain.getX()
48     #... set temperature ...
49     T=T_0*exp(-beta*length(x-xc))
50     #... open symmetric PDE ...
51     mypde=LinearPDE(mydomain)
52     mypde.setSymmetryOn()
53     #... set coefficients ...
54     C=Tensor4(0.,Function(mydomain))
55     for i in range(mydomain.getDim()):
56     for j in range(mydomain.getDim()):
57     C[i,i,j,j]+=lam
58     C[i,j,i,j]+=mu
59     C[i,j,j,i]+=mu
60     msk=whereZero(x[0])*[1.,0.,0.] \
61     +whereZero(x[1])*[0.,1.,0.] \
62     +whereZero(x[2])*[0.,0.,1.]
63     sigma0=(lam+2./3.*mu)*alpha*(T-T_ref)*kronecker(mydomain)
64     mypde.setValue(A=C,X=sigma0,q=msk)
65     mypde.getSolverOptions().setVerbosityOn()
66     #... solve pde ...
67     u=mypde.getSolution()
68     #... calculate von-Misses
69     g=grad(u)
70     sigma=mu*(g+transpose(g))+lam*trace(g)*kronecker(mydomain)-sigma0
71     sigma_mises=sqrt(((sigma[0,0]-sigma[1,1])**2+(sigma[1,1]-sigma[2,2])**2+ \
72     (sigma[2,2]-sigma[0,0])**2)/2. \
73     +3*(sigma[0,1]**2 + sigma[1,2]**2 + sigma[2,0]**2))
74     #... output ...
75     saveVTK("deform.vtu",disp=u,stress=sigma_mises)
76 gross 578

Properties

Name Value
svn:mergeinfo /branches/4.0fordebian/doc/examples/usersguide/heatedblock.py:5567-5588 /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 /branches/trilinos_from_5897/doc/examples/usersguide/heatedblock.py:5898-6118 /release/4.0/doc/examples/usersguide/heatedblock.py:5380-5406 /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