/[escript]/trunk/doc/examples/cookbook/example11m.py
ViewVC logotype

Contents of /trunk/doc/examples/cookbook/example11m.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 5288 - (show annotations)
Tue Dec 2 23:18:40 2014 UTC (4 years, 9 months ago) by sshaw
File MIME type: text/x-python
File size: 2588 byte(s)
fixing tests for cases where required domains not built
1 from __future__ import division, print_function
2 ##############################################################################
3 #
4 # Copyright (c) 2009-2014 by University of Queensland
5 # http://www.uq.edu.au
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 # Development until 2012 by Earth Systems Science Computational Center (ESSCC)
12 # Development 2012-2013 by School of Earth Sciences
13 # Development from 2014 by Centre for Geoscience Computing (GeoComp)
14 #
15 ##############################################################################
16
17 __copyright__="""Copyright (c) 2009-2014 by University of Queensland
18 http://www.uq.edu.au
19 Primary Business: Queensland, Australia"""
20 __license__="""Licensed under the Open Software License version 3.0
21 http://www.opensource.org/licenses/osl-3.0.php"""
22 __url__="https://launchpad.net/escript-finley"
23
24 """
25 Author: Antony Hallam antony.hallam@uqconnect.edu.au
26 """
27
28
29 ############################################################FILE HEADER
30 # example09m.py
31 # Create a simple 3D model for use in example09. This is the low res
32 # mesh for illustration purposes only.
33 #
34 #######################################################EXTERNAL MODULES
35 from esys.pycad import * #domain constructor
36 from esys.pycad.extras import layer_cake
37 from esys.pycad.gmsh import Design #Finite Element meshing package
38 from esys.escript import mkDir, getMPISizeWorld
39 import os
40 try:
41 from esys.finley import MakeDomain
42 HAVE_FINLEY = True
43 except ImportError:
44 print("Finley module not available")
45 HAVE_FINLEY = False
46 ########################################################MPI WORLD CHECK
47 if getMPISizeWorld() > 1:
48 import sys
49 print("This example will not run in an MPI world.")
50 sys.exit(0)
51
52 if HAVE_FINLEY:
53 # make sure path exists
54 save_path= os.path.join("data","example11")
55 mkDir(save_path)
56
57 ################################################ESTABLISHING PARAMETERS
58 #Model Parameters
59 xwidth=500.0 #x width of model
60 ywidth=500.0 #y width of model
61 depth=250.0 #depth of model
62 element_size=5.0
63
64 intfaces=[50,100,200,250]
65
66 #Specify the domain.
67 domaindes=Design(dim=3,element_size=element_size,order=1)
68 cmplx_domain=layer_cake(domaindes,xwidth,ywidth,intfaces)
69 cmplx_domain.setScriptFileName(os.path.join(save_path,"example11lc.geo"))
70 cmplx_domain.setMeshFileName(os.path.join(save_path,"example11lc.msh"))
71 dcmplx=MakeDomain(cmplx_domain)
72 dcmplx.write(os.path.join(save_path,"example11lc.fly"))
73
74
75
76

  ViewVC Help
Powered by ViewVC 1.1.26