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': FEMMDeforLinearQT10MS(material=m, fes=fes)}]

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,
        'comp': 1,
        'value': lambda x: 0.0
    },
    {
        'node_list': cn,
        'comp': 2,
        'value': lambda x: 0.0
Exemple #2
0
rho = 8000
a = 10.0
b = a
h = 0.05

htol = h / 1000
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))
Exemple #3
0
                direction=lambda x: numpy.array([0.0, +1.0]),
                tolerance=0.99)
topright = numpy.concatenate((top, right))
print('Mesh generation', time.time() - start)
model_data = {}
model_data['fens'] = fens
model_data['regions'] \
    = [{'femm': FEMMHeatDiff(material=m, fes=fes,
                             integration_rule=TriRule(npts=1))}
       ]
model_data['boundary_conditions'] \
    = {'essential': [{'node_list': connected_nodes(bfes.subset(bottom)),
                      'temperature': lambda x: 100.0
                      }],
       'surface_transfer': [{'femm': FEMMHeatDiffSurface(fes=bfes.subset(topright),
                                                         integration_rule=GaussRule(dim=1, order=1),
                                                         surface_transfer_coeff=lambda x: 750.0),
                             'ambient_temperature': lambda x: 0.0
                             }]
       }

# Call the solver
steady_state(model_data)
print(model_data['timings'])
nodeA = fenode_select(fens,
                      box=bounding_box([Width, Heightb]),
                      inflate=Width / 1e6)
print('Temperature at nodeA (', nodeA, ')=', model_data['temp'].values[nodeA])
# Visualize the temperature
plot_temperature(model_data)
Exemple #4
0
start = time.time()
fens, feslist = abaqus_importer.import_mesh('LE11_H20_90deg.inp')
# Account for the instance rotation
fens = rotate_mesh(fens, math.pi * 90. / 180 * numpy.array([1.0, 0.0, 0.0]),
                   numpy.array([0.0, 0.0, 0.0]))
for fes in feslist:
    print(fes.count())
fes = feslist[0]
scipy.io.savemat('LE11_H20_90deg.mat', {'xyz': fens.xyz, 'conn': fes.conn})
print('Mesh import', time.time() - start)

geom = NodalField(fens=fens)
u = NodalField(nfens=fens.count(), dim=3)
htol = 1.0 / 1000
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,
# models = {'H8': elem_dep_data_h8}
# models = {'H8MSGSO': elem_dep_data_h8msgso}
for k, v in models.items():
    print(k)
    for n in range(12, 13):  #range(2,7)
        fens, femm, sfemm = v(n, n, n)
        model_data = {}
        model_data['fens'] = fens
        model_data['regions'] = [{'femm': femm}]

        # algo_common.plot_mesh(model_data)

        model_data['boundary_conditions'] = {}
        # Clamped face
        cn = fenode_select(fens,
                           box=numpy.array([0, 0, 0, b, 0, t]),
                           inflate=htol)
        essential = [
            {
                'node_list': cn,
                'comp': 0,
                'value': lambda x: 0.0
            },
            {
                'node_list': cn,
                'comp': 1,
                'value': lambda x: 0.0
            },
            {
                'node_list': cn,
                'comp': 2,
Exemple #6
0
E = 210e9
nu = 0.3
alpha = 2.3e-4
m = MatDeforTriaxLinearIso(e=E, nu=nu, alpha=alpha)

start = time.time()
L, H, W = 1.0, 1.0, 1.0
nW, nL, nH = 1, 1, 1
htol = min(L, H, W) / 1000
fens, fes = h8_block(W, L, H, nW, nL, nH)
fens, fes = h8_to_h20(fens, fes)
print('Mesh import', time.time() - start)

geom = NodalField(fens=fens)
u = NodalField(nfens=fens.count(), dim=3)
cn = fenode_select(fens, box=numpy.array([0.0, 0.0, 0, W, 0, H]), inflate=htol)
for j in cn:
    u.set_ebc([j], comp=0, val=0.0)
cn = fenode_select(fens, box=numpy.array([L, L, 0, W, 0, H]), inflate=htol)
for j in cn:
    u.set_ebc([j], comp=0, val=0.0)
cn = fenode_select(fens, box=numpy.array([0.0, L, 0, 0, 0, H]), inflate=htol)
for j in cn:
    u.set_ebc([j], comp=1, val=0.0)
cn = fenode_select(fens, box=numpy.array([0.0, L, 0, W, 0, 0]), inflate=htol)
for j in cn:
    u.set_ebc([j], comp=2, val=0.0)
u.apply_ebc()

femm = FEMMDeforLinear(material=m,
                       fes=fes,
Exemple #7
0
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)
# M = spla.LinearOperator(K.shape, ilu.solve)
# U, info = lgmres(K, F, x0=ilu.solve(F), M=M) #, callback=lambda x: print('iteration', numpy.linalg.norm(x-U)))
# print(info)
u.scatter_sysvec(U)

print('Solution', time.time() - start)
#
print('Done', time.time() - start0)

stresses = femm.nodal_field_from_integr_points(geom, u, u, dtempn1=dT, output=OUTPUT_CAUCHY, component=[0, 1, 2, 3, 4, 5])
pointA = fenode_select(fens, box=[707.107E-03,707.107E-03,  -707.107E-03, -707.107E-03, 0., 0.],
                       inflate=htol)
print(pointA)
sigzzA = stresses.values[pointA, 2]
print('Stress sigz @ A=', sigzzA/1.e6, ', ', (sigzzA / sigma_z_A_ref * 100), ' %')
#
stresses.values /= 1.0e6
vtkexport("LE11_H8MS_results", fes, geom, {"displacements": u, 'dT': dT, 'stresses': stresses})
for k, elem_dep_data in models.items():
    print(k)
    for n in range(1, 3):
        fens, femms, sfemm = elem_dep_data(n * na, n * nb, n * nts)
        model_data = {}
        model_data['fens'] = fens
        model_data['regions'] = [{'femm': femm} for femm in femms]

        # algo_common.plot_mesh(model_data)

        model_data['boundary_conditions'] = {}
        # Simple supports
        essential = []
        t = sum(ts)
        cn1 = fenode_select(fens,
                            box=numpy.array([0, 0, 0, b, 0, t]),
                            inflate=htol)
        cn2 = fenode_select(fens,
                            box=numpy.array([a, a, 0, b, 0, t]),
                            inflate=htol)
        cn = numpy.vstack((cn1, cn2))
        essential.append({'node_list': cn, 'comp': 1, 'value': lambda x: 0.0})
        essential.append({'node_list': cn, 'comp': 2, 'value': lambda x: 0.0})
        cn1 = fenode_select(fens,
                            box=numpy.array([0, a, 0, 0, 0, t]),
                            inflate=htol)
        cn2 = fenode_select(fens,
                            box=numpy.array([0, a, b, b, 0, t]),
                            inflate=htol)
        cn = numpy.vstack((cn1, cn2))
        essential.append({'node_list': cn, 'comp': 0, 'value': lambda x: 0.0})
models = {'H8MSGSO': elem_dep_data_h8msgso}
models = {'QT10MS': elem_dep_data_qt10ms}
for k, v in models.items():
    print(k)
    for n in range(1, 4):
        fens, femm, sfemm = v(n * na, n * nb, n * nt)
        model_data = {}
        model_data['fens'] = fens
        model_data['regions'] = [{'femm': femm}]

        # algo_common.plot_mesh(model_data)

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