Question #706302 on Yade changed: https://answers.launchpad.net/yade/+question/706302
Status: Answered => Solved 内山康太郎 confirmed that the question is solved: Thank you very much. I post the completed program (excerpt). ############################################################################## from __future__ import print_function from yade import pack,plot,polyhedra_utils,geom from yade import export,qt from yade.gridpfacet import * import math import numpy as np import os idsCyl2 = O.bodies.append(geom.facetCylinder((0, 0, 0.015), radius=.06, height=.01, segmentsNumber=30, wallMask=5)) O.engines = [ ForceResetter(), InsertionSortCollider([Bo1_Sphere_Aabb(),Bo1_Facet_Aabb(),Bo1_Box_Aabb()]), InteractionLoop( # interaction loop [Ig2_Sphere_Sphere_ScGeom(),Ig2_Facet_Sphere_ScGeom(),Ig2_Box_Sphere_ScGeom()], [Ip2_CohFrictMat_CohFrictMat_CohFrictPhys()], [Law2_ScGeom6D_CohFrictPhys_CohesionMoment(always_use_moment_law=True),Law2_ScGeom_FrictPhys_CundallStrack()] ), NewtonIntegrator(), ##TranslationEngine(translationAxis=[0,0,1],velocity=-1,ids=idsCyl3), TranslationEngine(ids=idsCyl2,label="translation"), PyRunner(iterPeriod=1,command="setTranslation()"), PyRunner(command='checkStress()', iterPeriod=10), PyRunner(command='plotPlotData()',iterPeriod=1), ] def setTranslation(): x = O.bodies[idsCyl2[0]].state.displ()[0] y = O.bodies[idsCyl2[0]].state.displ()[1] angle = atan2(y,x) a = Vector3(-sin(angle),cos(angle),0) v = 0.001 translation.translationAxis = a translation.velocity = v def checkStress(): cylDisplacement_x = O.bodies[idsCyl2[0]].state.displ()[0] cylDisplacement_y = O.bodies[idsCyl2[0]].state.displ()[1] plot.addData( cylDisplacement_x=cylDisplacement_x, cylDisplacement_y=cylDisplacement_y, ) print('{:1.04f}'.format(cylDisplacement_x)," ", '{:1.04f}'.format(cylDisplacement_y)) O.dt=0.5*PWaveTimeStep() def plotPlotData(): cylDisplacementx = O.bodies[idsCyl2[0]].state.displ()[0] cylDisplacementy = O.bodies[idsCyl2[0]].state.displ()[1] plot.addData( i=O.iter, cylDisplacementx=cylDisplacementx, cylDisplacementy=cylDisplacementy, ) plot.saveDataTxt('pipe_force.out',vars=('disp','force_x','force_y', 'Dz', 'cylDisplacementx','cylDisplacementx', )) plot.plots={ 'disp':('force_x','force_y'), 'i':('Dz'), 'cylDisplacementx':('cylDisplacementy',) } plot.plot() -- 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 : yade-users@lists.launchpad.net Unsubscribe : https://launchpad.net/~yade-users More help : https://help.launchpad.net/ListHelp