[cig-commits] r19117 - seismo/3D/FAULT_SOURCE/branches/new_fault_db/CUBIT

surendra at geodynamics.org surendra at geodynamics.org
Wed Oct 26 17:38:54 PDT 2011


Author: surendra
Date: 2011-10-26 17:38:54 -0700 (Wed, 26 Oct 2011)
New Revision: 19117

Modified:
   seismo/3D/FAULT_SOURCE/branches/new_fault_db/CUBIT/absorbing_boundary.py
Log:
Modified CUBIT script for setting boundaries.  Boundaries can now be set using CUBIT surface number list

Modified: seismo/3D/FAULT_SOURCE/branches/new_fault_db/CUBIT/absorbing_boundary.py
===================================================================
--- seismo/3D/FAULT_SOURCE/branches/new_fault_db/CUBIT/absorbing_boundary.py	2011-10-26 19:14:10 UTC (rev 19116)
+++ seismo/3D/FAULT_SOURCE/branches/new_fault_db/CUBIT/absorbing_boundary.py	2011-10-27 00:38:54 UTC (rev 19117)
@@ -1,4 +1,5 @@
 #!python
+#!python
 # Retrieving absorbing boundaries.
 #    P. Galvez (ETH-Zurich, 10.09.2011):
 #    This function is based on Emmanuele Cassarotti , boundary_definition.py routine. 
@@ -10,83 +11,6 @@
 #    ...
 #    absorbing_surf_bottom is the list of the absorbing boundary surfaces that correspond to z=zmin
 
-class abs_surface:
-   def __init__(self,xmin,xmax,ymin,ymax): 
-       self.xmin = xmin
-       self.xmax = xmax
-       self.ymin = ymin
-       self.ymax = ymax
-
-def define_top_bottom_absorbing_surf(zmin_box,zmax_box):
-    """
-      absorbing_surf_bottom is the list of the absorbing boundary surfaces that correspond to z=zmin
-    """
-    try:
-        cubit.cmd('comment')
-    except:
-        try:
-            import cubit
-            cubit.init([""])
-        except:
-            print 'error importing cubit'
-            import sys
-            sys.exit()
-    absorbing_surf_bottom=[]
-    top_surf = []
-    
-    list_vol=cubit.parse_cubit_list("volume","all")
-    init_n_vol=len(list_vol)
-#   TO DO : Make zmin_box work properly.
-#   zmax_box=cubit.get_total_bounding_box("volume",list_vol)[7]
-#   zmin_box=cubit.get_total_bounding_box("volume",list_vol)[6] #it is the z_min of the box ... box= xmin,xmax,d,ymin,ymax,d,zmin...
-    xmin_box=cubit.get_total_bounding_box("volume",list_vol)[0]
-    xmax_box=cubit.get_total_bounding_box("volume",list_vol)[1]
-    ymin_box=cubit.get_total_bounding_box("volume",list_vol)[3]
-    ymax_box=cubit.get_total_bounding_box("volume",list_vol)[4]
-    list_surf=cubit.parse_cubit_list("surface","all")
-   
-    print '##boundary box: '
-    print '##  x min: ' + str(xmin_box)
-    print '##  y min: ' + str(ymin_box)
-    print '##  z min: ' + str(zmin_box)
-    print '##  x max: ' + str(xmax_box)
-    print '##  y max: ' + str(ymax_box)
-    print '##  z max: ' + str(zmax_box)
-
-    #box lengths
-    x_len = abs( xmax_box - xmin_box)
-    y_len = abs( ymax_box - ymin_box)
-    z_len = abs( zmax_box - zmin_box)
-    
-    print '##boundary box: '
-    print '##  x length: ' + str(x_len)
-    print '##  y length: ' + str(y_len)
-    print '##  z length: ' + str(z_len)
-    
-    # tolerance parameters 
-    absorbing_surface_distance_tolerance=0.005
-    topographic_surface_distance_tolerance=0.001
-    topographic_surface_normal_tolerance=0.2
-
-    for k in list_surf:
-        center_point = cubit.get_center_point("surface", k)
-        if abs((center_point[2] - zmin_box)/z_len) <= absorbing_surface_distance_tolerance:
-             print 'center_point[2]' + str(center_point[2])
-             print 'kz:' + str(k)
-             absorbing_surf_bottom.append(k)
-   
-        else:
-            sbox=cubit.get_bounding_box('surface',k)
-            dz=abs((sbox[7] - zmax_box)/z_len)
-            normal=cubit.get_surface_normal(k)
-            zn=normal[2]
-            dn=abs(zn-1)
-            if dz <= topographic_surface_distance_tolerance and dn < topographic_surface_normal_tolerance:
-                top_surf.append(k)
-    
-    return absorbing_surf_bottom,top_surf
-
-
 def build_block(vol_list,name):
     from sets import Set
     try:
@@ -175,13 +99,9 @@
     cubit.cmd(txt2)
 
 
-def define_bc(entities,zmin,zmax,self):
-     # Temporal : Variable zmin should be obtained automatically. 
-     xmin = self.xmin
-     xmax = self.xmax
-     ymin = self.ymin
-     ymax = self.ymax
-     bottom,topo=define_top_bottom_absorbing_surf(zmin,zmax)
+def define_bc(entities,xmin,xmax,ymin,ymax,zmin,zmax):
+     bottom = zmin
+     topo = zmax
      v_list,name_list=define_block()
      build_block(v_list,name_list)
      print entities
@@ -195,3 +115,4 @@
          build_block_side(topo,entity+'_topo',obj=entity)
 
 
+



More information about the CIG-COMMITS mailing list