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

Revision 579 - (hide annotations)
Tue Mar 7 01:28:23 2006 UTC (12 years, 11 months ago) by gross
Original Path: trunk/doc/user/examples/heatedblock.py
File MIME type: text/x-python
File size: 1220 byte(s)
```new section on lame equation completed
```
 1 gross 579 # \$Id\$ 2 gross 578 from esys.escript import * 3 from esys.escript.linearPDEs import LinearPDE 4 gross 579 from esys.finley import Brick 5 gross 578 #... set some parameters ... 6 gross 579 lam=1. 7 mu=0.1 8 alpha=1.e-6 9 xc=[0.3,0.3,1.] 10 beta=8. 11 T_ref=0. 12 T_0=1. 13 gross 578 #... generate domain ... 14 gross 579 mydomain = Brick(l0=1.,l1=1., l2=1.,n0=10, n1=10, n2=10) 15 x=mydomain.getX() 16 #... set temperature ... 17 T=T_0*exp(-beta*length(x-xc)) 18 #... open symmetric PDE ... 19 gross 578 mypde=LinearPDE(mydomain) 20 mypde.setSymmetryOn() 21 gross 579 #... set coefficients ... 22 C=Tensor4(0.,Function(mydomain)) 23 for i in range(mydomain.getDim()): 24 for j in range(mydomain.getDim()): 25 C[i,i,j,j]+=lam 26 C[j,i,j,i]+=mu 27 C[j,i,i,j]+=mu 28 msk=whereZero(x[0])*[1.,0.,0.] \ 29 +whereZero(x[1])*[0.,1.,0.] \ 30 +whereZero(x[2])*[0.,0.,1.] 31 sigma0=(lam+2./3.*mu)*alpha*(T-T_ref)*kronecker(mydomain) 32 mypde.setValue(A=C,X=sigma0,q=msk) 33 #... solve pde ... 34 gross 578 u=mypde.getSolution() 35 gross 579 #... calculate von-Misses 36 g=grad(u) 37 sigma=mu*(g+transpose(g))+lam*trace(g)*kronecker(mydomain)-sigma0 38 sigma_mises=sqrt(((sigma[0,0]-sigma[1,1])**2+(sigma[1,1]-sigma[2,2])**2+ \ 39 (sigma[2,2]-sigma[0,0])**2)/6. \ 40 +sigma[0,1]**2 + sigma[1,2]**2 + sigma[2,0]**2) 41 #... output ... 42 saveVTK("deform.xml",disp=u,stress=sigma_mises) 43 gross 578