Professional Documents
Culture Documents
2014
ToyGLinfopage
Bienvenue
ToyGLinfopage
TOYGLSTRUCTURE:REFERENCE
2012
28/12/12
ToyGLStructure
#
#ToyGLStructure.py
#
#Aclasstogeneratepinjointedstructures
#asapreprocessingtoToyGL
#
#JulienAverseng,dec.2012
#julien.averseng@univmontp2.fr
#(www.lmgc.univmontp2.fr/~javersen)
#
#
Modules
numpy,os,sys
Classes
Element
ElementFamilyData
Node
NodeFamilyData
ToyGLStructure
classElement
Aclassdefiningapinjointedelement:
startingnodeindex
endingnodeindex
family
normalforce
unconstrainedlength
Methodsdefinedhere:
__init__(self,no_start=1,no_end=1,family=0,l0=1,N_force=0.0)
classElementFamilyData
AclasscontaininganElement'scharacteristics:
massdensity
Young'smodulusintension
Young'smodulusincompression
crosssectionarea
radius
contactrigidity
color(RGB)
http://transfert.lmgc.univmontp2.fr/~averseng/JA/ToyGL_info_page/Entrees/2012/12/28_ToyGLStructure___detailed_help.html
1/5
9.12.2014
ToyGLinfopage
Methodsdefinedhere:
__init__(self,mass_density=1000.0,E_trac=100000000000.0,E_comp=100000000000.0,A=0.0001,
radius=0.1,contact_stiffness=1000.0,axial_viscosity=0.1,color=[1.0,0.0,0.0])
Initialization
copy_data(self,efd)
CopyfromanotherinstanceofElementFamilyData
classNode
Aclassedefininganode:
positionx,y,z
velocityvx,vy,vz
family
Methodsdefinedhere:
__init__(self,x=0.0,y=0.0,z=0.0,vx=0.0,vy=0.0,vz=0.0,family=0)
Initializationwith(0,0,0)
force(self)
Assignedforce(loading)
pos(self)
Currentpositionofthenode
vel(self)
Currentvelocityofthenode
classNodeFamilyData
AclasscontainingaNode'scharacteristics:
mass
visual(andcontact)radius
contactstiffness(N/m)
contactviscosity(N.s/m)
visualcolor(R,G,B)
Methodsdefinedhere:
__init__(self,mass=1.0,radius=0.1,contact_stiffness=1000.0,contact_viscosity=1.0,color=[1.0,0.0,
0.0])
copy_data(self,nfd)
CopyfromanotherinstanceofNodeFamilyData
classToyGLStructure
Aclassthatdescribesapinjointedstructure:
listofNodes
listofElements
listofblockedNodes[no,bx,by,bz](bi=0meansthenodeisfreealongthe
ithdof)
listofNodes'sfamiliesdata
listofElements'familiesdata
timestepfortimesimulationandothersparameters
http://transfert.lmgc.univmontp2.fr/~averseng/JA/ToyGL_info_page/Entrees/2012/12/28_ToyGLStructure___detailed_help.html
2/5
9.12.2014
ToyGLinfopage
Methodsdefinedhere:
RAZ(self)
Initializationwith0noeudsand0elements("RemiseAZero")
__init__(self)
Initialization
add_structure_at(self,st0,pos=[0.0,0.0,0.0])
Addstheelementsofst0tothecurrentstructure
Doesatranslationbyposbefore(default=[0,0,0])
Doesn'tmergeyetthefamiliesdata
axial_force_element(self,ind_elem)
Returntheaxialforceofanalement
block_node_XYZ(self,id_no,bx,by,bz)
Blockthenodealongxyandz
0meansfree,anythingelsemeansblocked
create_element_pt1_f1_pt2_f2_fam(self,pt1,fam1,pt2,fam2,family)
Createstheelementdefinedbythetwogeometricalpointspt1andpt2
Returntheindexofthenewelement,ortheindexoftheexistingone
Createsthenodesifneeded.
Thisshouldbeoneoftherarefunctionstobeusedwhencreatingastructure
L0issettothedistancebetweenthenodesoN_force=0
create_element_pt1_f1_pt2_f2_fam_l0(self,pt1,fam1,pt2,fam2,family,l0)
Createstheelementdefinedbythetwogeometricalpointspt1andpt2
Returntheindexofthenewelement,ortheindexoftheexistingone
Createsthenodesifneeded.
Thisshouldbeoneoftherarefunctionstobeusedwhencreatingastructure
create_node(self,pt3d,family=0)
Addsanodeatthegeometricalpositiongiveninpt3d
Returnsitsidinself.nodes,checkingitsexistencebefore
delete_element(self,id_el)
Deletestheelementwithid=id_el
delete_node(self,id_no)
Deletesthenodewithid=id_noandthedependingelements
id_element(self,pt1,pt2)
Teststheexistenceofthegeometricalelementbetweenpt1andpt2
Returnsitsindexifitexists,1else
id_node(self,pt3d)
Testsfortheexistenceofageometricalnodeatpt3d(atupleof3real)
Returnsitsidinself.Nodesifitexists,1else
length_element(self,id_elem)
Givethelengthofanelement
load_from_toygl(self,nom_fich)
FileimportfromatextfilegeneratedbyToyGL
http://transfert.lmgc.univmontp2.fr/~averseng/JA/ToyGL_info_page/Entrees/2012/12/28_ToyGLStructure___detailed_help.html
3/5
9.12.2014
ToyGLinfopage
load_node_XYZ(self,id_no,fx,fy,fz)
Assignaforce(loading)tothenode
mass_element(self,ind)
Returnthemassofanelement=A*l0*mdens
mass_node(self,ind)
Renvoielamassed'unnoeud
mass_total(self)
Returnthemassofthestructure
save_for_toygl(self,fich)
SavethedefinitionofthesysteminatextfileintheformatreadableusingToyG
L
Theformatis:
noeuds=
familyxyzvxvyvz
...
elements=
familyno_startno_endn_force
...
caracteristiquesfamillesnoeuds=
idmass(kg)r(m)K_contact(N/m)C_contact(N/ms1)couleur[RVB]
...
caracteristiqueselements=
idm_vol(kg/m3)E_trac(Pa)E_comp(Pa)A(m2)r(m)K_contact(N/m)C_axial
e(N/ms1)couleur[RVB]
...
noeudsbloques=
idbxbybz(0=free,blockedelse)
...
pasdetemps=
timestep
set_element_family_Etrac_Ecomp_A_Mdens(self,id_fam,E_trac,E_comp,A,Mdens)
QuicksettingofYoung'smoduli,crosssectionalareaandmassdensity
set_element_family_cont_stiffness_axial_viscosity(self,id_fam,cont_stiffness,axial_viscosity)
Quicksettingofcontactstiffnessandaxialviscosity
set_element_family_radius_color(self,id_fam,radius,color)
Quicksettingofradiusandcolor
set_families_from_structure(self,s0)
Setthecharacteristicsfromthoseofthestructures0
set_l0_element(self,ind_elem)
Settheunconstrainedlengthofanelementtomakeitcorrespondtoits
normalforceN_force
set_l0_structure(self)
Settheunconstrainedlengthsinthestructure,fromtheinitialtensions
set_node_family_contact_stifness_viscosity(self,family,contact_stiffness,contact_viscosity)
Quicksettingofcontactpropertiesforanode'sfamily
set_node_family_mass_radius_color(self,family,mass,radius,color)
http://transfert.lmgc.univmontp2.fr/~averseng/JA/ToyGL_info_page/Entrees/2012/12/28_ToyGLStructure___detailed_help.html
4/5
9.12.2014
ToyGLinfopage
Quicksettingofmassandradiusforanode'sfamily
translate_xyz(self,dx,dy,dz)
Translationofthestructurebyvector[dx,dy,dz]
Functions
Utilityfunctions:
distance(pt1,pt2)
Returnsthedistance(2norm)betweentwopoints
distance_inf(pt1,pt2)
Returnsthedistance(infinitynorm)betweentwopoints
(generatedusingpydoc)
<Prcdent
http://transfert.lmgc.univmontp2.fr/~averseng/JA/ToyGL_info_page/Entrees/2012/12/28_ToyGLStructure___detailed_help.html
Suivant>
5/5