except: pass cubit.cmd('reset') cubit.cmd('brick x 67000 y 134000 z 60000') cubit.cmd('volume 1 move x 33500 y 67000 z -30000') cubit.cmd('brick x 67000 y 134000 z 60000') cubit.cmd('volume 2 move x 100500 y 67000 z -30000') cubit.cmd('merge all') # Meshing the volumes elementsize = 3000.0 cubit.cmd('volume 1 size '+str(elementsize)) cubit.cmd('volume 2 size '+str(elementsize)) cubit.cmd('mesh volume 1 2') from geocubitlib import boundary_definition,exportlib # boundary boundary_definition.define_bc(parallel=True) # file export exportlib.collect(outdir=CUBIToutput) exportlib.e2SEM(outdir=SEMoutput) cubit.cmd('save as "meshing.cub" overwrite')
except: output = 'totalmesh_merged' output = output.upper() # collect(menu.cpuxmin, menu.cpuxmax, menu.cpuymin, menu.cpuymax, menu.cpux, menu.cpuy, menu.cubfiles, menu.ckbound_method1, menu.ckbound_method2, menu.merge_tolerance, curverefining=menu.curverefining, outfilename=output, qlog=menu.qlog, export2SPECFEM3D=menu.export2SPECFEM3D, listblock=menu.listblock, listflag=menu.listflag, outdir=menu.SPECFEM3D_output_dir, add_sea=menu.add_sea, decimate=menu.decimate, cpml=menu.cpml, cpml_size=menu.cpml_size, top_absorbing=menu.top_absorbing, hex27=menu.hex27) if menu.export2SPECFEM3D and not menu.collect: from geocubitlib.exportlib import e2SEM print menu.cubfiles
#cubit.cmd('block '+str(id_block)+' attribute index 2 1480 ') # vp #cubit.cmd('block '+str(id_block)+' attribute index 3 0 ') # vs #cubit.cmd('block '+str(id_block)+' attribute index 4 1028 ') # rho (ocean salt water density: print "" print "exporting to SPECFEM3D-format:" print "" # Export to SPECFEM3D format cubit2specfem3d.export2SPECFEM3D('MESH/') else: from geocubitlib import exportlib print "" print "exporting to SPECFEM3D-format:" print "" # Export to SPECFEM3D format # note: exportlib-commands will overwrite material properties exportlib.collect(outdir='MESH/') exportlib.e2SEM('MESH/') # Define material properties print "#### DEFINE MATERIAL PROPERTIES #######################" # elastic material material_cfg=[{'material region':'2','id_block':'1','vp':'2800','vs':'1500','rho':'2300','Qkappa':'9990.0','Qmu':'9000.0','anisotropy_flag':'0'}] # modifies material file nummaterial_velocity_file='MESH/nummaterial_velocity_file' f=open(nummaterial_velocity_file,'w') for block in material_cfg: print block s=block['material region']+' ' s=s+block['id_block']+' ' s=s+block['rho']+' ' s=s+block['vp']+' ' s=s+block['vs']+' '
#GEOMETRY if menu.build_surface: from geocubitlib import surfaces surfaces.surfaces() if menu.build_volume: from geocubitlib import volumes volumes.volumes() #MESHING if menu.meshing: from geocubitlib import mesh_volume mesh_volume.mesh() #MERGING and EXPORTING if menu.collect: from geocubitlib.exportlib import collect try: output=menu.output except: output='totalmesh_merged' output=output.upper() # collect(menu.cpuxmin,menu.cpuxmax,menu.cpuymin,menu.cpuymax,menu.cpux,menu.cpuy,menu.cubfiles,menu.ckbound_method1,menu.ckbound_method2,menu.merge_tolerance,curverefining=menu.curverefining,outfilename=output,qlog=menu.qlog,export2SPECFEM3D=menu.export2SPECFEM3D,listblock=menu.listblock,listflag=menu.listflag,outdir=menu.SPECFEM3D_output_dir,add_sea=menu.add_sea,decimate=menu.decimate,cpml=menu.cpml,cpml_size=menu.cpml_size,top_absorbing=menu.top_absorbing,hex27=menu.hex27) if menu.export2SPECFEM3D and not menu.collect: from geocubitlib.exportlib import e2SEM print menu.cubfiles print 'hex27 ',menu.hex27 e2SEM(files=menu.cubfiles,listblock=menu.listblock,listflag=menu.listflag,outdir=menu.SPECFEM3D_output_dir,hex27=menu.hex27)
#!/usr/bin/env python import cubit try: cubit.init([""]) except: pass cfg='fullpath_myparameterfile.cfg' o='fullpath_specfem3d_meshfiles_outputdir' o1='fullpath_cubit_meshfiles_outputdir' from geocubitlib import volumes, mesh_volume, exportlib volumes.volumes(cfg) mesh_volume.mesh(cfg) exportlib.collect(outdir=o1) #exportlib.e2SEM(outdir=o,listblock=[4],listflag=[-1]) exportlib.e2SEM(outdir=o)
import cubit try: cubit.init([""]) except: pass cubit.cmd('reset') cubit.cmd('brick x 67000 y 134000 z 60000') cubit.cmd('volume 1 move x 33500 y 67000 z -30000') cubit.cmd('brick x 67000 y 134000 z 60000') cubit.cmd('volume 2 move x 100500 y 67000 z -30000') cubit.cmd('merge all') # Meshing the volumes elementsize = 3000.0 cubit.cmd('volume 1 size '+str(elementsize)) cubit.cmd('volume 2 size '+str(elementsize)) cubit.cmd('mesh volume 1 2') from geocubitlib import boundary_definition,exportlib boundary_definition.define_bc(parallel=True) exportlib.collect(outdir='.') exportlib.e2SEM(outdir='.')
#!/usr/bin/env python import cubit try: cubit.init([""]) except: pass cubit.cmd('reset') cubit.cmd('brick x 67000 y 134000 z 60000') cubit.cmd('volume 1 move x 33500 y 67000 z -30000') cubit.cmd('brick x 67000 y 134000 z 60000') cubit.cmd('volume 2 move x 100500 y 67000 z -30000') cubit.cmd('merge all') # Meshing the volumes elementsize = 3000.0 cubit.cmd('volume 1 size ' + str(elementsize)) cubit.cmd('volume 2 size ' + str(elementsize)) cubit.cmd('mesh volume 1 2') from geocubitlib import boundary_definition, exportlib boundary_definition.define_bc(parallel=True) exportlib.collect(outdir='.') exportlib.e2SEM(outdir='.')
#!/usr/bin/env python import cubit try: cubit.init([""]) except: pass cfg = './tomographic_model//tomographic_model.cfg' o = './tomographic_model/specfem3d_mesh_files' o1 = './tomographic_model/cubit_mesh_files' from geocubitlib import volumes, mesh_volume, exportlib volumes.volumes(cfg) mesh_volume.mesh(cfg) exportlib.collect(outdir=o1) exportlib.e2SEM(outdir=o, listblock=[4], listflag=[-1])
#cubit.cmd('block '+str(id_block)+' attribute index 2 1480 ') # vp #cubit.cmd('block '+str(id_block)+' attribute index 3 0 ') # vs #cubit.cmd('block '+str(id_block)+' attribute index 4 1028 ') # rho (ocean salt water density: print "" print "exporting to SPECFEM3D-format:" print "" # Export to SPECFEM3D format cubit2specfem3d.export2SPECFEM3D('MESH/') else: from geocubitlib import exportlib print "" print "exporting to SPECFEM3D-format:" print "" # Export to SPECFEM3D format # note: exportlib-commands will overwrite material properties exportlib.collect(outdir='MESH/') exportlib.e2SEM('MESH/') # Define material properties print "#### DEFINE MATERIAL PROPERTIES #######################" # elastic material material_cfg = [{ 'material region': '2', 'id_block': '1', 'vp': '2800', 'vs': '1500', 'rho': '2300', 'Qkappa': '9990.0', 'Qmu': '9000.0', 'anisotropy_flag': '0' }] # modifies material file
import cubit try: cubit.init([""]) except: pass cubit.cmd('reset') cubit.cmd('brick x 67000 y 134000 z 60000') cubit.cmd('volume 1 move x 33500 y 67000 z -30000') cubit.cmd('brick x 67000 y 134000 z 60000') cubit.cmd('volume 2 move x 100500 y 67000 z -30000') cubit.cmd('merge all') # Meshing the volumes elementsize = 3000.0 cubit.cmd('volume 1 size ' + str(elementsize)) cubit.cmd('volume 2 size ' + str(elementsize)) cubit.cmd('mesh volume 1 2') from geocubitlib import boundary_definition, exportlib # boundary boundary_definition.define_bc(parallel=True) # file export exportlib.collect(outdir=CUBIToutput) exportlib.e2SEM(outdir=SEMoutput) cubit.cmd('save as "meshing.cub" overwrite')