WireMat -> Change Force Displacement curve during simulation

Asked by Loic Dugelas

Hi everyone,

I've got an issue in my simulation. I want to change the properties of a WirePhys interaction during the simulation. I thought about two options to do this :
- Deleting the existing interaction and changing the existing Wiremat for a new one with the wanted properties. But in this case, the new interaction (added with "createInteraction(id1,id2)") is not taken into account in the simulation (the interaction exist during 1 step and then disappear). Maybe you have a idea why ? But let's concentrate on the second option.
- The second option I tried is directly change the properties in the WirePhys by modifying "O.interactions[id1,id2].phys.displForceValues". But in this case, the new properties are not taken. You can see it in this little script below.

Have you any idea how to solve this ? I put my script of the second option below,
Thank you,
Loïc

##############################################################################

# encoding: utf-8

from yade import qt, plot
from yade.gridpfacet import *
import gts, os, locale, sys
import numpy as np

O.engines=[
 ForceResetter(),
 InsertionSortCollider([Bo1_Sphere_Aabb()]),
 InteractionLoop(
                 [Ig2_Sphere_Sphere_ScGeom()],
                 [Ip2_WireMat_WireMat_WirePhys()],
                 [Law2_ScGeom_WirePhys_WirePM()]),
 NewtonIntegrator(gravity=(0,0,0),damping=0.1,label='newton'),
 PyRunner(initRun=False,iterPeriod=1500, nDo = 2,command='modif()'),
 PyRunner(initRun=True,iterPeriod=1000,command='addPlotData()'),]

RWire = 0.012
SSvalues = [(5.16,1.54e8),(130,1.67e8),(103280,3.9e12)]
Wiremat = O.materials.append(WireMat(young=1e9, poisson=0.3,frictionAngle=radians(10),density=1000,isDoubleTwist=False,diameter=2*RWire,strainStressValues=SSvalues))

Wire = []
Wire.extend([
O.bodies.append(utils.sphere([0,-RWire,0],RWire,wire=False,fixed=False,material=Wiremat)),
O.bodies.append(utils.sphere([0,+RWire,0],RWire,wire=False,fixed=False,material=Wiremat))])

O.bodies[Wire[1]].state.blockedDOFs='xyzXYZ'
O.bodies[Wire[0]].state.vel[1]=-0.05
O.bodies[Wire[0]].state.blockedDOFs='xyzXYZ'

plot.plots={'U':('F')}
plot.plot(noShow=False, subPlots=False)
v=qt.Controller()
v=qt.View()
rr = qt.Renderer()
rr.intrAllWire = True

O.dt = 1e-5
O.saveTmp()
O.run()

def addPlotData():
    F = O.forces.f(Wire[0])[1]
    U = O.bodies[Wire[0]].state.pos[1] - O.bodies[Wire[0]].state.refPos[1]
    plot.addData(U=-U*1000, F=F/1000 )

def modif():

    O.pause()
    NewFD = [
    (-0.179,-100000),
    (-3.12,-105000),
    (-2500,-1.4e9),]
    print NewFD[0]
    print NewFD[1]
    print NewFD[2]

    O.interactions[Wire[0],Wire[1]].phys.displForceValues[1] = NewFD[0]
    O.interactions[Wire[0],Wire[1]].phys.displForceValues[2] = NewFD[1]
    O.interactions[Wire[0],Wire[1]].phys.displForceValues[3] = NewFD[2]

    print O.interactions[Wire[0],Wire[1]].phys.displForceValues[1]
    print O.interactions[Wire[0],Wire[1]].phys.displForceValues[2]
    print O.interactions[Wire[0],Wire[1]].phys.displForceValues[3]

Question information

Language:
English Edit question
Status:
Answered
For:
Yade Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Klaus Thoeni (klaus.thoeni) said :
#1

Hi,

here my short answers:

add 1: in order to create an interaction you need to execute 1 step, i.e., just createInteraction(id1,id2) is not enough. In your case you are deleting an equilibrium state and adding a new state. What about the equilibrium in the new state?
add 2: just changing these values would not work. You would have to update all variables in the physics and the contact law (history etc.), i.e., you would have to replicate the C++ code in your script to some extent.

Now I have a question, why would you like to change the stress-strain behaviour during a simulation? Are you looking a time-dependent behaviour? I am just trying to better understand what you are trying to do and what the best options could be.

Klaus

Revision history for this message
Loic Dugelas (ldugelas) said :
#2

Hi Klaus,

Thank you for your answer, I'm trying to do this in order to save computation time. My simulation is in two phases, the first one is quite long, and the second shorter. I want to modify some parameters in the beginning of the second phase. Like that, I can use O.save for the first (long) phase and make the parametric study without launching the first phase every time.

Do you think it's possible ?

Loïc

Revision history for this message
Klaus Thoeni (klaus.thoeni) said :
#3

It should be possible if you don't change the equilibrium state. So let's say in your first phase you are loading up to a specific strain (or displacement). For the second phase you change only the behaviour thereafter. You still need to replicate parts of the C++ code to assign all relevant parameters (displForceValues, stiffnessValues). This is because everything is initialised at the creation of an interaction and the C++ code assumes it can not change during the simulation. Also, you would not be able to change the number of points of the stress-strain curve, hence start with the maximum points (it doesn't matter if they are on one line).

Klaus

Can you help with this problem?

Provide an answer of your own, or ask Loic Dugelas for more information if necessary.

To post a message you must log in.