コード例 #1
0
if use_explicit == 1:
    from geocubitlib import boundary_definition
    # sets the id of the volume block
    # (volume block starts at id 4)
    id_block = 1
    print("cubit block:")
    print("  volume block id = " + str(id_block))
    print("")
    # for hex27 elements
    if 1 == 1:
        cubit.cmd('block ' + str(id_block) + ' vol 1 ')
        cubit.cmd('block ' + str(id_block) + ' element type hex27')
        cubit.cmd('reset block ' + str(id_block))
    # bounding faces
    boundary_definition.entities = ['face']
    boundary_definition.define_bc(boundary_definition.entities, parallel=True)
    from geocubitlib import cubit2specfem3d
    print("")
    print("material properties: assigned as block attributes")
    print("")
    # Define material properties
    print("#### DEFINE MATERIAL PROPERTIES #######################")
    if domain_id == 1:
        # acoustic material
        cubit.cmd('block ' + str(id_block) +
                  ' name "acoustic 1" ')  # acoustic material region
        cubit.cmd('block ' + str(id_block) + ' attribute count 7')
        cubit.cmd('block ' + str(id_block) +
                  ' attribute index 1 1  ')  # material 1
        cubit.cmd('block ' + str(id_block) +
                  ' attribute index 2 1480 ')  # vp (1480 == ocean)
コード例 #2
0
ファイル: create_mesh.py プロジェクト: AlaaHadji/specfem3d
#
# GEOCUBIT
#
# adds path to geocubit (if not setup yet)
sys.path.append('../../CUBIT_GEOCUBIT/')

print "path: "
print sys.path
print ""

##
from geocubitlib import boundary_definition

# bounding faces
boundary_definition.entities=['face']
boundary_definition.define_bc(boundary_definition.entities,parallel=True)

# creates MESH/ directory for file output
os.system('mkdir -p MESH')

# conversion to specfem-format
# use_explicit will explicitly assign material properties as block attributes
use_explicit=0

if use_explicit == 1:
    from geocubitlib import cubit2specfem3d
    print ""
    print "material properties: assigned as block attributes"
    print ""
    # sets the id of the volume block
    # (volume block starts at id 4)
コード例 #3
0
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')


コード例 #4
0
#!/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='.')