Пример #1
0
def save_cracks(name, list_surface_up, list_surface_down):
    quads_fault_up = []
    quads_fault_down = []
    for surface in list_surface_up:
        quads_fault = cubit.get_surface_quads(surface)
        quads_fault_up.append(quads_fault)
    for surface in list_surface_down:
        quads_fault = cubit.get_surface_quads(surface)
        quads_fault_down.append(quads_fault)
    # TO DO : stop python properly in case fault nodes at both sides
    #         do not match.
    #   if len(quads_fault_u) != len(quads_fault_d): stop
    #
    # SAVING FAULT ELEMENTS AND NODES
    return quads_fault_up, quads_fault_down
def save_cracks(name,list_surface_up,list_surface_down):
   quads_fault_up = [] 
   quads_fault_down = []
   for surface in list_surface_up   :
       quads_fault = cubit.get_surface_quads(surface)
       quads_fault_up.append(quads_fault)
   for surface in list_surface_down :
       quads_fault = cubit.get_surface_quads(surface)
       quads_fault_down.append(quads_fault)
    # TO DO : stop python properly in case fault nodes at both sides
    #         do not match.
    #   if len(quads_fault_u) != len(quads_fault_d): stop
    #
    # SAVING FAULT ELEMENTS AND NODES
   return quads_fault_up,quads_fault_down
Пример #3
0
#fault_A_elements_down="sideset 201 surface 3"
#cubit.cmd(fault_A_elements_up)
#cubit.cmd(fault_A_elements_down)

########### Fault elements and nodes ###############

os.system('mkdir -p MESH') 

fault_u = 2  # fault surface up   : surface 2
fault_d = 3  # fault surface down : surface 3
txt =''

fault_file=open('MESH/fault_file_1.dat','w')
list_hex=cubit.parse_cubit_list('hex','all')

quads_fault_u = cubit.get_surface_quads(fault_u)
quads_fault_d = cubit.get_surface_quads(fault_d)

# TO DO : stop python properly in case fault nodes at both sides
#         do not match.
if len(quads_fault_u) != len(quads_fault_d):
   stop
# Writting number of elements at both sides to make 
# double sure everything is going fine .
txt='%10i %10i\n' % (len(quads_fault_u),len(quads_fault_d))
fault_file.write(txt)

dic_quads_fault_u = dict(zip(quads_fault_u,quads_fault_u)) 
dic_quads_fault_d = dict(zip(quads_fault_d,quads_fault_d)) 

Пример #4
0
#!/usr/bin/env python
import numpy as np
import cubit, os, sys
cubit.init([''])
cubit.cmd("reset")
cubit.cmd("playback 'Mandel3D_msh.jou'")
cubit.cmd("reset")
cubit.cmd(
    "import mesh geometry './Mandel3D.exo' block all use nodeset sideset")
surf_list = cubit.get_sideset_surfaces(1)
quad_list = [
    cubit.get_surface_quads(surf_list[i]) for i in range(len(surf_list))
]
vol_list = cubit.get_block_volumes(1)
hex_list = [cubit.get_volume_hexes(vol_list[i]) for i in range(len(vol_list))]

trac_el = []
mat_typ = np.ones(shape=(cubit.get_hex_count(), 1), dtype=np.uint8)
for quadset, hexset in zip(quad_list, hex_list):
    for quad in quadset:
        nodes = cubit.get_connectivity("quad", quad)
        for hx in hexset:
            nodes_hx = cubit.get_connectivity("hex", hx)
            if set(nodes).issubset(set(nodes_hx)):
                if set(nodes).issubset(set(np.array(nodes_hx)[[0, 1, 5, 4]])):
                    side = 1
                elif set(nodes).issubset(set(np.array(nodes_hx)[[1, 2, 6,
                                                                 6]])):
                    side = 2
                elif set(nodes).issubset(set(np.array(nodes_hx)[[2, 3, 7,
                                                                 7]])):