File: wiretensiltest.py

package info (click to toggle)
yade 2025.2.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 33,308 kB
  • sloc: cpp: 93,298; python: 50,409; sh: 577; makefile: 162
file content (169 lines) | stat: -rw-r--r-- 5,432 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
# -*- encoding=utf-8 -*-
from yade import plot

#### short description of script
print('This script shows a tensile test of a net by using the UniaxialStrainer')

#### define parameters for the net
# wire diameter
d = 2.7 / 1000.
# particle radius
radius = d * 4.
# define piecewise lineare stress-strain curve
strainStressValues = [(0.0019230769, 2.5e8), (0.0192, 3.2195e8), (0.05, 3.8292e8), (0.15, 5.1219e8), (0.25, 5.5854e8), (0.3, 5.6585e8), (0.35, 5.6585e8)]
# elastic material properties
particleVolume = 4. / 3. * pow(radius, 3) * pi
particleMass = 3.9 / 1000.
density = particleMass / particleVolume
young = strainStressValues[0][1] / strainStressValues[0][0]
poisson = 0.3

#### material definition
netMat = O.materials.append(
        WireMat(
                young=young,
                poisson=poisson,
                frictionAngle=radians(30),
                density=density,
                isDoubleTwist=True,
                diameter=d,
                strainStressValues=strainStressValues,
                lambdaEps=0.4,
                lambdak=0.66
        )
)

wireMat = O.materials.append(
        WireMat(
                young=young,
                poisson=poisson,
                frictionAngle=radians(30),
                density=density,
                isDoubleTwist=False,
                diameter=3.4 / 1000,
                strainStressValues=strainStressValues
        )
)

#### get net packing
kw = {'color': [1, 1, 0], 'wire': True, 'highlight': False, 'fixed': False, 'material': netMat}
[netpack, lx,
 ly] = hexaNet(radius=radius, cornerCoord=[0, 0, 0], xLength=1.0, yLength=0.55, mos=0.08, a=0.04, b=0.04, startAtCorner=False, isSymmetric=True, **kw)
O.bodies.append(netpack)
print('Real net length in x-direction [m]: ', lx)
print('Real net length in y-direction [m]: ', ly)

#### get bodies for single wire at the boundary in y-direction and change properties
bb = uniaxialTestFeatures(axis=0)
negIds, posIds = bb['negIds'], bb['posIds']

for id in negIds:
	O.bodies[id].material = O.materials[wireMat]
	O.bodies[id].shape.color = [0, 0, 1]
for id in posIds:
	O.bodies[id].material = O.materials[wireMat]
	O.bodies[id].shape.color = [0, 0, 1]

#### define engines to create link
interactionRadius = 2.8
O.engines = [
        ForceResetter(),
        InsertionSortCollider([Bo1_Sphere_Aabb(aabbEnlargeFactor=interactionRadius, label='aabb')]),
        InteractionLoop(
                [Ig2_Sphere_Sphere_ScGeom(interactionDetectionFactor=interactionRadius, label='Ig2ssGeom')],
                [Ip2_WireMat_WireMat_WirePhys(linkThresholdIteration=1, label='interactionPhys')],
                [Law2_ScGeom_WirePhys_WirePM(linkThresholdIteration=1, label='interactionLaw')]
        ),
        NewtonIntegrator(damping=0.),
]

#### define additional vertical interactions at the boundary
createInteraction(negIds[0], negIds[2])
createInteraction(negIds[3], negIds[4])
createInteraction(negIds[5], negIds[6])
createInteraction(negIds[7], negIds[1])
createInteraction(posIds[0], posIds[2])
createInteraction(posIds[3], posIds[4])
createInteraction(posIds[5], posIds[6])
createInteraction(posIds[7], posIds[1])

#### time step definition for first time step to create links
O.step()

#### initialize values for UniaxialStrainer
bb = uniaxialTestFeatures(axis=1)
negIds, posIds, axis, crossSectionArea = bb['negIds'], bb['posIds'], bb['axis'], bb['area']
strainRateTension = 0.1
setSpeeds = True

##### delete horizontal interactions for corner particles
bb = uniaxialTestFeatures(axis=1)
negIds, posIds, axis, crossSectionArea = bb['negIds'], bb['posIds'], bb['axis'], bb['area']

##### delete some interactions
O.interactions.erase(0, 4)
O.interactions.erase(0, 5)
O.interactions.erase(1, 154)
O.interactions.erase(1, 155)
O.interactions.erase(2, 26)
O.interactions.erase(2, 27)
O.interactions.erase(3, 176)
O.interactions.erase(3, 177)

#### time step definition for deleting some links which have been created by the Ig2 functor
O.step()

#### initializes now the interaction detection factor
aabb.aabbEnlargeFactor = -1.
Ig2ssGeom.interactionDetectionFactor = -1.

#### define engines for simulation with UniaxialStrainer
O.engines = O.engines[:3] + [
        UniaxialStrainer(
                strainRate=strainRateTension,
                axis=axis,
                asymmetry=1,
                posIds=posIds,
                negIds=negIds,
                crossSectionArea=crossSectionArea,
                blockDisplacements=True,
                blockRotations=False,
                setSpeeds=setSpeeds,
                label='strainer'
        ),
        NewtonIntegrator(damping=0.5),
        PyRunner(initRun=True, iterPeriod=1000, command='addPlotData()'),
]

#### plot some results
plot.plots = {'un': ('Fn',)}
plot.plot(noShow=False, subPlots=False)


def addPlotData():
	Fn = 0.
	for i in posIds:
		try:
			inter = O.interactions.withBody(i)[0]
			F = abs(inter.phys.normalForce[1])
		except:
			F = 0
		Fn += F
	un = O.bodies[O.bodies[posIds[0]].id].state.pos[1] - O.bodies[O.bodies[posIds[0]].id].state.refPos[1]
	if un > 0.10:
		O.pause()
	plot.addData(un=un * 1000, Fn=Fn / 1000)


#### time step definition for simulation
## critical time step proposed by Bertrand
kn = 16115042  # stiffness of single wire from code
O.dt = 0.2 * sqrt(particleMass / (2. * kn))

#### to see it
from yade import qt

v = qt.Controller()
v = qt.View()
rr = qt.Renderer()
rr.intrAllWire = True