Example #1
0
def ex2():
    ''' DKT esimerkki 1, pyörähdyssymmetrinen laatta jakautuneella kuormalla '''
    t = 25e-3
    E = 100e9
    nu = 0.3
    q = 100e3
    a = 1
    D = E * t**3 / (12 * (1 - nu**2))
    w = lambda r: -a**4 * q * (1 - r**2 / a**2)**2 / (64 * D)
    vmis = lambda r: (36 * D**2 * (a**2 * q * (1 - r**2 / a**2) /
                                   (8 * D) - q * r**2 /
                                   (8 * D))**2 / t**4 - 36 * D**2 *
                      (a**2 * q * (1 - r**2 / a**2) / (8 * D) - q * r**2 /
                       (8 * D)) *
                      (a**2 * nu * q * (1 - r**2 / a**2) /
                       (16 * D) + a**2 * q * (1 - r**2 / a**2) /
                       (16 * D) - q * r**2 / (8 * D)) / t**4 + 36 * D**2 *
                      (a**2 * nu * q * (1 - r**2 / a**2) /
                       (16 * D) + a**2 * q * (1 - r**2 / a**2) /
                       (16 * D) - q * r**2 / (8 * D))**2 / t**4)**(1 / 2)

    mesh = teefem.mesh.unitcircle(R=1)

    mat = teefem.materials.elastic(E=E, nu=nu)
    mdl = DKT(mesh=mesh)

    OM_el = mdl.elset['OM1']
    GA1_no = mdl.nset['GA1']

    teefem.assign_material(elements=OM_el, material=mat)

    bc1 = teefem.pressure_bc(pressure=lambda k, e: -q)
    bc2 = teefem.dirichlet_bc(encastre=True)

    teefem.assign_bc(elements=OM_el, bc=bc1)
    teefem.assign_bc(nodes=GA1_no, bc=bc2)

    carel = teefem.plate_functions.PlateCharacteristic(
        thickness=lambda k, e: t)
    teefem.assign_char(elements=OM_el, char=carel)

    mdl.static_solve()

    dymin = min([node.fields['DEPL']['DZ'] for node in mdl.nodes])

    print("DZ (acc)  : %0.14E" % (-w(0)))
    print("DZ        : %0.14E" % (dymin))
    #    print("DZ (CA)   : %0.14E"%(-1.74644966293971E-01))

    import matplotlib.pylab as plt
    #    mdl.plot()
    plotmdl(mdl, vmis)
    plt.show()
Example #2
0
def ex1():
    
    ''' Mindlin esimerkki 1, pyörähdyssymmetrinen laatta jakautuneella kuormalla '''
    
    t = 25e-3
    q = 100e3
    nu = 0.3
    E = 100.0e9
    a = 1
    D = E*t**3/(12*(1-nu**2))
    phi = 16/5*(t/a)**2/(1-nu)
    print phi
    w0 = q*a**4/(64*D)*(1+phi)


    mesh = teefem.mesh.unitcircle(R=1)
    
    mat = teefem.materials.elastic(E = E, nu = nu)
    mdl = MINR(mesh = mesh)
#    mdl = MIN(mesh = mesh)
    
    OM_el = mdl.elset['OM1']
    GA1_no = mdl.nset['GA1']

    teefem.assign_material(elements = OM_el, material = mat)
    
    bc1 = teefem.pressure_bc(pressure = lambda k,e: -q)
    bc2 = teefem.dirichlet_bc(encastre = True)
    
    teefem.assign_bc(elements = OM_el, bc = bc1)
    teefem.assign_bc(nodes = GA1_no, bc = bc2)

    carel = teefem.plate_functions.PlateCharacteristic(thickness = lambda k,e: t)
    teefem.assign_char(elements = OM_el, char = carel)

    mdl.static_solve()
    
    dz = [node.fields['DEPL']['DZ'] for node in mdl.nodes]
    print np.average(dz)
    dzmin = min(dz)
    
    print("DZ (acc)  : %0.14E"%(w0))
    print("DZ        : %0.14E"%(dzmin))
    
    import matplotlib.pylab as plt
    mdl.plot()
    plt.show()
Example #3
0
def test1():
    
    ''' Kalvo-ongelma testi, yksikkökalvo jota venytetään toisen akselin suuntaisesti '''

    q = 100
#    w = lambda r: -a**4*q*(1 - r**2/a**2)**2/(64*D) ???

    mesh = teefem.mesh.unitsquare()
    
    mdl = membrane(mesh = mesh)
    
    # Painekuorma
    teefem.assign_bc(
        elements = mdl.elset['OM1'],
        bc = teefem.pressure_bc(pressure = lambda k,e: -q),
        )
    
    # Vasen ja oikea reuna kiinni
    nset1 = set().union(mdl.nset['GA1'], mdl.nset['GA3'])
#    nset1 = set().union(mdl.nset['GA1'], mdl.nset['GA2'], mdl.nset['GA3'], mdl.nset['GA4'])
    teefem.assign_bc(
        nodes = nset1, 
        bc = teefem.dirichlet_bc(encastre = True)
        )

    # Esijännitys
    car = memchar(Tx = lambda k,e: 100)
#    car = memchar(Tx = lambda k,e: 100, Ty = lambda k,e: 100)
    teefem.assign_char(elements = mdl.elements, char = car)

    mdl.static_solve(export_matrices = False)
    
    dz = [node.fields['DEPL']['DZ'] for node in mdl.nodes]
    dymin = min(dz)
    
#    print("DZ (acc)  : %0.14E"%(-w(0)))
    print("DZ        : %0.14E"%(dymin))
#    print("DZ (CA)   : %0.14E"%(-1.74644966293971E-01))
    
    import matplotlib.pylab as plt
    mdl.plot()
    plt.show()
Example #4
0
def ex2():
    ''' DKT esimerkki 1, pyörähdyssymmetrinen laatta jakautuneella kuormalla '''
    t = 25e-3
    E = 100e9
    nu = 0.3
    q = 100e3
    a = 1
    D = E*t**3/(12*(1-nu**2))
    w = lambda r: -a**4*q*(1 - r**2/a**2)**2/(64*D)
    vmis = lambda r: (36*D**2*(a**2*q*(1 - r**2/a**2)/(8*D) - q*r**2/(8*D))**2/t**4 - 36*D**2*(a**2*q*(1 - r**2/a**2)/(8*D) - q*r**2/(8*D))*(a**2*nu*q*(1 - r**2/a**2)/(16*D) + a**2*q*(1 - r**2/a**2)/(16*D) - q*r**2/(8*D))/t**4 + 36*D**2*(a**2*nu*q*(1 - r**2/a**2)/(16*D) + a**2*q*(1 - r**2/a**2)/(16*D) - q*r**2/(8*D))**2/t**4)**(1/2)

    mesh = teefem.mesh.unitcircle(R=1)
    
    mat = teefem.materials.elastic(E = E, nu = nu)
    mdl = DKT(mesh = mesh)
    
    OM_el = mdl.elset['OM1']
    GA1_no = mdl.nset['GA1']

    teefem.assign_material(elements = OM_el, material = mat)
    
    bc1 = teefem.pressure_bc(pressure = lambda k,e: -q)
    bc2 = teefem.dirichlet_bc(encastre = True)
    
    teefem.assign_bc(elements = OM_el, bc = bc1)
    teefem.assign_bc(nodes = GA1_no, bc = bc2)

    carel = teefem.plate_functions.PlateCharacteristic(thickness = lambda k,e: t)
    teefem.assign_char(elements = OM_el, char = carel)

    mdl.static_solve()
    
    dymin = min([node.fields['DEPL']['DZ'] for node in mdl.nodes])
    
    print("DZ (acc)  : %0.14E"%(-w(0)))
    print("DZ        : %0.14E"%(dymin))
#    print("DZ (CA)   : %0.14E"%(-1.74644966293971E-01))
    
    import matplotlib.pylab as plt
#    mdl.plot()
    plotmdl(mdl, vmis)
    plt.show()
Example #5
0
def ex1():
    ''' Suorakaidelaatta, tasan jakautunut kuorma '''
    mesh = teefem.mesh.unitsquare()
    print mesh.status(fulloutput = True)
    mdl = DKT(mesh = mesh)
    mat = teefem.materials.elastic(E = 100.0e9, nu = 0.3)
    teefem.assign_material(elements = mdl.elset['OM1'], material = mat)
    load = teefem.pressure_bc(pressure = lambda k,e: -100.0e3)
    encastre = teefem.dirichlet_bc(encastre = True)
    teefem.assign_bc(elements = mdl.elset['OM1'], bc = load)
    teefem.assign_bc(nodes = mdl.nset['GA1'], bc = encastre)
    teefem.assign_bc(nodes = mdl.nset['GA2'], bc = encastre)
    teefem.assign_bc(nodes = mdl.nset['GA3'], bc = encastre)
    teefem.assign_bc(nodes = mdl.nset['GA4'], bc = encastre)
    carel = teefem.plate_functions.PlateCharacteristic(thickness = lambda k,e: 20e-3)
    teefem.assign_char(elements = mdl.elset['OM1'], char = carel)
    mdl.static_solve()
    dymin = min([node.fields['DEPL']['DZ'] for node in mdl.nodes])
    print("DZ: %0.14E"%(dymin*1000))
    plotmdl(mdl)
Example #6
0
def ex1():
    ''' Suorakaidelaatta, tasan jakautunut kuorma '''
    mesh = teefem.mesh.unitsquare()
    print mesh.status(fulloutput=True)
    mdl = DKT(mesh=mesh)
    mat = teefem.materials.elastic(E=100.0e9, nu=0.3)
    teefem.assign_material(elements=mdl.elset['OM1'], material=mat)
    load = teefem.pressure_bc(pressure=lambda k, e: -100.0e3)
    encastre = teefem.dirichlet_bc(encastre=True)
    teefem.assign_bc(elements=mdl.elset['OM1'], bc=load)
    teefem.assign_bc(nodes=mdl.nset['GA1'], bc=encastre)
    teefem.assign_bc(nodes=mdl.nset['GA2'], bc=encastre)
    teefem.assign_bc(nodes=mdl.nset['GA3'], bc=encastre)
    teefem.assign_bc(nodes=mdl.nset['GA4'], bc=encastre)
    carel = teefem.plate_functions.PlateCharacteristic(
        thickness=lambda k, e: 20e-3)
    teefem.assign_char(elements=mdl.elset['OM1'], char=carel)
    mdl.static_solve()
    dymin = min([node.fields['DEPL']['DZ'] for node in mdl.nodes])
    print("DZ: %0.14E" % (dymin * 1000))
    plotmdl(mdl)
Example #7
0
def test1():
    ''' Kalvo-ongelma testi, yksikkökalvo jota venytetään toisen akselin suuntaisesti '''

    q = 100
    #    w = lambda r: -a**4*q*(1 - r**2/a**2)**2/(64*D) ???

    mesh = teefem.mesh.unitsquare()

    mdl = membrane(mesh=mesh)

    # Painekuorma
    teefem.assign_bc(
        elements=mdl.elset['OM1'],
        bc=teefem.pressure_bc(pressure=lambda k, e: -q),
    )

    # Vasen ja oikea reuna kiinni
    nset1 = set().union(mdl.nset['GA1'], mdl.nset['GA3'])
    #    nset1 = set().union(mdl.nset['GA1'], mdl.nset['GA2'], mdl.nset['GA3'], mdl.nset['GA4'])
    teefem.assign_bc(nodes=nset1, bc=teefem.dirichlet_bc(encastre=True))

    # Esijännitys
    car = memchar(Tx=lambda k, e: 100)
    #    car = memchar(Tx = lambda k,e: 100, Ty = lambda k,e: 100)
    teefem.assign_char(elements=mdl.elements, char=car)

    mdl.static_solve(export_matrices=False)

    dz = [node.fields['DEPL']['DZ'] for node in mdl.nodes]
    dymin = min(dz)

    #    print("DZ (acc)  : %0.14E"%(-w(0)))
    print("DZ        : %0.14E" % (dymin))
    #    print("DZ (CA)   : %0.14E"%(-1.74644966293971E-01))

    import matplotlib.pylab as plt
    mdl.plot()
    plt.show()
Example #8
0
mesh = teefem.geom.mesh(filename=meshfile)

mdl = teefem.models.cplan(mesh=mesh)

# Ryhmät
OM1_el = mdl.elset['OM1']  # Koko domain
GA1_no = mdl.nset['GA1']  # Vasen reuna
GA2_el = mdl.elset['GA2']  # Yläreuna
P1_no = mdl.nset['P1']  # Pistevoima

# Materiaali
mat = teefem.materials.elastic(E=210.0e9, nu=0.3)
teefem.assign_material(elements=OM1_el, material=mat)

# Reunaehdot, huom. TeeFEMissä tasojännitystila-elementin paksuus on oletuksena 1
bc1 = teefem.pressure_bc(pressure=lambda k: -q / t)
bc2 = teefem.dirichlet_bc(encastre=True)
bc3 = teefem.nodal_force(fy=-F / t)

# Kytketään reunaehdot malliin
# 1. Jakautunut kuormitus elementtiryhmään GA2
teefem.assign_bc(elements=GA2_el, bc=bc1)
# 2. Vasen reuna jäykästi kiinni
teefem.assign_bc(nodes=GA1_no, bc=bc2)
# 3. Pistevoima alareunaan
teefem.assign_bc(nodes=P1_no, bc=bc3)

# Ratkaisu
import time
t0 = time.clock()
mdl.static_solve()
Example #9
0
mesh = tf.geom.mesh(filename = 'tria3_50.msh')
#mesh = tf.geom.mesh(filename = 'tria3_5000.msh')

mesh.create_node_groups()

mdl = model(mesh = mesh)

tf.assign_material(
    elements = mdl.elset['OM1'],
    material = tf.materials.elastic(E = E, nu = nu),
    )

# Jakautunut kuormitus
tf.assign_bc(
    elements = mdl.elset['OM1'], 
    bc = tf.pressure_bc(pressure = lambda k,e: -p0),
    )

# Jäykkä tuenta vasemmalle reunalle (GA4)
tf.assign_bc(
    nodes = mdl.nset['GA4'], 
    bc = tf.dirichlet_bc(encastre = True),
    )

# Niveltuenta ylös ja alas

bcnod = set().union(mdl.nset['GA1'],mdl.nset['GA3'])
tf.assign_bc(nodes = bcnod, bc = tf.dirichlet_bc(dz = 0))

carel = tf.plate_functions.PlateCharacteristic(thickness = t)
tf.assign_char(elements = mdl.elset['OM1'], char = carel)
Example #10
0
                  (a**2 * nu * q * (1 - r**2 / a**2) / (16 * D) + a**2 * q *
                   (1 - r**2 / a**2) / (16 * D) - q * r**2 /
                   (8 * D)) / t**4 + 36 * D**2 *
                  (a**2 * nu * q * (1 - r**2 / a**2) / (16 * D) + a**2 * q *
                   (1 - r**2 / a**2) / (16 * D) - q * r**2 /
                   (8 * D))**2 / t**4)**(1 / 2)
mesh = teefem.mesh.unitcircle(R=1)
mat = teefem.materials.elastic(E=E, nu=nu)
mdl = model(mesh=mesh)

OM_el = mdl.elset['OM1']
GA1_no = mdl.nset['GA1']

teefem.assign_material(elements=OM_el, material=mat)

bc1 = teefem.pressure_bc(pressure=lambda k, e: -q)
bc2 = teefem.dirichlet_bc(encastre=True)

teefem.assign_bc(elements=OM_el, bc=bc1)
teefem.assign_bc(nodes=GA1_no, bc=bc2)

carel = teefem.plate_functions.PlateCharacteristic(thickness=lambda k, e: t)
teefem.assign_char(elements=OM_el, char=carel)

mdl.static_solve()

dymin = min([node.fields['DEPL']['DZ'] for node in mdl.nodes])

print("DZ (acc)  : %0.14E" % (w(0)))
print("DZ        : %0.14E" % (dymin))
Example #11
0
        + a ** 2 * q * (1 - r ** 2 / a ** 2) / (16 * D)
        - q * r ** 2 / (8 * D)
    )
    ** 2
    / t ** 4
) ** (1 / 2)
mesh = teefem.mesh.unitcircle(R=1)
mat = teefem.materials.elastic(E=E, nu=nu)
mdl = model(mesh=mesh)

OM_el = mdl.elset["OM1"]
GA1_no = mdl.nset["GA1"]

teefem.assign_material(elements=OM_el, material=mat)

bc1 = teefem.pressure_bc(pressure=lambda k, e: -q)
bc2 = teefem.dirichlet_bc(encastre=True)

teefem.assign_bc(elements=OM_el, bc=bc1)
teefem.assign_bc(nodes=GA1_no, bc=bc2)

carel = teefem.plate_functions.PlateCharacteristic(thickness=lambda k, e: t)
teefem.assign_char(elements=OM_el, char=carel)

mdl.static_solve()

dymin = min([node.fields["DEPL"]["DZ"] for node in mdl.nodes])

print("DZ (acc)  : %0.14E" % (w(0)))
print("DZ        : %0.14E" % (dymin))
Example #12
0
def malli0():
    ''' Tasojännitystilan ratkaisu. '''
    mesh = teefem.geom.mesh(filename='cplangeo.msh')
    mdl = cplan.cplan(mesh=mesh)
    OM1_el = mdl.elset['OM1']
    mat = teefem.materials.elastic(E=210.0e9, nu=0.3)
    teefem.assign_material(elements=OM1_el, material=mat)
    #    nset1 = set().union(mdl.nset['GA1'], mdl.nset['GA2'], mdl.nset['GA3'], mdl.nset['GA4'])
    #    nset1 = set().union(mdl.nset['GA2'], mdl.nset['GA4'])
    teefem.assign_bc(
        nodes=mdl.nset['GA5'],
        bc=teefem.dirichlet_bc(dx=0, dy=0),
    )
    teefem.assign_bc(
        elements=mdl.elset['GA1'],
        bc=teefem.pressure_bc(pressure=lambda k: +q),  # TJT oletuspaksuus t=1
    )
    teefem.assign_bc(
        elements=mdl.elset['GA3'],
        bc=teefem.pressure_bc(pressure=lambda k: -q),  # TJT oletuspaksuus t=1
    )
    mdl.static_solve()

    ### Jälkikäsittelyä ###

    from scipy.interpolate import griddata

    # Primäärikenttä solmupisteissä
    x = []
    y = []
    dx = []
    dy = []
    for n in mdl.nodes:
        x.append(n.x)
        y.append(n.y)
        dx.append(n.fields['DEPL']['DX'])
        dy.append(n.fields['DEPL']['DY'])

    xx = []
    yy = []
    Nx = []
    Ny = []
    Nxy = []
    vmis = []
    for e in mdl.elset['OM1']:
        for ke in e.ipoints:
            xx.append(e.geom.x(*ke))
            yy.append(e.geom.y(*ke))
            S = e.S(*ke)
            Nx.append(S[0, 0])
            Ny.append(S[1, 0])
            Nxy.append(S[2, 0])
            vmis.append(e.vmis(*ke))

    def plot(x, y, data, filename):
        plt.figure()
        # define grid.
        xi = np.linspace(min(x), max(x), 100)
        yi = np.linspace(min(y), max(y), 100)
        # grid the data.
        si = griddata((x, y),
                      data, (xi[None, :], yi[:, None]),
                      method='linear')
        # contour the gridded data, plotting dots at the randomly spaced data points.
        CS = plt.contour(xi, yi, si, 30, linewidths=0.5, colors='k')
        CS = plt.contourf(xi, yi, si, 30, cmap=plt.cm.jet)
        plt.colorbar()  # draw colorbar
        # plot data points.
        # plt.scatter(x,y,marker='o',c='b',s=5)
        plt.xlim(min(x), max(x))
        plt.ylim(min(y), max(y))
        plt.savefig(filename)
        #plt.tight_layout()

    plot(x, y, dx, 'dx.pdf')
    plot(x, y, dy, 'dy.pdf')

    plot(xx, yy, Nx, 'Nx.pdf')
    plot(xx, yy, Ny, 'Ny.pdf')
    plot(xx, yy, Nxy, 'Nxy.pdf')

    plt.show()
Example #13
0
def malli0():
    ''' Tasojännitystilan ratkaisu. '''
    mesh = teefem.geom.mesh(filename = 'cplangeo.msh')
    mdl = cplan.cplan(mesh = mesh)
    OM1_el = mdl.elset['OM1']
    mat = teefem.materials.elastic(E = 210.0e9, nu = 0.3)
    teefem.assign_material(elements = OM1_el, material = mat)
#    nset1 = set().union(mdl.nset['GA1'], mdl.nset['GA2'], mdl.nset['GA3'], mdl.nset['GA4'])
#    nset1 = set().union(mdl.nset['GA2'], mdl.nset['GA4'])
    teefem.assign_bc(
        nodes = mdl.nset['GA5'], 
        bc = teefem.dirichlet_bc(dx=0,dy=0),
        )
    teefem.assign_bc(
        elements = mdl.elset['GA1'],
        bc = teefem.pressure_bc(pressure = lambda k: +q), # TJT oletuspaksuus t=1
        )
    teefem.assign_bc(
        elements = mdl.elset['GA3'],
        bc = teefem.pressure_bc(pressure = lambda k: -q), # TJT oletuspaksuus t=1
        )
    mdl.static_solve()
    
    ### Jälkikäsittelyä ###
    
    from scipy.interpolate import griddata
    
    # Primäärikenttä solmupisteissä
    x = []
    y = []
    dx = []
    dy = []
    for n in mdl.nodes:
        x.append(n.x)
        y.append(n.y)
        dx.append(n.fields['DEPL']['DX'])
        dy.append(n.fields['DEPL']['DY'])

    xx = []
    yy = []
    Nx = []
    Ny = []
    Nxy = []
    vmis = []
    for e in mdl.elset['OM1']:
        for ke in e.ipoints:
            xx.append(e.geom.x(*ke))
            yy.append(e.geom.y(*ke))
            S = e.S(*ke)
            Nx.append(S[0,0])
            Ny.append(S[1,0])
            Nxy.append(S[2,0])
            vmis.append(e.vmis(*ke))

    def plot(x,y,data,filename):
        plt.figure()
        # define grid.
        xi = np.linspace(min(x),max(x),100)
        yi = np.linspace(min(y),max(y),100)
        # grid the data.
        si = griddata((x, y), data, (xi[None,:], yi[:,None]), method='linear')
        # contour the gridded data, plotting dots at the randomly spaced data points.
        CS = plt.contour(xi,yi,si,30,linewidths=0.5,colors='k')
        CS = plt.contourf(xi,yi,si,30,cmap=plt.cm.jet)
        plt.colorbar() # draw colorbar
        # plot data points.
        # plt.scatter(x,y,marker='o',c='b',s=5)
        plt.xlim(min(x),max(x))
        plt.ylim(min(y),max(y))
        plt.savefig(filename)
        #plt.tight_layout()
    
    plot(x,y,dx,'dx.pdf')
    plot(x,y,dy,'dy.pdf')
    
    plot(xx,yy,Nx,'Nx.pdf')
    plot(xx,yy,Ny,'Ny.pdf')
    plot(xx,yy,Nxy,'Nxy.pdf')
    
    plt.show()
Example #14
0
mesh = teefem.geom.mesh(filename = meshfile)

mdl = teefem.models.cplan(mesh = mesh)

# Ryhmät
OM1_el = mdl.elset['OM1'] # Koko domain
GA1_no = mdl.nset['GA1'] # Vasen reuna
GA2_el = mdl.elset['GA2'] # Yläreuna
P1_no = mdl.nset['P1'] # Pistevoima

# Materiaali
mat = teefem.materials.elastic(E = 210.0e9, nu = 0.3)
teefem.assign_material(elements = OM1_el, material = mat)

# Reunaehdot, huom. TeeFEMissä tasojännitystila-elementin paksuus on oletuksena 1
bc1 = teefem.pressure_bc(pressure = lambda k: -q/t)
bc2 = teefem.dirichlet_bc(encastre = True)
bc3 = teefem.nodal_force(fy = -F/t)

# Kytketään reunaehdot malliin
# 1. Jakautunut kuormitus elementtiryhmään GA2
teefem.assign_bc(elements = GA2_el, bc = bc1)
# 2. Vasen reuna jäykästi kiinni
teefem.assign_bc(nodes = GA1_no, bc = bc2)
# 3. Pistevoima alareunaan
teefem.assign_bc(nodes = P1_no, bc = bc3)

# Ratkaisu
import time
t0 = time.clock()
mdl.static_solve()