/[escript]/trunk/pycad/py_src/extras.py
ViewVC logotype

Diff of /trunk/pycad/py_src/extras.py

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

revision 3068 by ahallam, Wed Jul 14 00:18:30 2010 UTC revision 3069 by ahallam, Wed Jul 21 03:24:48 2010 UTC
# Line 43  def buildFreeSurface(xwidth,ywidth): Line 43  def buildFreeSurface(xwidth,ywidth):
43      '''      '''
44      Build a free surface to start the layer cake model.      Build a free surface to start the layer cake model.
45          This surface is planar.          This surface is planar.
46          Parameters:  
47              xwidth :: width in x direction in meters.      Parameters:
48              ywidth :: width in y direction in meters.          xwidth :: width in x direction in meters.\
49            ywidth :: width in y direction in meters.\
50      '''      '''
51    
52      # Layer Corners      # Layer Corners
# Line 71  def buildLayer(xwidth,ywidth,depth,lay_s Line 72  def buildLayer(xwidth,ywidth,depth,lay_s
72      '''      '''
73      Builds a boxlike volume and returns primatives for layered model      Builds a boxlike volume and returns primatives for layered model
74      construction.      construction.
75          Parameters:  
76              xwidth :: width in x direction in meters.      Parameters:
77              ywidth :: width in y direction in meters.          xwidth :: width in x direction in meters.\
78              depth  :: depth to bottom of layer in meters.          ywidth :: width in y direction in meters.\
79              lay_surf :: surface at top of layer (see buildFreeSurf)          depth  :: depth to bottom of layer in meters.\
80              hor_lines :: lines of lay_surf          lay_surf :: surface at top of layer (see buildFreeSurf)\
81              corner_points :: points of hor_lines          hor_lines :: lines of lay_surf\
82            corner_points :: points of hor_lines\
83      '''      '''
84      # Layer Corners      # Layer Corners
85      corner_points.append(Point(0.0,    0.0,    depth))      corner_points.append(Point(0.0,    0.0,    depth))
# Line 112  def buildLayer(xwidth,ywidth,depth,lay_s Line 114  def buildLayer(xwidth,ywidth,depth,lay_s
114      return lay_vol,-lay_surf[1],hor_lines[4:8],corner_points[5:10]      return lay_vol,-lay_surf[1],hor_lines[4:8],corner_points[5:10]
115    
116    
117  def layer_cake(xwidth,ywidth,depths,ele_size):  def layer_cake(domain,xwidth,ywidth,depths):
118      '''      '''
119      Builds a horizontally layered box like model. All layers are      Builds a horizontally layered box like model. All layers are
120      tagged as 'interface_i' where i is the python style integer denoting      tagged as 'interface_i' where i is the python style integer denoting
121      that layer. For example, the free surface is tagged 'interface_0'.      that layer. For example, the free surface is tagged 'interface_0'.
122      Volumes are similarly tagged as 'volume_i'.      Volumes are similarly tagged as 'volume_i'.
123    
124          Parameters:      Parameters:
125              xwidth :: width in x direction in meters.         domain :: output of Pycad.Design - It needs to be dim 3.\
126              ywidth :: width in y direction in meters.         xwidth :: width in x direction in meters.\
127              depth  :: depth to bottom of layer in meters.         ywidth :: width in y direction in meters.\
128              ele_size :: the element meshing size.         depth  :: depth to bottom of layer in meters.\
             fname  :: the output file name.  
         KW Arg:  
             save_path :: path to save outputs.  
129    
130      One may save the domain using:      One may save the domain using:
131          # Output settings.              # Output settings.\    
132          domain.setScriptFileName(os.path.join(save_path,fname+".geo"))          domain.setScriptFileName(os.path.join(save_path,fname+".geo"))\
133          domain.setMeshFileName(os.path.join(save_path,fname+".msh"))          domain.setMeshFileName(os.path.join(save_path,fname+".msh"))\
134          findomain=fin.MakeDomain(domain) #  make the finley domain:          findomain=fin.MakeDomain(domain) #  make the finley domain:\
135            
136          # Create a file that can be read back in to python with          Create a file that can be read back in to python with ReadMesh.\
137          # ReadMesh          findomain.write(os.path.join(save_path,fname+".fly"))\            
         findomain.write(os.path.join(save_path,fname+".fly"))              
138      '''      '''
139            
140      #get number of layers      #get number of layers
141      ndepths=len(depths)      ndepths=len(depths)
142    
143      # Specify the domain.      if domain.getDim() <> 3:
144      domain=Design(dim=3,element_size=ele_size)          raise TypeError("domain must be of dimension order 3.")        
145    
146      # Build the First Surface and add it to the domain      # Build the First Surface and add it to the domain
147      fsuf,fsurl,fsurp=buildFreeSurface(xwidth,ywidth)      fsuf,fsurl,fsurp=buildFreeSurface(xwidth,ywidth)

Legend:
Removed from v.3068  
changed lines
  Added in v.3069

  ViewVC Help
Powered by ViewVC 1.1.26