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

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

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 5287 by jfenwick, Wed Apr 9 05:41:57 2014 UTC revision 5288 by sshaw, Tue Dec 2 23:18:40 2014 UTC
# Line 1  Line 1 
1  from __future__ import division  from __future__ import division, print_function
 from __future__ import print_function  
2  ##############################################################################  ##############################################################################
3  #  #
4  # Copyright (c) 2009-2014 by University of Queensland  # Copyright (c) 2009-2014 by University of Queensland
# Line 36  Author: Antony Hallam antony.hallam@uqco Line 35  Author: Antony Hallam antony.hallam@uqco
35  from esys.pycad import * #domain constructor  from esys.pycad import * #domain constructor
36  from esys.pycad.extras import layer_cake  from esys.pycad.extras import layer_cake
37  from esys.pycad.gmsh import Design #Finite Element meshing package  from esys.pycad.gmsh import Design #Finite Element meshing package
 from esys.finley import MakeDomain #Converter for escript  
38  from esys.escript import mkDir, getMPISizeWorld  from esys.escript import mkDir, getMPISizeWorld
39  import os  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  ########################################################MPI WORLD CHECK
47  if getMPISizeWorld() > 1:  if getMPISizeWorld() > 1:
48      import sys      import sys
49      print("This example will not run in an MPI world.")      print("This example will not run in an MPI world.")
50      sys.exit(0)      sys.exit(0)
51    
52  # make sure path exists  if HAVE_FINLEY:
53  save_path= os.path.join("data","example11")      # make sure path exists
54  mkDir(save_path)      save_path= os.path.join("data","example11")
55        mkDir(save_path)
56  ################################################ESTABLISHING PARAMETERS  
57  #Model Parameters      ################################################ESTABLISHING PARAMETERS
58  xwidth=500.0   #x width of model      #Model Parameters
59  ywidth=500.0   #y width of model      xwidth=500.0   #x width of model
60  depth=250.0   #depth of model      ywidth=500.0   #y width of model
61  element_size=5.0      depth=250.0   #depth of model
62        element_size=5.0
63  intfaces=[50,100,200,250]  
64        intfaces=[50,100,200,250]
65  #Specify the domain.  
66  domaindes=Design(dim=3,element_size=element_size,order=1)      #Specify the domain.
67  cmplx_domain=layer_cake(domaindes,xwidth,ywidth,intfaces)      domaindes=Design(dim=3,element_size=element_size,order=1)
68  cmplx_domain.setScriptFileName(os.path.join(save_path,"example11lc.geo"))      cmplx_domain=layer_cake(domaindes,xwidth,ywidth,intfaces)
69  cmplx_domain.setMeshFileName(os.path.join(save_path,"example11lc.msh"))      cmplx_domain.setScriptFileName(os.path.join(save_path,"example11lc.geo"))
70  dcmplx=MakeDomain(cmplx_domain)      cmplx_domain.setMeshFileName(os.path.join(save_path,"example11lc.msh"))
71  dcmplx.write(os.path.join(save_path,"example11lc.fly"))      dcmplx=MakeDomain(cmplx_domain)
72        dcmplx.write(os.path.join(save_path,"example11lc.fly"))
73    
74    
75    

Legend:
Removed from v.5287  
changed lines
  Added in v.5288

  ViewVC Help
Powered by ViewVC 1.1.26