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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2881 - (show annotations)
Thu Jan 28 02:03:15 2010 UTC (9 years, 4 months ago) by jfenwick
File MIME type: text/x-python
File size: 1743 byte(s)
Don't panic.
Updating copyright stamps

1 ########################################################
2 #
3 # Copyright (c) 2003-2010 by University of Queensland
4 # Earth Systems Science Computational Center (ESSCC)
5 # http://www.uq.edu.au/esscc
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 ########################################################
12
13 __copyright__="""Copyright (c) 2003-2010 by University of Queensland
14 Earth Systems Science Computational Center (ESSCC)
15 http://www.uq.edu.au/esscc
16 Primary Business: Queensland, Australia"""
17 __license__="""Licensed under the Open Software License version 3.0
18 http://www.opensource.org/licenses/osl-3.0.php"""
19 __url__="https://launchpad.net/escript-finley"
20
21 from esys.pycad import *
22 from esys.pycad.gmsh import Design
23 from esys.finley import MakeDomain
24
25 # A trapezoid
26 p0=Point(0.0, 0.0, 0.0)
27 p1=Point(1.0, 0.0, 0.0)
28 p2=Point(1.0, 0.5, 0.0)
29 p3=Point(0.0, 1.0, 0.0)
30 l01=Line(p0, p1)
31 l12=Line(p1, p2)
32 l23=Line(p2, p3)
33 l30=Line(p3, p0)
34 c=CurveLoop(l01, l12, l23, l30)
35
36 # A small triangular cutout
37 x0=Point(0.1, 0.1, 0.0)
38 x1=Point(0.5, 0.1, 0.0)
39 x2=Point(0.5, 0.2, 0.0)
40 x01=Line(x0, x1)
41 x12=Line(x1, x2)
42 x20=Line(x2, x0)
43 cutout=CurveLoop(x01, x12, x20)
44
45 # Create the surface with cutout
46 s=PlaneSurface(c, holes=[cutout])
47
48 # Create a Design which can make the mesh
49 d=Design(dim=2, element_size=0.05)
50
51 # Add the trapezoid with cutout
52 d.addItems(s)
53
54 # Create the geometry, mesh and Escript domain
55 d.setScriptFileName("trapezoid.geo")
56 d.setMeshFileName("trapezoid.msh")
57 domain=MakeDomain(d, integrationOrder=-1, reducedIntegrationOrder=-1, optimizeLabeling=True)
58
59 # Create a file that can be read back in to python with
60 domain.write("trapezoid.fly")

  ViewVC Help
Powered by ViewVC 1.1.26