コード例 #1
0
ファイル: truss1.py プロジェクト: luzpaz/paraFEM
import paraFEM
import numpy as np

mat = paraFEM.TrussMaterial(1000)
mat.rho = 1
mat.d_structural = 0.0
mat.d_velocity = 1

node1 = paraFEM.Node(-1, 0, 0)
node2 = paraFEM.Node(0, 0, 0)
node3 = paraFEM.Node(1, 0, 0)

node1.fixed = np.array([0, 0, 0])
node3.fixed = np.array([0, 0, 0])
node2.add_external_force(np.array([0, 1, 0]))

truss1 = paraFEM.Truss([node1, node2], mat)
truss2 = paraFEM.Truss([node2, node3], mat)

case = paraFEM.Case([truss1, truss2])

writer = paraFEM.vtkWriter("/tmp/paraFEM/truss1_py/output")

for i in range(10000):
    case.explicitStep(0.01)
    if (i % 10) == 0:
        writer.writeCase(case, 0.3)
コード例 #2
0
n5 = paraFEM.Node(1, -1, 0)
n6 = paraFEM.Node(1, 0, 0)

n1.fixed = paraEigen.vector3(0, 0, 0)
n6.fixed = paraEigen.vector3(0, 0, 0)

n3.add_external_force(paraEigen.vector3(0, -100, 0))
n4.add_external_force(paraEigen.vector3(0, -0, 0))

membrane_mat = paraFEM.MembraneMaterial(100, 0.3)
membrane_mat.d_velocity = 0.0
membrane_mat.rho = 0.001

truss_mat = paraFEM.TrussMaterial(10000)
truss_mat.d_velocity = 0.000
truss_mat.d_structural = 0
truss_mat.rho = 0.001

m1 = paraFEM.Membrane3([n2, n3, n4], membrane_mat)
m2 = paraFEM.Membrane3([n2, n5, n4], membrane_mat)
t1 = paraFEM.Truss([n1, n2], truss_mat)
t2 = paraFEM.Truss([n6, n5], truss_mat)

case = paraFEM.Case([m1, m2, t1])
writer = paraFEM.vtkWriter("/tmp/test_mbr_truss/bla")

for i in range(50000):
    case.makeStep(h=0.000001)
    if i % 1000 == 0:
        writer.writeCase(case, 0.1)
コード例 #3
0
ファイル: profil.py プロジェクト: pingyuan162/paraFEM
for i, node in enumerate(nodes):
    if i in fixed:
        n = fem.Node(*(node.position + eigen.vector3(0, -0.1, 0)))
        n.fixed = eigen.vector3(0, 0, 0)
        line = fem.Truss([nodes[i], n], mat1)
        lines.append(line)
    node.fixed = eigen.vector3(1, 1, 0)
for i in boundary[:-1]:
    force = pressure[i] / 2 * panels[i].n
    nodes[i].add_external_force(eigen.vector3(force.x, force.y, 0))
    nodes[i + 1].add_external_force(eigen.vector3(force.x, force.y, 0))

# 6: case
case = fem.Case(elements + lines)

writer = fem.vtkWriter("/tmp/paraFEM/profil_test")
writer.writeCase(case, 0.0)

steps = 1000
steps_ramp = 100

line_forces = []

for i in range(steps):
    ramp = 1 - (i < steps_ramp) * (1 - float(i) / steps_ramp)
    case.explicitStep(1.40675e-05, ramp)
    if (i % 2) == 0:
        print(i)
        line_forces.append([l.getStress().norm() for l in lines])
        writer.writeCase(case, 0.)
コード例 #4
0
ファイル: truss1.py プロジェクト: pingyuan162/paraFEM
import paraFEM
import paraEigen as eigen

mat = paraFEM.TrussMaterial(1000)
mat.rho = 1
mat.d_structural = 0.1
mat.d_velocity = 5

node1 = paraFEM.Node(-1, 0, 0)
node2 = paraFEM.Node(0, 0, 0)
node3 = paraFEM.Node(1, 0, 0)

node1.fixed = eigen.vector3(0, 0, 0)
node3.fixed = eigen.vector3(0, 0, 0)
node2.add_external_force(eigen.vector3(0, 1, 0))

truss1 = paraFEM.Truss([node1, node2], mat)
truss2 = paraFEM.Truss([node2, node3], mat)

case = paraFEM.Case([truss1, truss2])

writer = paraFEM.vtkWriter("/tmp/paraFEM/test")

for i in range(1000):
    case.explicitStep(0.01)
    if (i % 10) == 0:
    	writer.writeCase(case, 0.3)
コード例 #5
0
ファイル: profil.py プロジェクト: booya-at/paraFEM
for i, node in enumerate(nodes):
    if i in fixed:
        n = fem.Node(*(node.position + paraBEM.Vector3(0, -0.1, 0)))
        n.fixed = paraBEM.Vector3(0, 0, 0)
        line = fem.Truss([nodes[i], n], mat1)
        lines.append(line)
    node.fixed = paraBEM.Vector3(1, 1, 0)
for i in boundary[:-1]:
    force = pressure[i] / 2 * panels[i].n
    nodes[i].add_external_force(paraBEM.Vector3(force.x, force.y, 0))
    nodes[i + 1].add_external_force(paraBEM.Vector3(force.x, force.y, 0))

# 6: case
case = fem.Case(elements + lines)

writer = fem.vtkWriter("/tmp/paraFEM/profil_test")
writer.writeCase(case, 0.0)

steps = 10000
steps_ramp = 1

line_forces = []

for i in range(steps):
    ramp = 1 - (i < steps_ramp) * (1 - float(i) / steps_ramp)
    case.explicitStep(case.getExplicitMaxTimeStep()[0] / 2, ramp)
    if (i % 500) == 0:
        print(i)
        line_forces.append([np.linalg.norm(l.getStress()) for l in lines])
        writer.writeCase(case, 0.)