Exemplo n.º 1
0
def elem_dep_data_t4(na, nb, nt):
    fens, fes = t4_block(a, b, t, na, nb, nt, orientation='a')
    femm = FEMMDeforLinear(material=m,
                           fes=fes,
                           integration_rule=TetRule(npts=1))
    bfes = mesh_boundary(femm.fes)
    fesel = fe_select(fens, bfes, box=[a, a, 0, b, 0, t], inflate=htol)
    tsfes = bfes.subset(fesel)
    sfemm = FEMMDeforLinear(fes=tsfes, integration_rule=TriRule(npts=1))
    return fens, femm, sfemm
Exemplo n.º 2
0
def elem_dep_data_h8(na, nb, nt):
    fens, fes = h8_block(a, b, t, na, nb, nt)
    femm = FEMMDeforLinear(material=m,
                           fes=fes,
                           integration_rule=GaussRule(dim=3, order=2))
    bfes = mesh_boundary(femm.fes)
    fesel = fe_select(fens, bfes, box=[a, a, 0, b, 0, t], inflate=htol)
    tsfes = bfes.subset(fesel)
    sfemm = FEMMDeforLinear(fes=tsfes,
                            integration_rule=GaussRule(dim=2, order=2))
    return fens, femm, sfemm
Exemplo n.º 3
0
def elem_dep_data_qt10ms(na, nb, nt):
    #fens, fes = t4_block(a, b, t, na, nb, nt, orientation='a')
    fens, fes = t4_blockdel(a, b, t, na, nb, nt)
    fens, fes = t4_to_t10(fens, fes)
    femm = FEMMDeforLinearQT10MS(material=m, material_csys=mcsys, fes=fes)
    bfes = mesh_boundary(femm.fes)
    fesel = fe_select(fens, bfes, box=[a, a, 0, b, 0, t], inflate=htol)
    tsfes = bfes.subset(fesel)
    sfemm = FEMMDeforLinear(fes=tsfes, integration_rule=TriRule(npts=3))
    return fens, femm, sfemm
Exemplo n.º 4
0
def elem_dep_data_h20r(na, nb, nts):
    print(na, nb, nts)
    # fens, fes = t4_block(a, b, t, na, nb, nt, orientation='a')
    fens, fes = h8_composite_plate(a, b, ts, na, nb, nts)
    fens, fes = h8_to_h20(fens, fes)
    bfes = mesh_boundary(fes)
    t = sum(ts)
    fesel = fe_select(fens, bfes, box=[0, a, 0, b, t, t], inflate=htol)
    tsfes = bfes.subset(fesel)
    femms = []
    for layer in range(len(nts)):
        aangle = angles[layer] / 180. * math.pi
        mcsys = CSys(matrix=rotmat(numpy.array([0.0, 0.0, aangle])))
        el = fe_select(fens, fes, bylabel=True, label=layer)
        femms.append(
            FEMMDeforLinear(material=m,
                            material_csys=mcsys,
                            fes=fes.subset(el),
                            integration_rule=GaussRule(dim=3, order=2)))
    sfemm = FEMMDeforLinear(fes=tsfes,
                            integration_rule=GaussRule(dim=2, order=2))
    return fens, femms, sfemm
Exemplo n.º 5
0
na, nb, nh = 6,6,4
m = MatDeforTriaxLinearIso(rho=rho, e=E, nu=nu)

start = time.time()
fens, fes = h8_block(a, b, h, na, nb, nh)
fens, fes = h8_to_h20(fens, fes)
print('Mesh generation', time.time() - start)
geom = NodalField(fens=fens)
u = NodalField(nfens=fens.count(), dim=3)
cn = fenode_select(fens, box=numpy.array([0, 0, 0, b, 0, h]), inflate=htol)
for j in cn:
    u.set_ebc([j], comp=0, val=0.0)
    u.set_ebc([j], comp=1, val=0.0)
    u.set_ebc([j], comp=2, val=0.0)
u.apply_ebc()
femmk = FEMMDeforLinear(material=m, fes=fes, integration_rule=GaussRule(dim=3, order=2))
femmk.associate_geometry(geom)
u.numberdofs()
print('Number of degrees of freedom', u.nfreedofs)
start = time.time()
K = femmk.stiffness(geom, u)
K = (K.T + K)/2.0
print('Stiffness assembly', time.time() - start)
start = time.time()
femmm = FEMMDeforLinear(material=m, fes=fes, integration_rule=GaussRule(dim=3, order=3))
M = femmm.lumped_mass(geom, u)
M = (M.T + M)/2.
# for i in range(M.shape[0]):
#     for j in range(M.shape[1]):
#         if i==j:
#             print(i,j,M[i,j])
Exemplo n.º 6
0
        'node_list': cn,
        'comp': 2,
        'value': lambda x: 0.0
    },
]
# Symmetry plane
cn = fenode_select(fens, box=numpy.array([W, W, 0, L, 0, H]), inflate=htol)
essential.append({'node_list': cn, 'comp': 0, 'value': lambda x: 0.0})
model_data['boundary_conditions']['essential'] = essential

# Traction on the free end
bfes = mesh_boundary(fes)
fesel = fe_select(fens, bfes, box=[0, W, L, L, 0, H], inflate=htol)
fi = ForceIntensity(magn=lambda x, J: numpy.array([0, 0, magn]))
tsfes = bfes.subset(fesel)
sfemm = FEMMDeforLinear(fes=tsfes, integration_rule=TriRule(npts=3))
traction = [{'femm': sfemm, 'force_intensity': fi}]
model_data['boundary_conditions']['traction'] = traction

# Call the solver
algo_defor_linear.statics(model_data)
for action, time in model_data['timings']:
    print(action, time, ' sec')

geom = model_data['geom']
u = model_data['u']

tipn = fenode_select(fens, box=[0, W, L, L, 0, H])
uv = u.values[tipn, :]
uz = sum(uv[:, 2]) / len(tipn)
print('Tip displacement uz =', uz, ', ', (uz / uzex * 100), ' %')
Exemplo n.º 7
0
cn = fenode_select(fens, plane=([0, 0, 0.], [0., 0., -1.]), inflate=htol)
for j in cn:
    u.set_ebc([j], comp=2, val=0.0)
cn = fenode_select(fens, plane=([0, 0, 1.79], [0., 0., -1.]), inflate=htol)
for j in cn:
    u.set_ebc([j], comp=2, val=0.0)
cn = fenode_select(fens, plane=([0, 0, 0], [0., +1., 0.]), inflate=htol)
for j in cn:
    u.set_ebc([j], comp=1, val=0.0)
cn = fenode_select(fens, plane=([0, 0, 0], [+1., 0., 0.]), inflate=htol)
for j in cn:
    u.set_ebc([j], comp=0, val=0.0)
u.apply_ebc()

femm = FEMMDeforLinear(material=m,
                       fes=fes,
                       integration_rule=GaussRule(dim=3, order=3))
femm.associate_geometry(geom)
S = femm.connection_matrix(geom)
perm = reverse_cuthill_mckee(S, symmetric_mode=True)
u.numberdofs(node_perm=perm)
print('Number of degrees of freedom', u.nfreedofs)

start = time.time()
K = femm.stiffness(geom, u)
print('Matrix assembly', time.time() - start)

start = time.time()
dT = NodalField(nfens=fens.count(), dim=1)
dT.fun_set_values(fens.xyz, lambda x: math.sqrt(x[0]**2 + x[1]**2) + x[2])
print(numpy.max(dT.values))
Exemplo n.º 8
0
print('Mesh generation', time.time() - start)
geom = NodalField(fens=fens)
u = NodalField(nfens=fens.count(), dim=3)
cn = fenode_select(fens, box=numpy.array([0, W, 0, 0, 0, H]), inflate=htol)
for j in cn:
    u.set_ebc([j], comp=0, val=0.0)
    u.set_ebc([j], comp=1, val=0.0)
    u.set_ebc([j], comp=2, val=0.0)
cn = fenode_select(fens, box=numpy.array([W, W, 0, L, 0, H]), inflate=htol)
for j in cn:
    u.set_ebc([j], comp=0, val=0.0)
u.apply_ebc()
u.numberdofs()
print('Number of degrees of freedom', u.nfreedofs)
femm = FEMMDeforLinear(material=m,
                       fes=fes,
                       integration_rule=GaussRule(dim=3, order=2))

start = time.time()
bfes = mesh_boundary(fes)
fesel = fe_select(fens, bfes, box=[0, W, L, L, 0, H], inflate=htol)
fi = ForceIntensity(magn=lambda x, J: numpy.array([0, 0, magn]))
tsfes = bfes.subset(fesel)
sfemm = FEMMDeforLinear(fes=tsfes, integration_rule=GaussRule(dim=2, order=2))
F = sfemm.distrib_loads(geom, u, fi, 2)
start = time.time()
K = femm.stiffness(geom, u)
print('Matrix assembly', time.time() - start)
start = time.time()
U, info = minres(K, F)
print(info)
Exemplo n.º 9
0
fens, fes = h8_to_h20(fens, fes)
print(fes.conn.shape)
print('Mesh generation', time.time() - start)
geom = NodalField(fens=fens)
u = NodalField(nfens=fens.count(), dim=3)
cn = fenode_select(fens, box=numpy.array([0, W, 0, 0, 0, H]), inflate=htol)
for j in cn:
    u.set_ebc([j], comp=0, val=0.0)
    u.set_ebc([j], comp=1, val=0.0)
    u.set_ebc([j], comp=2, val=0.0)
cn = fenode_select(fens, box=numpy.array([W, W, 0, L, 0, H]), inflate=htol)
for j in cn:
    u.set_ebc([j], comp=0, val=0.0)
u.apply_ebc()
femm = FEMMDeforLinear(material=m,
                       fes=fes,
                       integration_rule=GaussRule(dim=3, order=2))
femm.associate_geometry(geom)
S = femm.connection_matrix(geom)
perm = reverse_cuthill_mckee(S, symmetric_mode=True)
u.numberdofs(node_perm=perm)
#u.numberdofs()
print('Number of degrees of freedom', u.nfreedofs)
start = time.time()
bfes = mesh_boundary(fes)
fesel = fe_select(fens, bfes, box=[0, W, L, L, 0, H], inflate=htol)
fi = ForceIntensity(magn=lambda x, J: numpy.array([0, 0, magn]))
tsfes = bfes.subset(fesel)
sfemm = FEMMDeforLinear(fes=tsfes, integration_rule=GaussRule(dim=2, order=2))
F = sfemm.distrib_loads(geom, u, fi, 2)
start = time.time()
Exemplo n.º 10
0
u.apply_ebc()
femm = FEMMDeforLinearQT10MS(material=m,
                             fes=fes,
                             integration_rule=TetRule(npts=4))
femm.associate_geometry(geom)
S = femm.connection_matrix(geom)
perm = reverse_cuthill_mckee(S, symmetric_mode=True)
u.numberdofs(node_perm=perm)
#u.numberdofs()
print('Number of degrees of freedom', u.nfreedofs)
start = time.time()
bfes = mesh_boundary(fes)
fesel = fe_select(fens, bfes, box=[0, W, L, L, 0, H], inflate=htol)
fi = ForceIntensity(magn=lambda x, J: numpy.array([0, 0, magn]))
tsfes = bfes.subset(fesel)
sfemm = FEMMDeforLinear(fes=tsfes, integration_rule=TriRule(npts=3))
F = sfemm.distrib_loads(geom, u, fi, 2)
print(numpy.sum(F))
start = time.time()
K = femm.stiffness(geom, u)
print('Matrix assembly', time.time() - start)
start = time.time()
# U, info = lgmres(K, F)
# print(info)
lu = splu(K)
del K
U = lu.solve(F)
#R = cho_factor(K, overwrite_a=True)
#y = spsolve(R, spsolve(R.T, F))
# U = spsolve(K, F)
# import scipy.sparse.linalg as spla
Exemplo n.º 11
0
u.apply_ebc()
femm = FEMMDeforLinearH8MSGSO(material=m,
                              fes=fes,
                              integration_rule=GaussRule(dim=3, order=2))
femm.associate_geometry(geom)
S = femm.connection_matrix(geom)
perm = reverse_cuthill_mckee(S, symmetric_mode=True)
u.numberdofs(node_perm=perm)
#u.numberdofs()
print('Number of degrees of freedom', u.nfreedofs)
start = time.time()
bfes = mesh_boundary(fes)
fesel = fe_select(fens, bfes, box=[0, W, L, L, 0, H], inflate=htol)
fi = ForceIntensity(magn=lambda x, J: numpy.array([0, 0, magn]))
tsfes = bfes.subset(fesel)
sfemm = FEMMDeforLinear(fes=tsfes, integration_rule=GaussRule(dim=2, order=2))
F = sfemm.distrib_loads(geom, u, fi, 2)
start = time.time()
K = femm.stiffness(geom, u)
print('Matrix assembly', time.time() - start)
start = time.time()
# U, info = lgmres(K, F)
# print(info)
lu = splu(K)
del K
U = lu.solve(F)
#R = cho_factor(K, overwrite_a=True)
#y = spsolve(R, spsolve(R.T, F))
# U = spsolve(K, F)
# import scipy.sparse.linalg as spla
# ilu = spilu(K, diag_pivot_thresh=0.0, fill_factor=1000)
Exemplo n.º 12
0
magn = -0.2 * 12.2334 / 4
Force = magn * W * H * 2
Force * L**3 / (3 * E * W * H**3 * 2 / 12)
uzex = -12.0935378981478
m = MatDeforTriaxLinearIso(e=E, nu=nu)

start = time.time()
fens, fes = t4_block(W, L, H, nW, nL, nH, orientation='ca')
fens, fes = t4_to_t10(fens, fes)
print('Mesh generation', time.time() - start)

model_data = {}
model_data['fens'] = fens
model_data['regions'] = [{
    'femm':
    FEMMDeforLinear(material=m, fes=fes, integration_rule=TetRule(npts=4))
}]

algo_common.plot_mesh(model_data)

model_data['boundary_conditions'] = {}
# Clamped face
cn = fenode_select(fens, box=numpy.array([0, W, 0, 0, 0, H]), inflate=htol)
essential = [
    {
        'node_list': cn,
        'comp': 0,
        'value': lambda x: 0.0
    },
    {
        'node_list': cn,