Has ZeroInitForce been implemented?

Asked by Gianni Pellegrini

Hello,
following this open discussion:
https://answers.launchpad.net/yade/+question/619109
I would like to know if the "bool Law2::zeroInitForce." has been already implemented (or not, since the discussion is still open).
Otherwise, is there any way to create an offset for the particle overlapping in order to set to zero the initial contact forces ?
The offset should be kept only for existing interactions

Is there any new implementation or I need to refer to the link posted above?
Thanks

Question information

Language:
English Edit question
Status:
Solved
For:
Yade Edit question
Assignee:
No assignee Edit question
Solved by:
Jérôme Duriez
Solved:
Last query:
Last reply:
Revision history for this message
Bruno Chareyre (bruno-chareyre) said :
#1

Hi,
The documentation should tell you if it is implemented for a particular functor.
If it isn't, an easy way to offset is explained in #1 of the discussion you are linking [1] (the rest of the discussion is worth a read too).
Bruno

[1] https://answers.launchpad.net/yade/+question/619109

Revision history for this message
Gianni Pellegrini (antrox) said (last edit ):
#2

Hi,
thank you, Bruno.
I thought that the function name have been changed during these years.

I think I was able to follow the same method used in the discussion.
If I am not wrong, the initial values of the cohesion (normal and shear) can be any positive number to make it work.
The real values would be set up through
for i in O.interactions:
  i.phys.unp = i.geom.penetrationDepth

since fragile=False?

Thank you

This is my MWE but it needs a saved version of the cell and packing.

from yade import pack, export, ymport
import numpy as np

frictionAngle = 0.5
sigmaIso=-1e5
poisson=0.2
R=1e-3
rate=1e-4
density= 1e12
alphaKr=2.0
alphaKtw=2.0
etaRoll=0.1
young=1E9
cohN=0
cohT=0
#SETTINGS
O.periodic = True
ac = np.load('T1.cellSizeCloud.npy')
O.cell.hSize=ac

############################################################
pp = O.materials.append(CohFrictMat(
 young=young,
 poisson=poisson,
 frictionAngle=frictionAngle,
 density=density,
 isCohesive=True,
    fragile=False,
 alphaKr=alphaKr,
 alphaKtw=alphaKtw,
 momentRotationLaw=True,
 etaRoll=etaRoll,
    normalCohesion=cohN,
    shearCohesion=cohT,
 ))
############################################################
O.engines = [
        ForceResetter(
               ),
        InsertionSortCollider([Bo1_Sphere_Aabb()]),
        InteractionLoop([Ig2_Sphere_Sphere_ScGeom6D()], [Ip2_CohFrictMat_CohFrictMat_CohFrictPhys(setCohesionNow=True,setCohesionOnNewContacts=False)],[Law2_ScGeom6D_CohFrictPhys_CohesionMoment(useIncrementalForm=True,always_use_moment_law=True)]),
        NewtonIntegrator(damping=.2),
        PyRunner(command='Test()', realPeriod=1),
 ]

O.cell.velGrad=Matrix3(0,0,0,0,0,0,0,0,0)
packing = ymport.text("T1.packing",color=(1,1,0),material=pp)
O.bodies.append(packing)
O.step()
#overlaps = [i.geom.penetrationDepth for i in O.interactions]
#print(overlaps)
O.dt = 0.5 * PWaveTimeStep()
print(' pressure:', getStress().trace() / 3.)
for i in O.interactions:
  i.phys.unp = i.geom.penetrationDepth
print('changing')

def Test():
    print(' pressure:', getStress().trace() / 3.)
    #if (getStress().trace() / 3.) > -1e3:
        #print('Done')
        #O.pause()

O.run()

Revision history for this message
Best Jérôme Duriez (jduriez) said :
#3

Why not checking directly ? In a actual MWE fashion for more fun:

O.materials.append(CohFrictMat(normalCohesion = 10,isCohesive=True,fragile=False)) # note a different behavior with normalCohesion = 0 (?)
O.bodies.append([sphere((0,0,z),1,fixed=True) for z in [0,1.8]])
O.engines = [
    ForceResetter(),
    InsertionSortCollider([Bo1_Sphere_Aabb()]),
    InteractionLoop([Ig2_Sphere_Sphere_ScGeom6D()], [Ip2_CohFrictMat_CohFrictMat_CohFrictPhys(setCohesionNow=True,setCohesionOnNewContacts=False)],[Law2_ScGeom6D_CohFrictPhys_CohesionMoment(useIncrementalForm=True,always_use_moment_law=True)]),
    NewtonIntegrator(damping=.2)
    ]

O.step()
cont = O.interactions[0,1]
print('\nBefore tricking unp, normal contact force is',cont.phys.normalForce)
cont.phys.unp = cont.geom.penetrationDepth
O.step()
print('After, normal contact force is',cont.phys.normalForce,'\n')

Revision history for this message
Gianni Pellegrini (antrox) said :
#5

Thanks Jérôme Duriez, that solved my question.