5
9.12.2014 ToyGL info page http://transfert.lmgc.univmontp2.fr/~averseng/JA/ToyGL_info_page/Entrees/2012/12/28_ToyGLStructure___detailed_help.html 1/5 Bienvenue ToyGLStructure # # ToyGLStructure .py # # A class to generate pinjointed structures # as a preprocessing to ToyGL # # Julien Averseng, dec. 2012 # [email protected] #(www.lmgc.univmontp2.fr/~javersen) # # Modules numpy , os , sys Classes Element ElementFamilyData Node NodeFamilyData ToyGLStructure class Element A class defining a pinjointed element : starting node index ending node index family normal force unconstrained length Methods defined here: __init__(self, no_start=1, no_end=1, family=0, l0=1, N_force=0.0) class ElementFamilyData A class containing an Element 's characteristics : mass density Young's modulus in tension Young's modulus in compression cross section area radius contact rigidity color (RGB) TOYGLSTRUCTURE : REFERENCE 28/12/12 ToyGL info page 2012

ToyGL Info Page

  • Upload
    nie

  • View
    11

  • Download
    6

Embed Size (px)

DESCRIPTION

Estructuras

Citation preview

  • 9.12.2014 ToyGLinfopage

    http://transfert.lmgc.univmontp2.fr/~averseng/JA/ToyGL_info_page/Entrees/2012/12/28_ToyGLStructure___detailed_help.html 1/5

    Bienvenue

    ToyGLStructure##ToyGLStructure.py##Aclasstogeneratepinjointedstructures#asapreprocessingtoToyGL##JulienAverseng,dec.2012#[email protected]#(www.lmgc.univmontp2.fr/~javersen)##

    Modulesnumpy,os,sys

    ClassesElementElementFamilyDataNodeNodeFamilyDataToyGLStructure

    classElementAclassdefiningapinjointedelement:startingnodeindexendingnodeindexfamilynormalforceunconstrainedlength

    Methodsdefinedhere:__init__(self,no_start=1,no_end=1,family=0,l0=1,N_force=0.0)

    classElementFamilyDataAclasscontaininganElement'scharacteristics:massdensityYoung'smodulusintensionYoung'smodulusincompressioncrosssectionarearadiuscontactrigiditycolor(RGB)

    TOYGLSTRUCTURE:REFERENCE 28/12/12

    ToyGLinfopage 2012

  • 9.12.2014 ToyGLinfopage

    http://transfert.lmgc.univmontp2.fr/~averseng/JA/ToyGL_info_page/Entrees/2012/12/28_ToyGLStructure___detailed_help.html 2/5

    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

    classNodeAclassedefininganode:positionx,y,zvelocityvx,vy,vzfamily

    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

    classNodeFamilyDataAclasscontainingaNode'scharacteristics:massvisual(andcontact)radiuscontactstiffness(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

    classToyGLStructureAclassthatdescribesapinjointedstructure:listofNodeslistofElementslistofblockedNodes[no,bx,by,bz](bi=0meansthenodeisfreealongtheithdof)listofNodes'sfamiliesdatalistofElements'familiesdatatimestepfortimesimulationandothersparameters

  • 9.12.2014 ToyGLinfopage

    http://transfert.lmgc.univmontp2.fr/~averseng/JA/ToyGL_info_page/Entrees/2012/12/28_ToyGLStructure___detailed_help.html 3/5

    Methodsdefinedhere:RAZ(self)Initializationwith0noeudsand0elements("RemiseAZero")

    __init__(self)Initialization

    add_structure_at(self,st0,pos=[0.0,0.0,0.0])Addstheelementsofst0tothecurrentstructureDoesatranslationbyposbefore(default=[0,0,0])Doesn'tmergeyetthefamiliesdata

    axial_force_element(self,ind_elem)Returntheaxialforceofanalement

    block_node_XYZ(self,id_no,bx,by,bz)Blockthenodealongxyandz0meansfree,anythingelsemeansblocked

    create_element_pt1_f1_pt2_f2_fam(self,pt1,fam1,pt2,fam2,family)Createstheelementdefinedbythetwogeometricalpointspt1andpt2Returntheindexofthenewelement,ortheindexoftheexistingoneCreatesthenodesifneeded.ThisshouldbeoneoftherarefunctionstobeusedwhencreatingastructureL0issettothedistancebetweenthenodesoN_force=0

    create_element_pt1_f1_pt2_f2_fam_l0(self,pt1,fam1,pt2,fam2,family,l0)Createstheelementdefinedbythetwogeometricalpointspt1andpt2Returntheindexofthenewelement,ortheindexoftheexistingoneCreatesthenodesifneeded.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)Teststheexistenceofthegeometricalelementbetweenpt1andpt2Returnsitsindexifitexists,1else

    id_node(self,pt3d)Testsfortheexistenceofageometricalnodeatpt3d(atupleof3real)

    Returnsitsidinself.Nodesifitexists,1else

    length_element(self,id_elem)Givethelengthofanelement

    load_from_toygl(self,nom_fich)FileimportfromatextfilegeneratedbyToyGL

  • 9.12.2014 ToyGLinfopage

    http://transfert.lmgc.univmontp2.fr/~averseng/JA/ToyGL_info_page/Entrees/2012/12/28_ToyGLStructure___detailed_help.html 4/5

    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)SavethedefinitionofthesysteminatextfileintheformatreadableusingToyGLTheformatis: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_axiale(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)SettheunconstrainedlengthofanelementtomakeitcorrespondtoitsnormalforceN_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)

  • 9.12.2014 ToyGLinfopage

    http://transfert.lmgc.univmontp2.fr/~averseng/JA/ToyGL_info_page/Entrees/2012/12/28_ToyGLStructure___detailed_help.html 5/5

    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)

    Suivant>