← Back to team overview

yade-users team mailing list archive

[Question #691590]: what is the equivelant command of O.bodies[].dynamic=False for pfacet

 

New question #691590 on Yade:
https://answers.launchpad.net/yade/+question/691590

i am new user in yade. i am using 
Welcome to Yade 20200528-3950~da5194f~xenial1 
Using python version: 3.5.2 (default, Apr 16 2020, 17:47:17) 
[GCC 5.4.0 20160609]
Ubunto 16.04

*******************************************************************************************************
i have 2 problems:

   1. the whole geometry is falling down
   2.how to save in a text file (or list) the ids of pfacet 


hiba
********************************************************************************************************
#Script

from __future__ import print_function
from yade import qt
from yade.gridpfacet import *
import gts, os.path, locale
from builtins import range
from numpy import arange
import numpy as np
import random
from yade import plot
from yade import pack


locale.setlocale(locale.LC_ALL, 'en_US.UTF-8')   # Note: gts is locale-dependent. If, for example, german locale is used, gts.read()-function does not import floats normally

#'''if you get "Error: unsupported locale setting"-> type as root: "dpkg-reconfigure locales"-> choose "en_US.UTF-8" (press space to choose)'''

#ENGINES*******************************************************
#***************************************************************
def checkUnbalanced():
   print ('iter %d, time elapsed %f, unbalanced forces = %f'%(O.iter, O.realtime, utils.unbalancedForce()))
   #if unbalancedForce()<.05:  # to ensure stability
      #O.pause()
      #plot.saveDataTxt('strawbale-static-state.txt.bz2')

for b in O.bodies:
   b.state.refPos = b.state.pos

def addPlotData():
   Fz=O.forces.f(1)[2]
   w=O.bodies[1].state.pos[2]-O.bodies[1].state.refPos[2]
   plot.addData(Fz=Fz,w=w,unbalanced=unbalancedForce(),i=O.iter,p=O.realtime)


O.engines=[
	ForceResetter(),
	InsertionSortCollider([
		Bo1_Wall_Aabb(),
		Bo1_PFacet_Aabb(),
	],sortThenCollide=True),
	InteractionLoop(
	[
        Ig2_GridNode_GridNode_GridNodeGeom6D(),
		Ig2_Wall_PFacet_ScGeom(),Ig2_Wall_Sphere_ScGeom()
	],
	[
        Ip2_CohFrictMat_CohFrictMat_CohFrictPhys(setCohesionNow=True,setCohesionOnNewContacts=True),
		Ip2_FrictMat_FrictMat_FrictPhys()],
	[
        Law2_ScGeom6D_CohFrictPhys_CohesionMoment(),
		Law2_ScGeom_FrictPhys_CundallStrack(),
		Law2_ScGridCoGeom_FrictPhys_CundallStrack(),
		Law2_GridCoGridCoGeom_FrictPhys_CundallStrack()
	]),
    GlobalStiffnessTimeStepper(timestepSafetyCoefficient=0.005,label='ts'), 
	NewtonIntegrator(gravity=(0,0,-9.81),damping=0.1,label='newton')
]

#MATERIAL*************************
#Straw material
O.materials.append(LinCohesiveStiffPropDampElastMat(youngmodulus=3e7,density=120,label='pFacetMat'))
O.materials.append(CohFrictMat(young=3e7,poisson=0.2,density=120,frictionAngle=radians(45),normalCohesion=1e100,shearCohesion=1e100,momentRotationLaw=True,label='gridNodeMat'))

# wood material
O.materials.append(LinCohesiveStiffPropDampElastMat(youngmodulus=8.5e9,density=740,label='pFacetMatwood'))
O.materials.append(CohFrictMat(young=8.5e9,poisson=0.2,density=740,frictionAngle=radians(38),normalCohesion=1e100,shearCohesion=1e100,momentRotationLaw=True,label='gridNodeMatwood'))



#IMPORT MESH *************************************

radius=1e-02
wire=False
fixed=False


color1=[0,0,1]
color2=[0,0,3]

# COMPOSITION OF RANGE 1 level 1   ***************************************************
#*****************************************************************************************

nodesIds1,cylIds1,pfIds1 =  gtsPFacet('strawbalehor.gts',shift=(0.36,0.18,.23),scale=1,radius=radius,wire=wire,fixed=fixed,materialNodes='gridNodeMat',material='pFacetMat',color=color1)
nodesIds2,cylIds2,pfIds2 =  gtsPFacet('strawbalehor.gts',shift=(1.08,0.18,.23),scale=1,radius=radius,wire=wire,fixed=fixed,materialNodes='gridNodeMat',material='pFacetMat',color=color2)
nodesIds3,cylIds3,pfIds3 =  gtsPFacet('strawbalehor.gts',shift=(1.8,0.18,.23),scale=1,radius=radius,wire=wire,fixed=fixed,materialNodes='gridNodeMat',material='pFacetMat',color=color1)
nodesIds4,cylIds4,pfIds4 =  gtsPFacet('strawbalever.gts',shift=(1.98,0.72,.23),scale=1,radius=radius,wire=wire,fixed=fixed,materialNodes='gridNodeMat',material='pFacetMat',color=color2)
nodesIds5,cylIds5,pfIds5 =  gtsPFacet('strawbalever.gts',shift=(1.98,1.44,.23),scale=1,radius=radius,wire=wire,fixed=fixed,materialNodes='gridNodeMat',material='pFacetMat',color=color1)
nodesIds6,cylIds6,pfIds6 =  gtsPFacet('strawbalehor.gts',shift=(1.8,1.98,.23),scale=1,radius=radius,wire=wire,fixed=fixed,materialNodes='gridNodeMat',material='pFacetMat',color=color2)
nodesIds7,cylIds7,pfIds7 =  gtsPFacet('strawbalehor.gts',shift=(1.08,1.98,.23),scale=1,radius=radius,wire=wire,fixed=fixed,materialNodes='gridNodeMat',material='pFacetMat',color=color1)
nodesIds8,cylIds8,pfIds8 =  gtsPFacet('strawbalehor.gts',shift=(.36,1.98,.23),scale=1,radius=radius,wire=wire,fixed=fixed,materialNodes='gridNodeMat',material='pFacetMat',color=color2)
nodesIds9,cylIds9,pfIds9 =  gtsPFacet('strawbaleversmall.gts',shift=(.18,1.62,.23),scale=1,radius=radius,wire=wire,fixed=fixed,materialNodes='gridNodeMat',material='pFacetMat',color=color1)
nodesIds10,cylIds10,pfIds10 =  gtsPFacet('strawbaleversmall.gts',shift=(.18,.54,.23),scale=1,radius=radius,wire=wire,fixed=fixed,materialNodes='gridNodeMat',material='pFacetMat',color=color2)


# floor  **********************************************************
nodesIdsfloor,cylIdsfloor,pfIdsfloor =  gtsPFacet('floor-wood.gts',shift=(1.08,1.08,-0.05),scale=1,radius=radius,wire=wire,fixed=fixed,materialNodes='gridNodeMat',material='pFacetMatwood',color=color2)


# besides unbalanced force evolution, also plot the displacement-force diagram
plot.plots={'i':('unbalanced'),'w':('Fz')}
plot.plot(subPlots=False)


O.run()


#VIEW *************************************************************
#******************************************************************

qt.Controller()
qtv = qt.View()
qtr = qt.Renderer()
qtr.light2=True
qtr.lightPos=Vector3(1200,1500,500)
qtr.bgColor=[1,1,1]
qtv.ortho=True



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