예제 #1
0
def main():
    np.set_printoptions(precision=3)
    w = 1
    l = 1
    h = 1
    vrt = np.array \
    ( [ [-w/2, 0, -h/2]
      , [-w/2, 0,  h/2]
      , [ w/2, 0,  h/2]
      , [ w/2, 0, -h/2]
      , [-w/2, l,  0  ]
      , [ w/2, l,  0  ] ] )
    tet = np.array \
    ( [ [0, 1, 3, 5]
      , [1, 2, 3, 5]
      , [0, 1, 4, 5] ] )
    tri = np.array \
    ( [ [0, 1, 4]
      , [2, 3, 5] ] )
    lin = np.array([[0, 3]])
    v2e, bwh = p04.edge_num_banded(tet)
    pgroups = [(p04.racc, p01.isrc(1, [1, 0, 0]), lin),
               (p04.lacc, p01.volume(0, p04.e0, p04.u0), tet),
               (p04.pec, lambda f, p: None, tri)]
    freq = 50
    sol = p04.solve_geom(freq, vrt, pgroups, v2e.nnz, v2e, bwh)
    print(sol)
    print(p04.isrc_v(sol, vrt, lin, v2e, [1, 0, 0]))
    print(1 / (p04.e0 * 0.5 * h * l / w * 2 * np.pi * freq))
예제 #2
0
def main():
    np.set_printoptions(precision=3)
    w = 1
    l = 1
    h = 1
    vrt = np.array \
    ( [ [-w/2, 0, -h/2]
      , [-w/2, 0,  h/2]
      , [ w/2, 0,  h/2]
      , [ w/2, 0, -h/2]
      , [-w/2, l,  0  ]
      , [ w/2, l,  0  ] ] )
    tet = np.array \
    ( [ [0, 1, 3, 5]
      , [1, 2, 3, 5]
      , [0, 1, 4, 5] ] )
    tri = np.array \
    ( [ [0, 1, 4]
      , [2, 3, 5] ] )
    lin = np.array( [ [0, 3] ] )
    v2e, bwh = p04.edge_num_banded(tet)
    pgroups = [ (p04.racc, p01.isrc(3, [1/(0.5*h*l),0,0]), tet)
              , (p04.lacc, p01.volume(1/140e-8, p04.e0, p04.u0), tet) ]
    freq = 50
    sol = p04.solve_geom(freq, vrt, pgroups, v2e.nnz, v2e, bwh)
    print(sol)
    print(p04.isrc_v(sol, vrt, lin, v2e, [1,0,0]))
    print(140e-8*w/(0.5*h*l))
예제 #3
0
def get_mesh():
    gmsh.initialize()
    air_tag, cond_tag, isrc_tag, probe_tag = make_geom()
    print(probe_tag, air_tag, cond_tag, isrc_tag)
    gmsh.model.occ.synchronize()
    probe, isrc, cond, air = assign_physicals(air_tag, cond_tag, isrc_tag,
                                              probe_tag)
    #gmsh.model.mesh.setSize(gmsh.model.getEntities(0), 10)
    #gmsh.option.setNumber("Mesh.Algorithm", 8)
    gmsh.model.mesh.generate(3)
    nodes = gmsh.model.mesh.getNodes()
    gmsh.write('g09.msh2')
    tet = []
    ret_elems = []
    ret_probe = []
    for ntag in gmsh.model.getEntitiesForPhysicalGroup(3, isrc):
        es = gmsh.model.mesh.getElements(3, ntag)
        ns = es[2][0].reshape(-1, 4) - 1
        ns.sort()
        ret_elems.append \
        ( ( p04.racc
          , p01.isrc(3, [0,1/(0.01**2*np.pi),0])
          , ns ) )
        ret_elems.append \
        ( ( p04.lacc
          , p01.volume(0, p04.e0, p04.u0)
          , ns ) )
        tet.append(ns)
    for ntag in gmsh.model.getEntitiesForPhysicalGroup(1, probe):
        es = gmsh.model.mesh.getElements(1, ntag)
        ns = es[2][0].reshape(-1, 2) - 1
        ns.sort()
        ret_probe.append(ns)
    for ntag in gmsh.model.getEntitiesForPhysicalGroup(3, cond):
        es = gmsh.model.mesh.getElements(3, ntag)
        ns = es[2][0].reshape(-1, 4) - 1
        ns.sort()
        ret_elems.append \
        ( ( p04.lacc
          , p01.volume(1/140e-8, p04.e0, p04.u0)
          , ns ) )
        tet.append(ns)
    for ntag in gmsh.model.getEntitiesForPhysicalGroup(3, air):
        es = gmsh.model.mesh.getElements(3, ntag)
        ns = es[2][0].reshape(-1, 4) - 1
        ns.sort()
        ret_elems.append \
        ( ( p04.lacc
          , p01.volume(0, p04.e0, p04.u0)
          , ns ) )
        tet.append(ns)
    gmsh.finalize()
    return nodes[1].reshape(-1, 3), ret_elems, tet, ret_probe
예제 #4
0
def get_mesh():
    gmsh.initialize()
    air_tag, cond_tag, isrc_tags, probe_tag = make_geom()
    print(probe_tag, air_tag, cond_tag, isrc_tags)
    gmsh.model.occ.synchronize()
    probe, isrc, cond, air = assign_physicals(air_tag, cond_tag, isrc_tags,
                                              probe_tag)
    #gmsh.model.mesh.setSize(gmsh.model.getEntities(0), 20)
    gmsh.model.mesh.generate(3)
    nodes = gmsh.model.mesh.getNodes()
    tet = []
    ret_elems = []
    ret_probe = []
    for ntag in gmsh.model.getEntitiesForPhysicalGroup(2, isrc):
        es = gmsh.model.mesh.getElements(2, ntag)
        ns = es[2][0].reshape(-1, 3) - 1
        ns.sort()
        ret_elems.append \
        ( ( p04.racc
          , p01.isrc(2, [0,1/0.02,0])
          , ns ) )
    for ntag in gmsh.model.getEntitiesForPhysicalGroup(1, probe):
        es = gmsh.model.mesh.getElements(1, ntag)
        ns = es[2][0].reshape(-1, 2) - 1
        ns.sort()
        ret_probe.append(ns)
    for ntag in gmsh.model.getEntitiesForPhysicalGroup(3, cond):
        es = gmsh.model.mesh.getElements(3, ntag)
        ns = es[2][0].reshape(-1, 4) - 1
        ns.sort()
        ret_elems.append \
        ( ( p04.lacc
          , p01.volume(1/140e-8, p04.e0, p04.u0)
          , ns ) )
        tet.append(ns)
    for ntag in gmsh.model.getEntitiesForPhysicalGroup(3, air):
        es = gmsh.model.mesh.getElements(3, ntag)
        ns = es[2][0].reshape(-1, 4) - 1
        ns.sort()
        ret_elems.append \
        ( ( p04.lacc
          , p01.volume(0, p04.e0, p04.u0)
          , ns ) )
        tet.append(ns)
    gmsh.finalize()
    return nodes[1].reshape(-1, 3), ret_elems, tet, ret_probe
예제 #5
0
def get_mesh():
    gmsh.initialize()
    air_tag, pec_tags, isrc_tag = make_geom(1, 0.01)
    gmsh.model.occ.synchronize()
    isrc, pec, air = assign_physicals(air_tag, pec_tags, isrc_tag)
   #gmsh.model.mesh.setSize(gmsh.model.getEntities(0), 3)
   #gmsh.model.mesh.setSize(gmsh.model.getEntities(0), 0.7)
    gmsh.model.mesh.setSize(gmsh.model.getEntities(0), 0.1)
   #gmsh.option.setNumber("Mesh.Algorithm", 8)
    gmsh.model.mesh.generate(3)
    nodes = gmsh.model.mesh.getNodes()
    tet = []
    ret_elems = []
    probe = []
    for ntag in gmsh.model.getEntitiesForPhysicalGroup(1, isrc):
        es = gmsh.model.mesh.getElements(1, ntag)
        ns = es[2][0].reshape(-1, 2) - 1
        ns.sort()
        ret_elems.append \
        ( ( p04.racc
          , p01.isrc(1, [0,0,1])
          , ns ) )
        probe.append(ns)
    for ntag in gmsh.model.getEntitiesForPhysicalGroup(2, pec):
        es = gmsh.model.mesh.getElements(2, ntag)
        ns = es[2][0].reshape(-1, 3) - 1
        ns.sort()
        ret_elems.append \
        ( ( p04.lacc
          , p01.absorb
          , ns ) )
    for ntag in gmsh.model.getEntitiesForPhysicalGroup(3, air):
        es = gmsh.model.mesh.getElements(3, ntag)
        ns = es[2][0].reshape(-1, 4) - 1
        ns.sort()
        ret_elems.append \
        ( ( p04.lacc
          , p01.volume(0, p04.e0, p04.u0)
          , ns ) )
        tet.append(ns)
    gmsh.finalize()
    return nodes[1].reshape(-1,3), ret_elems, tet, probe
예제 #6
0
def main():
    np.set_printoptions(precision=3)
    w = 4
    l = 14
    h = 2
    vrt = np.array \
    ( [ [   0, 0, -h/2]
      , [   0, 0,  h/2]
      , [-w/2, l,    0]
      , [ w/2, l,    0] ] )
    tet = np.array \
    ( [ [0, 1, 2, 3] ] )
    lin = np.array([[0, 1]])
    v2e, bwh = p04.edge_num_banded(tet)
    pgroups = [(p04.racc, p01.isrc(1, [0, 0, 1]), tet),
               (p04.lacc, p01.volume(0, p04.e0, p04.u0), tet)]
    freq = 50
    sol = p04.solve_geom(freq, vrt, pgroups, v2e.nnz, v2e, bwh)
    print(sol)
    print(p04.isrc_v(sol, vrt, lin, v2e, [0, 0, 1]))
    print(2 * (1 / freq) / 4 * (2 / np.pi) / (4 * np.pi * p04.e0 * 0.5 * h))