def elem_dep_data_qt10ms(na, nb, nt):
    fens, fes = t4_block(a, b, t, na, nb, nt, orientation='a')
    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
def elem_dep_data_h8msgso(na, nb, nt):
    fens, fes = h8_block(a, b, t, na, nb, nt)
    femm = FEMMDeforLinearH8MSGSO(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=GaussRule(dim=2, order=2))
    return fens, femm, sfemm
Exemplo n.º 3
0
def elem_dep_data_qt10ms(na, nb, nts):
    print(na, nb, nts)
    # fens, fes = t4_block(a, b, t, na, nb, nt, orientation='a')
    fens, fes = t4_composite_plate(a, b, ts, na, nb, nts)
    fens, fes = t4_to_t10(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
        print(aangle)
        mcsys = CSys(matrix=rotmat(numpy.array([0.0, 0.0, aangle])))
        el = fe_select(fens, fes, bylabel=True, label=layer)
        femms.append(
            FEMMDeforLinearQT10MS(material=m,
                                  material_csys=mcsys,
                                  fes=fes.subset(el)))
    sfemm = FEMMDeforLinear(fes=tsfes, integration_rule=TriRule(npts=3))
    return fens, femms, sfemm
Exemplo n.º 4
0
def h8_composite_plate(L, W, ts, nL, nW, nts, orientation='a'):
    # H8 block mesh for a layered block (composite plate).
    #
    # function [fens,fes] = H8_composite_plate(L,W,ts,nL,nW,nts)
    #
    # L,W= length and width,
    # ts= Array of layer thicknesses,
    # nL,nW= Number of elements per length and width,
    # nts= array of numbers of elements per layer
    #
    # The fes of each layer are labeled with the layer number.
    #
    # Output:
    # fens= finite element node set
    # fes = finite element set
    #
    #
    # Examples:
    #     a=200; b=600; h=50;
    #     angles =[0,90,0];
    #     nLayers =length(angles);
    #     na=4; nb=4;
    #     nts= 1*ones(nLayers,1);# number of elements per layer
    #     ts= h/nLayers*ones(nLayers,1);# layer thicknesses
    #     [fens,fes] = H8_composite_plate(a,b,ts,na,nb,nts);;
    #     gv=drawmesh( {fens,subset(fes,fe_select(fens,fes,struct('label', 1)))},'fes', 'facecolor','r');
    #     gv=drawmesh( {fens,subset(fes,fe_select(fens,fes,struct('label', 2)))},'gv',gv,'fes', 'facecolor','g');
    #     gv=drawmesh( {fens,subset(fes,fe_select(fens,fes,struct('label', 3)))},'gv',gv,'fes', 'facecolor','b');
    #
    #
    # See also: H8_block
    sumnt = numpy.sum(nts)
    fens, fes = h8_block(nL, nW, sumnt, nL, nW, sumnt)
    label = numpy.zeros((fes.count(), 1), dtype=int)
    tnt = 0.0
    for layer, nt in enumerate(nts):
        box = numpy.array([0, nL, 0, nW, tnt, tnt + nt])
        el = fe_select(fens, fes, box=box, inflate=0.01)
        label[el] = layer
        tnt += nt
    fes.label = label
    t = numpy.sum(ts)
    fens.xyz[:, 0] *= L / nL
    fens.xyz[:, 1] *= W / nW
    fens.xyz[:, 2] *= t / sumnt
    return fens, fes
Exemplo n.º 5
0
        'value': lambda x: 0.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])
Exemplo n.º 6
0
m = MatHeatDiff(thermal_conductivity=numpy.array([[k, 0.0], [0.0, k]]))
start = time.time()
Width, nW = 0.6, 20
Heightb, nHb = 0.2, 20
fens1, fes1 = t3_ablock(Width, Heightb, nW, nHb)
Heightt, nHt = 0.8, 20
fens2, fes2 = t3_ablock(Width, Heightt, nW, nHt)
fens2.xyz[:, 1] += Heightb
tolerance = Heightb / nHb / 100
fens, fes1, fes2 = merge_meshes(fens1, fes1, fens2, fes2, tolerance)
fes = fes1.cat(fes2)
fes.other_dimension = lambda conn, N, x: 1.0
bfes = mesh_boundary(fes)
bottom = fe_select(fens,
                   bfes,
                   facing=True,
                   direction=lambda x: numpy.array([0.0, -1.0]),
                   tolerance=0.99)

right = fe_select(fens,
                  bfes,
                  facing=True,
                  direction=lambda x: numpy.array([1.0, 0.0]),
                  tolerance=0.99)
top = fe_select(fens,
                bfes,
                facing=True,
                direction=lambda x: numpy.array([0.0, +1.0]),
                tolerance=0.99)
topright = numpy.concatenate((top, right))
print('Mesh generation', time.time() - start)
Exemplo n.º 7
0
print('Mesh import', time.time() - start)

geom = NodalField(fens=fens)
u = NodalField(nfens=fens.count(), dim=3)
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)
print('Number of degrees of freedom', u.nfreedofs)

bfes = mesh_boundary(fes)
htol = 1.0/1000
feselzm = fe_select(fens, bfes, plane=([1.293431,-535.757E-03,0.],[0.,0.,-1.]), inflate=htol)
feselzp = fe_select(fens, bfes, plane=([653.275E-03,-270.595E-03,1.79],[0.,0.,+1.]), inflate=htol)
feseltp = fe_select(fens, bfes, plane=([1.2,0.,0.],[0.,+1.,0.]), inflate=htol)
feseltm = fe_select(fens, bfes, plane=([707.107E-03,-707.107E-03,1.79],[-1.,-1.,0.]), inflate=htol)
tsfes = bfes.subset(numpy.hstack((feselzm, feselzp, feseltp, feseltm)))

start = time.time()
sfemm = FEMMDeforLinearSurfaceSpring(fes=tsfes, integration_rule=GaussRule(dim=2, order=4),
                                     surface_normal_spring_coefficient=(1. / ((abs(sigma_z_A_ref)/1e12)/E)))
K = femm.stiffness(geom, u) + sfemm.stiffness_normal(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))