Question #696028 on Yade changed:
https://answers.launchpad.net/yade/+question/696028

    Status: Solved => Open

Fabio Caruso is still having a problem:
Hi Klaus,
I tried your suggestion to fix one node and apply a velocity at the other node 
and plot displacement vs normalForce in the interaction but yade gives me an 
error saying: 'NoneType' object has no attribute 'normalForce'
 
Below the code:

# encoding: utf-8
"""
Tensile test with 2 nodes and one gridconnection
"""
from builtins import zip
from yade import qt
from yade.gridpfacet import *
from numpy import linspace
from yade import plot

#Materials
O.materials.append(CohFrictMat(young=8e5,poisson=0.3,density=4e3,frictionAngle=radians(30),normalCohesion=1e5,shearCohesion=1e5,momentRotationLaw=True,label='gridNodeMat'))
O.materials.append(CohFrictMat(young=8e5,poisson=0.3,density=4e3,frictionAngle=radians(30),normalCohesion=1e5,shearCohesion=1e5,momentRotationLaw=True,label='gridCoMat'))

### Engines need to be defined first since the function gridConnection creates 
the interaction
O.engines=[
        ForceResetter(),
        InsertionSortCollider([
                Bo1_Sphere_Aabb(),
                Bo1_GridConnection_Aabb(),
        ]),
        InteractionLoop(
                # Geometric interactions
                [
          Ig2_GridNode_GridNode_GridNodeGeom6D(),
          Ig2_GridConnection_GridConnection_GridCoGridCoGeom(),
          Ig2_Sphere_GridConnection_ScGridCoGeom(),     # used for the cohesive 
sphere-cylinder interaction
        ],
                [
                # Interaction phusics
          
Ip2_CohFrictMat_CohFrictMat_CohFrictPhys(setCohesionNow=True,setCohesionOnNewContacts=False),
        ],
                # Interaction law
                [
          Law2_ScGeom6D_CohFrictPhys_CohesionMoment(), #internal forces, 
similar to cundallstrack but incorporates adhesion as well as bending and 
twisting moments
            Law2_ScGeom_FrictPhys_CundallStrack() #used for the external 
forces, takes into account elastic and frictional forces
        ]
        ),
        NewtonIntegrator(gravity=(0,0,0),damping=0,label='newton'),
        PyRunner(command='addPlotdata()',iterPeriod=100),
]

#Timestep
O.dt=5e-07

rCyl=0.01
nL=2
L=0.3
### Create the two nodes :
nodesIds=[]
for i in linspace(0,L,nL):
  nodesIds.append( O.bodies.append(
    gridNode([i,0,0],rCyl,wire=True,fixed=False,material='gridNodeMat') ) )

### Now create connection between the nodes
for i,j in zip( nodesIds[:-1], nodesIds[1:]):
  O.bodies.append( gridConnection(i,j,rCyl,
                                  material='gridCoMat'
                                  ) )

# rename the two nodes
s1 = O.bodies[0]
s2 = O.bodies[1]
#Define what you want to plot
plot.plots = {'L': 'FN'}

#Apply 2 normal force along the x direction on the nodes (Simulating
tensile stress)

s1.state.blockedDOFs = 'x' #fix the first node
s2.state.vel = (1,0,0) #apply a constant velocity to the second node


def addPlotdata():
    L = s2.state.pos[0]-s1.state.pos[0]
    FN = O.interactions[0, 1].phys.normalForce[0]
    plot.addData(L=L, FN=FN)


plot.plot()
qt.View()
O.saveTmp()


O.run()

O.stopAtIter=int(10/O.dt)

-- 
You received this question notification because your team yade-users is
an answer contact for Yade.

_______________________________________________
Mailing list: https://launchpad.net/~yade-users
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~yade-users
More help   : https://help.launchpad.net/ListHelp

Reply via email to