Ejemplo n.º 1
0
        cubit.cmd('block ' + str(id_block) +
                  ' attribute index 5 400.0')  # Qkappa
        cubit.cmd('block ' + str(id_block) + ' attribute index 6 200.0')  # Qmu
        cubit.cmd('block ' + str(id_block) +
                  ' attribute index 7 0')  # anisotropy_flag
    else:
        print("domain setup not supported yet, exiting")
        sys.exit(1)

    print("")
    print("exporting to SPECFEM3D-format:")
    print("")
    # Export to SPECFEM3D format
    # for hex27 elements
    if 1 == 1:
        cubit2specfem3d.export2SPECFEM3D('MESH/', hex27=True)
    else:
        cubit2specfem3d.export2SPECFEM3D('MESH/')
    # backup cubit
    cubit.cmd('save as "MESH/meshing.cub" overwrite')
else:
    from geocubitlib import exportlib
    print("")
    print("exporting to SPECFEM3D-format:")
    print("")
    # Export to SPECFEM3D format
    # note: exportlib-commands will overwrite material properties
    # for hex27 elements
    if 1 == 1:
        exportlib.define_blocks(outdir='MESH/',
                                save_cubfile=True,
Ejemplo n.º 2
0
cubit.cmd('block 2 attribute count 6')
cubit.cmd('block 2 attribute index 1 2  ')  # volume 2
cubit.cmd('block 2 attribute index 2 7500 ')
cubit.cmd('block 2 attribute index 3 4300 ')
cubit.cmd('block 2 attribute index 4 3200 ')
cubit.cmd('block 2 attribute index 5 9999.0 ')
cubit.cmd('block 2 attribute index 6 0 ')  # anisotropy_flag

cubit.cmd('block 3 name "elastic 2" ')  # material region
cubit.cmd('block 3 attribute count 6')
cubit.cmd('block 3 attribute index 1 3  ')  # same properties as for volume 2
cubit.cmd('block 3 attribute index 2 7500 ')
cubit.cmd('block 3 attribute index 3 4300 ')
cubit.cmd('block 3 attribute index 4 3200 ')
cubit.cmd('block 3 attribute index 5 9999.0 ')
cubit.cmd('block 3 attribute index 6 0 ')  # anisotropy_flag

cubit.cmd('export mesh "' + CUBIToutput + '/top.e" dimension 3 overwrite')
cubit.cmd('save as "' + CUBIToutput + '/top.cub" overwrite')

#### Export to SPECFEM3D format using cubit2specfem3d.py of GEOCUBIT

# file export

cubit2specfem3d.export2SPECFEM3D(SEMoutput)

# screen shot
cubit.cmd('hardcopy "' + CUBIToutput + '/waterlayer_fig8.png" png')

# all files needed by SCOTCH are now in directory MESH
Ejemplo n.º 3
0
# Define material properties
print "#### DEFINE MATERIAL PROPERTIES #######################"

# elastic model
cubit.cmd('block '+str(id_block)+' name "elastic tomography_model.xyz 1" ')        # elastic material region
cubit.cmd('block '+str(id_block)+' attribute count 2')
cubit.cmd('block '+str(id_block)+' attribute index 1 -1')      # flag for material: -1 for 1. undefined material
cubit.cmd('block '+str(id_block)+' attribute index 2 2')      # flag for tomographic model

# acoustic model
#cubit.cmd('block '+str(id_block)+' name "acoustic tomographic 1" ')       # acoustic material region
#cubit.cmd('block '+str(id_block)+' attribute count 2')
#cubit.cmd('block '+str(id_block)+' attribute index 1 -1')     # material 1
#cubit.cmd('block '+str(id_block)+' attribute index 2 2')      # tomographic model flag

# creates MESH/ directory for file output
os.system('mkdir -p MESH')
cubit.cmd('export mesh "MESH/top.e" dimension 3 overwrite')
cubit.cmd('save as "MESH/meshing.cub" overwrite')

# Export to SPECFEM3D format

#note: exportlib-commands will overwrite the above material properties
# exportlib.collect(outdir='MESH/')
# exportlib.e2SEM(outdir='MESH/')

cubit2specfem3d.export2SPECFEM3D('MESH/')

# all files needed by xdecompose_mesh are now in directory MESH/
Ejemplo n.º 4
0
    cubit.cmd('block '+str(id_block)+' attribute index 4 2300')   # rho
    cubit.cmd('block '+str(id_block)+' attribute index 5 9999.0')  # Qkappa
    cubit.cmd('block '+str(id_block)+' attribute index 6 9000.0')  # Qmu
    cubit.cmd('block '+str(id_block)+' attribute index 7 0')      # anisotropy_flag
    # acoustic material
    #cubit.cmd('block '+str(id_block)+' name "acoustic 1" ')       # acoustic material region
    #cubit.cmd('block '+str(id_block)+' attribute count 4')
    #cubit.cmd('block '+str(id_block)+' attribute index 1 1  ')     # material 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
    nummaterial_velocity_file='MESH/nummaterial_velocity_file'
cubit.cmd('block 2 attribute index 6 0 ')     # anisotropy_flag

cubit.cmd('block 3 name "elastic 3" ')        # elastic material region
cubit.cmd('block 3 attribute count 6')
cubit.cmd('block 3 attribute index 1 3  ')      # same properties as for volume 2
cubit.cmd('block 3 attribute index 2 7500 ')
cubit.cmd('block 3 attribute index 3 4300 ')
cubit.cmd('block 3 attribute index 4 3200 ')
cubit.cmd('block 3 attribute index 5 9000.0 ')
cubit.cmd('block 3 attribute index 6 0 ')     # anisotropy_flag

cubit.cmd('export mesh "' + CUBIToutput + '/top.e" dimension 3 overwrite')
cubit.cmd('save as "' + CUBIToutput + '/top.cub" overwrite')

#### Export to SPECFEM3D format using cubit2specfem3d.py of GEOCUBIT

cubit2specfem3d.export2SPECFEM3D(SEMoutput)

# screen shot
# (could crash version < 16.4)
if version_major >= 16 and version_minor >= 4:
    cubit.cmd('view top')
    cubit.cmd('hardcopy "' + CUBIToutput + '/layered-fig8.png" png')

# all files needed by SCOTCH are now in directory MESH