示例#1
0
                #                         "0.0"," 0.0","0.0",

                #                         "0.0","0.0","0.0",
                                        
                #                         "0.0", "0.0"),
                #                         sq = -(restL-width)/restL,
                #                         p=np.pi/width *4.0,
                #                         o= width/8.0,
                #                         A1=2.5*scale,
                #                         A2=1.25*scale))

        warp.wx.vector()[ warp.mdof.part(i).dofs() ] = fib.wx.vector()[:]
        warp.wv.vector()[ warp.mdof.part(i).dofs() ] = fib.wv.vector()[:]

warp.output_states("post/stockinette_{0}_"+str(0)+".pvd",1)
warp.output_surfaces("post/stockinettemesh_time_{0}_"+str(0)+".pvd",1)
initialize()                             
warp.output_states("post/stockinette_{0}_"+str(1)+".pvd",1)
warp.output_surfaces("post/stockinettemesh_time_{0}_"+str(1)+".pvd",1)


Tmax=4.0
NT = 100
h = Tmax/NT
warp.create_contacts()
warp.assemble_mass()
dirk = DIRK_Monolithic(1, h, warp, warp.assemble_system, warp.update, apply_BCs)
for t in xrange(NT):
    dirk.march()

    warp.output_states("post/stockinette_time_{0}_"+str(t+2)+".pvd",1)
示例#2
0
    warp.create_contacts()
    # embed()
    it = 0
    eps = 1.0
    print "Simulation step ", t, ":"
    extend = Expression((
        " 0.0",
        "-(x[1]*cos(theta)-x[2]*sin(theta)-x[1]-(x[1]*cos(old_theta)-x[2]*sin(old_theta)-x[1]))",
        "-(x[2]*cos(theta)+x[1]*sin(theta)-x[2]-(x[2]*cos(old_theta)+x[1]*sin(old_theta)-x[2]))",
        "0.0", "0.0", "0.0", "0.0", "0.0", "0.0"),
                        theta=t * np.pi / float(Nsteps),
                        old_theta=(t - 1) * np.pi / float(Nsteps))
    while eps > tol and it < maxiter:

        warp.assemble_system()
        warp.apply_bcs(uend=(extend if it == 0 else None))
        solve(warp.AX, Delw.vector(), warp.R)

        eps = np.linalg.norm(Delw.vector().array(), ord=np.Inf)
        for i, fib in enumerate(warp.fibrils):
            fib.wx.vector(
            )[:] = fib.wx.vector()[:] - Delw.vector()[warp.mdof.part(i).dofs()]
        print " Newton iteration ", it, " infNorm = ", eps, "  ", (it != 0)
        it += 1

    warp.output_states("post/fibril_{0}_" + str(t) + ".pvd", 1)
    warp.output_contacts("post/contact_{2}_{0}_{1}.pvd")
    warp.output_surfaces("post/fibrilmesh_{0}_" + str(t + 1) + ".pvd", 1)

embed()
示例#3
0
    for i, fib in enumerate(warp.fibrils):
        fib.wx.interpolate(
            Expression(("(squeeze)*x[0]", "amplitude*cos(x[0]*period+phase)",
                        "amplitude*sin(x[0]*period+phase)", "0.0", " 0.0",
                        "0.0", "0.0", "0.0", "0.0", "0.0", "0.0"),
                       squeeze=-(restL - width) / restL,
                       period=np.pi / restL * NW / 2.0,
                       phase=(1.0 if i % 2 else 0.0) * np.pi,
                       amplitude=1.5 * scale))

        warp.wx.vector()[warp.mdof.part(i).dofs()] = fib.wx.vector()[:]
        warp.wv.vector()[warp.mdof.part(i).dofs()] = fib.wv.vector()[:]


warp.output_states("post/knit_{0}_" + str(0) + ".pvd", 1)
warp.output_surfaces("post/knitmesh_time_{0}_" + str(0) + ".pvd", 1)
initialize()
warp.output_states("post/knit_{0}_" + str(1) + ".pvd", 1)
warp.output_surfaces("post/knitmesh_time_{0}_" + str(1) + ".pvd", 1)

Tmax = 4.0
NT = 100
h = Tmax / NT
warp.create_contacts()
warp.assemble_mass()
dirk = DIRK_Monolithic(1, h, warp, warp.assemble_system, warp.update,
                       apply_BCs)
for t in xrange(NT):
    dirk.march()

    warp.output_states("post/knit_time_{0}_" + str(t + 2) + ".pvd", 1)
示例#4
0
        Expression(
            (" 0.0",
             "rate*(-x[1]*(sin(theta))+x[2]*(cos(theta)))*(x[0]+5.0)/10.0",
             "rate*(-x[1]*(cos(theta))-x[2]*(sin(theta)))*(x[0]+5.0)/10.0",
             "0.0", "0.0", "0.0", "0.0", "0.0", "0.0", "0.0", "0.0"),
            rate=Rate,
            theta=0.0,
            old_theta=0.0))
    warp.wx.vector()[warp.mdof.part(i).dofs()] = fib.wx.vector()[:]
    warp.wv.vector()[warp.mdof.part(i).dofs()] = fib.wv.vector()[:]
#
# Create the timestepper
#
dirk = DIRK_Monolithic(1, Tmax / NT, warp, warp.assemble_system, warp.update,
                       apply_BCs)

#
# Loop away
#
warp.assemble_mass()
warp.create_contacts()
warp.output_states("post/yarn_time_{0}_" + str(0) + ".pvd", 1)
warp.output_surfaces("post/yarnmesh_time_{0}_" + str(0) + ".pvd", 1)
for t in xrange(NT):
    dirk.march(t * Tmax / NT)
    warp.output_states("post/yarn_time_{0}_" + str(t + 1) + ".pvd", 1)
    warp.output_surfaces("post/yarnmesh_time_{0}_" + str(t + 1) + ".pvd", 1)

# Give me a terminal at the end so I can play around
embed()