def __init__(self,hex27=False): super(mesh, self).__init__() self.mesh_name='mesh_file' self.nodecoord_name='nodes_coords_file' self.material_name='materials_file' self.nummaterial_name='nummaterial_velocity_file' self.absname='absorbing_surface_file' self.freename='free_surface_file' self.recname='STATIONS' try: version_cubit=float(cubit.get_version()) except: version_cubit=float(cubit.get_version()[0:2]) # if version_cubit >= 12: self.face='SHELL4' else: self.face='QUAD4' self.hex='HEX' self.hex27=hex27 self.edge='BAR2' self.topo='face_topo' self.rec='receivers' if hex27: cubit.cmd('block all except (block 1001 1002 1003 1004 1005 1006) type hex27') self.block_definition() self.ngll=5 self.percent_gll=0.172 self.point_wavelength=5 cubit.cmd('compress all') print 'version hex27'
def get_cubit_version(): v = cubit.get_version() try: v = float(v[0:4]) except: v = float(v[0:2]) return v
print("could not import cubit, please check your PYTHONPATH settings...") print("") print("current path: ") print(sys.path) print("") print( "try to include path to directory which includes file cubit.py, e.g. /opt/Trelis-15.0/bin/" ) print("") sys.exit("Import cubit failed") cubit.init(["-noecho", "-nojournal"]) print("") # gets version string cubit_version = cubit.get_version() print("Cubit version: ", cubit_version) # extracts major number v = cubit_version.split('.') cubit_version_major = int(v[0]) print("major version number: ", cubit_version_major) print("") # current work directory cubit.cmd('pwd') # Creating the volumes cubit.cmd('reset') # single volume
## obsolete: #import boundary_definition #import cubit2specfem3d ## new: from geocubitlib import boundary_definition from geocubitlib import cubit2specfem3d ## CUBIT/Trelis import cubit try: #cubit.init([""]) cubit.init(["-noecho","-nojournal"]) except: pass version = cubit.get_version() version_major = int(version.split(".")[0]) version_minor = int(version.split(".")[1]) print "cubit version: ",version cubit.cmd('reset') cubit.cmd('brick x 134000 y 134000 z 60000') # This seems to conflict with boundary_definition.py # ....which leaves the model space at e.g. x=[-67,67] km cubit.cmd('volume 1 move x 67000 y 67000 z -30000') # create vertices for discontinuity distance = 3000 cubit.cmd('split curve 9 distance '+str(distance)) cubit.cmd('split curve 10 distance '+str(distance))