/[escript]/trunk/doc/cookbook/heatrefraction_mesher002.py
ViewVC logotype

Contents of /trunk/doc/cookbook/heatrefraction_mesher002.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2588 - (show annotations)
Wed Aug 5 22:42:36 2009 UTC (10 years, 1 month ago) by ahallam
File MIME type: text/x-python
File size: 2428 byte(s)
Heat diffraction initial committal 2 weeks work.
1
2 ########################################################
3 #
4 # Copyright (c) 2003-2009 by University of Queensland
5 # Earth Systems Science Computational Center (ESSCC)
6 # http://www.uq.edu.au/esscc
7 #
8 # Primary Business: Queensland, Australia
9 # Licensed under the Open Software License version 3.0
10 # http://www.opensource.org/licenses/osl-3.0.php
11 #
12 ########################################################
13
14 __copyright__="""Copyright (c) 2003-2009 by University of Queensland
15 Earth Systems Science Computational Center (ESSCC)
16 http://www.uq.edu.au/esscc
17 Primary Business: Queensland, Australia"""
18 __license__="""Licensed under the Open Software License version 3.0
19 http://www.opensource.org/licenses/osl-3.0.php"""
20 __url__="https://launchpad.net/escript-finley"
21
22 """
23 Author: Antony Hallam antony.hallam@uqconnect.edu.au
24 """
25
26 from esys.pycad import *
27 from esys.pycad.gmsh import Design
28 from esys.finley import MakeDomain
29 #import numpy as n
30 from math import *
31
32 # Overall Domain
33 p0=Point(0.0, 0.0, 0.0)
34 p1=Point(0.0, -6000.0, 0.0)
35 p2=Point(5000.0, -6000.0, 0.0)
36 p3=Point(5000.0, 0.0, 0.0)
37
38 l01=Line(p0, p1)
39 l12=Line(p1, p2)
40 l23=Line(p2, p3)
41 l30=Line(p3, p0)
42
43 c=CurveLoop(l01, l12, l23, l30)
44
45 # Material Boundary
46
47 p4=Point(0.0, -2400.0, 0.0)
48 p5=Point(2000.0, -2400.0, 0.0)
49 p6=Point(3000.0, -6000.0, 0.0)
50 p7=Point(5000.0, -2400.0, 0.0)
51
52 # TOP BLOCK
53 tbl1=Line(p0,p4)
54 tbl2=Line(p4,p5)
55 tbl3=Line(p5,p7)
56 tbl4=Line(p7,p3)
57 tblockloop = CurveLoop(tbl1,tbl2,tbl3,tbl4,l30)
58 tblock = PlaneSurface(tblockloop)
59
60 # BOTTOM BLOCK LEFT
61 bbll1=Line(p4,p1)
62 bbll2=Line(p1,p6)
63 bbll3=Line(p6,p5)
64 bbll4=-tbl2
65 bblockloopl = CurveLoop(bbll1,bbll2,bbll3,bbll4)
66 bblockl = PlaneSurface(bblockloopl)
67
68 # BOTTOM BLOCK RIGHT
69 bbrl1=Line(p6,p2)
70 bbrl2=Line(p2,p7)
71 bbrl3=-tbl3
72 bbrl4=-bbll3
73 bblockloopr = CurveLoop(bbrl1,bbrl2,bbrl3,bbrl4)
74 bblockr = PlaneSurface(bblockloopr)
75
76 # Create a Design which can make the mesh
77 d=Design(dim=2, element_size=200)
78 # Add the trapezoid with cutout
79 d.addItems(PropertySet("top",tblock),PropertySet("bottomleft",bblockl),PropertySet("bottomright",bblockr))
80 # Create the geometry, mesh and Escript domain
81 d.setScriptFileName("heatrefraction_mesh003.geo")
82
83 d.setMeshFileName("heatrefraction_mesh003.msh")
84 domain=MakeDomain(d, integrationOrder=-1, reducedIntegrationOrder=-1, optimizeLabeling=True)
85 # Create a file that can be read back in to python with mesh=ReadMesh(fileName)
86 domain.write("heatrefraction_mesh003.fly")
87

  ViewVC Help
Powered by ViewVC 1.1.26