# Contents of /trunk/pycad/examples/trapezoid.py

Revision 2344 - (show annotations)
Mon Mar 30 02:13:58 2009 UTC (10 years, 5 months ago) by jfenwick
File MIME type: text/x-python
File size: 1805 byte(s)
```Change __url__ to launchpad site

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

 ViewVC Help Powered by ViewVC 1.1.26