def mesh_analysis(self, frequency):
        from sets import Set
        cubit.cmd('set info off')
        cubit.cmd('set echo off')
        cubit.cmd('set journal off')
        bins_d = [0.0001] + range(0, int(frequency) + 1) + [1000]
        bins_u = bins_d[1:]
        dt = []
        ed_dt = []
        r = []
        ed_r = []
        nstart = cubit.get_next_sideset_id()
        command = "del sideset all"
        cubit.cmd(command)
        for bin_d, bin_u in zip(bins_d, bins_u):
            nsideset = cubit.get_next_sideset_id()
            command = 'create sideset ' + str(nsideset)
            cubit.cmd(command)
            command = "sideset " + str(nsideset) + " name " + "'ratio-[" + str(
                bin_d) + "_" + str(bin_u) + "['"
            cubit.cmd(command)
        nend = cubit.get_next_sideset_id()
        sidelist = range(nstart, nend)
        for block in self.block_mat:
            name = cubit.get_exodus_entity_name('block', block)
            velocity = self.material[name][1]
            if velocity > 0:
                faces = cubit.get_block_faces(block)
                edges = []
                for face in faces:
                    es = cubit.get_sub_elements("face", face, 1)
                    edges = edges + list(es)
                edges = Set(edges)
                dtstore,edgedtstore,ratiostore,edgeratiostore=self.seismic_resolution(edges,\
                                                              velocity,bins_d,bins_u,sidelist)
                dt.append(dtstore)
                ed_dt.append(edgedtstore)
                r.append(ratiostore)
                ed_r.append(edgeratiostore)
        self.ddt = zip(ed_dt, dt)
        self.dr = zip(ed_r, r)

        def sorter(x, y):
            return cmp(x[1], y[1])

        self.ddt.sort(sorter)
        self.dr.sort(sorter)
        print self.ddt, self.dr
        print 'Deltat minimum => edge:' + str(self.ddt[0][0]) + ' dt: ' + str(
            self.ddt[0][1])
        print 'minimum frequency resolved => edge:' + str(
            self.dr[0][0]) + ' frequency: ' + str(self.dr[0][1])
        return self.ddt[0], self.dr[0]
Пример #2
0
    def mesh_analysis(self, frequency):
        from sets import Set

        cubit.cmd("set info off")
        cubit.cmd("set echo off")
        cubit.cmd("set journal off")
        bins_d = [0.0001] + range(0, int(frequency) + 1) + [1000]
        bins_u = bins_d[1:]
        dt = []
        ed_dt = []
        r = []
        ed_r = []
        nstart = cubit.get_next_sideset_id()
        command = "del sideset all"
        cubit.cmd(command)
        for bin_d, bin_u in zip(bins_d, bins_u):
            nsideset = cubit.get_next_sideset_id()
            command = "create sideset " + str(nsideset)
            cubit.cmd(command)
            command = "sideset " + str(nsideset) + " name " + "'ratio-[" + str(bin_d) + "_" + str(bin_u) + "['"
            cubit.cmd(command)
        nend = cubit.get_next_sideset_id()
        sidelist = range(nstart, nend)
        for block in self.block_mat:
            name = cubit.get_exodus_entity_name("block", block)
            velocity = self.material[name][1]
            if velocity > 0:
                faces = cubit.get_block_faces(block)
                edges = []
                for face in faces:
                    es = cubit.get_sub_elements("face", face, 1)
                    edges = edges + list(es)
                edges = Set(edges)
                dtstore, edgedtstore, ratiostore, edgeratiostore = self.seismic_resolution(
                    edges, velocity, bins_d, bins_u, sidelist
                )
                dt.append(dtstore)
                ed_dt.append(edgedtstore)
                r.append(ratiostore)
                ed_r.append(edgeratiostore)
        self.ddt = zip(ed_dt, dt)
        self.dr = zip(ed_r, r)

        def sorter(x, y):
            return cmp(x[1], y[1])

        self.ddt.sort(sorter)
        self.dr.sort(sorter)
        print self.ddt, self.dr
        print "Deltat minimum => edge:" + str(self.ddt[0][0]) + " dt: " + str(self.ddt[0][1])
        print "minimum frequency resolved => edge:" + str(self.dr[0][0]) + " frequency: " + str(self.dr[0][1])
        return self.ddt[0], self.dr[0]
Пример #3
0
def makeGeometry(x, y):
    cubit.cmd("reset")
    cubit.cmd('open "circleGeom.trelis"')

    for i in range(0, len(x)):
        cubit.cmd("create vertex " + str(x[i]) + " " + str(y[i]) +
                  " 0 on surface 1")
    V = cubit.get_list_of_free_ref_entities("vertex")
    for i in range(0, len(V)):
        cubit.cmd("imprint volume all with vertex " + str(V[i]))
    cubit.cmd("delete free vertex all")
    cubit.cmd("compress ids")
    for i in range(0, len(V)):
        cubit.cmd("nodeset 1 add vertex " + str(V[i]))
    cubit.cmd("surface all size 0.2")
    cubit.cmd("mesh surf all")
    cubit.cmd("surface all smooth scheme mean ratio cpu 0.1")
    cubit.cmd("smooth surf all")

    cubit.cmd('create group "cf_crease_entities"')
    for i in range(0, len(V)):
        ssID = cubit.get_next_sideset_id()
        N = cubit.get_vertex_node(V[i])
        nodeEdges = cubit.parse_cubit_list('edge', 'in node ' + str(N))
        for e in range(0, len(nodeEdges)):
            cubit.cmd("sideset " + str(ssID) + " add Edge " +
                      str(nodeEdges[e]))
            cubit.cmd("cf_crease_entities add Edge " + str(nodeEdges[e]))
        cubit.cmd("sideset " + str(ssID) + ' name "node_' + str(N) + '_edges"')