diff --git a/analysis.py b/analysis.py index b699f61..8050950 100644 --- a/analysis.py +++ b/analysis.py @@ -10,21 +10,22 @@ def solve(sg_xml, analysis, solver, scrnout=True): - """ + """Solve Parameters ---------- sg_xml : str - File name of SG design parameters (XML format) + File name of SG design parameters (XML format). analysis : str - Analysis to be carried out - h - homogenization - d - dehomogenization/localization/recover - f - initial failure strength - fe - initial failure envelope - fi - initial failure indices and strength ratios + Analysis to be carried out. + + * h - homogenization + * d - dehomogenization/localization/recover + * f - initial failure strength + * fe - initial failure envelope + * fi - initial failure indices and strength ratios solver : str - Format of the generated input file ('vabs' or 'swiftcomp') + Format of the generated input file ('vabs' or 'swiftcomp'). """ # Preprocess @@ -49,26 +50,26 @@ def solve(sg_xml, analysis, solver, scrnout=True): def run(input_name, analysis, solver, smdim, scrnout=True): - """ Run codes + """Run codes. Parameters ---------- solver : str - Excect command string of the code ('vabs' or 'swiftcomp') + Excect command string of the code ('vabs' or 'swiftcomp'). input_name : str - Name of the input file + Name of the input file. analysis : str - Analysis to be carried out - h - homogenization - d or l - dehomogenization/localization/recover - f - initial failure strength - fe - initial failure envelope - fi - initial failure indices and strength ratios - smdim : int - Dimension of the macroscopic structural model + Analysis to be carried out. - :param scrnout: Print solver messages - :type scrnout: bool + * h - homogenization + * d or l - dehomogenization/localization/recover + * f - initial failure strength + * fe - initial failure envelope + * fi - initial failure indices and strength ratios + smdim : int + Dimension of the macroscopic structural model. + scrnout : bool + Print solver messages. """ try: analysis_long = { diff --git a/analysis.pyc b/analysis.pyc index 18137af..8f7a5bc 100644 Binary files a/analysis.pyc and b/analysis.pyc differ diff --git a/doc/build/doctrees/analysis.doctree b/doc/build/doctrees/analysis.doctree new file mode 100644 index 0000000..ff9fdc2 Binary files /dev/null and b/doc/build/doctrees/analysis.doctree differ diff --git a/doc/build/doctrees/environment.pickle b/doc/build/doctrees/environment.pickle index dc20486..ca3fdd6 100644 Binary files a/doc/build/doctrees/environment.pickle and b/doc/build/doctrees/environment.pickle differ diff --git a/doc/build/doctrees/index.doctree b/doc/build/doctrees/index.doctree index acacf1c..0713011 100644 Binary files a/doc/build/doctrees/index.doctree and b/doc/build/doctrees/index.doctree differ diff --git a/doc/build/doctrees/ioutils.doctree b/doc/build/doctrees/ioutils.doctree index 49e0110..1061b3e 100644 Binary files a/doc/build/doctrees/ioutils.doctree and b/doc/build/doctrees/ioutils.doctree differ diff --git a/doc/build/doctrees/iovabs.doctree b/doc/build/doctrees/iovabs.doctree index d2e1dc7..c8572ca 100644 Binary files a/doc/build/doctrees/iovabs.doctree and b/doc/build/doctrees/iovabs.doctree differ diff --git a/doc/build/doctrees/presg.doctree b/doc/build/doctrees/presg.doctree new file mode 100644 index 0000000..286b837 Binary files /dev/null and b/doc/build/doctrees/presg.doctree differ diff --git a/doc/build/doctrees/sg.doctree b/doc/build/doctrees/sg.doctree index 03ffccf..fe48717 100644 Binary files a/doc/build/doctrees/sg.doctree and b/doc/build/doctrees/sg.doctree differ diff --git a/doc/build/html/_sources/analysis.rst.txt b/doc/build/html/_sources/analysis.rst.txt new file mode 100644 index 0000000..2a3cb13 --- /dev/null +++ b/doc/build/html/_sources/analysis.rst.txt @@ -0,0 +1,13 @@ +analysis Module +=============== + +.. highlight:: python + +:: + + import msgpi.analysis + +.. autofunction:: msgpi.analysis.solve + +.. autofunction:: msgpi.analysis.run + diff --git a/doc/build/html/_sources/index.rst.txt b/doc/build/html/_sources/index.rst.txt index a18e361..cc41001 100644 --- a/doc/build/html/_sources/index.rst.txt +++ b/doc/build/html/_sources/index.rst.txt @@ -13,6 +13,8 @@ Welcome to Some scripts's documentation! sg iovabs ioutils + presg + analysis Indices and tables ================== diff --git a/doc/build/html/_sources/presg.rst.txt b/doc/build/html/_sources/presg.rst.txt new file mode 100644 index 0000000..a9c8241 --- /dev/null +++ b/doc/build/html/_sources/presg.rst.txt @@ -0,0 +1,15 @@ +presg Module +============ + +.. highlight:: python + +:: + + import msgpi.presg + +.. autofunction:: msgpi.presg.readMaterialFromXMLElement + +.. autofunction:: msgpi.presg.preSG1D + +.. autofunction:: msgpi.presg.preSG + diff --git a/doc/build/html/analysis.html b/doc/build/html/analysis.html new file mode 100644 index 0000000..04daa40 --- /dev/null +++ b/doc/build/html/analysis.html @@ -0,0 +1,263 @@ + + + + + + + + + + + analysis Module — msgpi documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +
+ + + + + +
+ +
+ + + + + + + + + + + + + + + + + +
+ + + + +
+
+
+
+ +
+

analysis Module

+
import msgpi.analysis
+
+
+
+
+msgpi.analysis.solve(sg_xml, analysis, solver, scrnout=True)
+

Solve

+ +++ + + + +
Parameters:
    +
  • sg_xml (str) – File name of SG design parameters (XML format).
  • +
  • analysis (str) –

    Analysis to be carried out.

    +
      +
    • h - homogenization
    • +
    • d - dehomogenization/localization/recover
    • +
    • f - initial failure strength
    • +
    • fe - initial failure envelope
    • +
    • fi - initial failure indices and strength ratios
    • +
    +
  • +
  • solver (str) – Format of the generated input file (‘vabs’ or ‘swiftcomp’).
  • +
+
+
+ +
+
+msgpi.analysis.run(input_name, analysis, solver, smdim, scrnout=True)
+

Run codes.

+ +++ + + + +
Parameters:
    +
  • solver (str) – Excect command string of the code (‘vabs’ or ‘swiftcomp’).
  • +
  • input_name (str) – Name of the input file.
  • +
  • analysis (str) –

    Analysis to be carried out.

    +
      +
    • h - homogenization
    • +
    • d or l - dehomogenization/localization/recover
    • +
    • f - initial failure strength
    • +
    • fe - initial failure envelope
    • +
    • fi - initial failure indices and strength ratios
    • +
    +
  • +
  • smdim (int) – Dimension of the macroscopic structural model.
  • +
  • scrnout (bool) – Print solver messages.
  • +
+
+
+ +
+ + +
+ +
+ + +
+
+ +
+ +
+ + + + + + + + + + + + \ No newline at end of file diff --git a/doc/build/html/genindex.html b/doc/build/html/genindex.html index a872791..94b56dc 100644 --- a/doc/build/html/genindex.html +++ b/doc/build/html/genindex.html @@ -84,6 +84,8 @@
  • Class Module for MSM Structure Gene
  • SG I/O Module for VABS
  • I/O Utility Functions
  • +
  • presg Module
  • +
  • analysis Module
  • @@ -151,6 +153,7 @@

    Index

    A + | C | D | E | F @@ -174,10 +177,28 @@

    A

    +

    C

    + + + +
    +

    D

    +
    @@ -185,11 +206,21 @@

    D

    E

    - +
    Parameters:fn (str) – VABS output file name (e.g. example.sg.k)
    Parameters:
      +
    • fn (str) – VABS output file name (e.g. example.sg.k).
    • +
    • scrnout (bool) – Whether to print message to screen.
    • +
    +
    @@ -194,7 +198,27 @@

    Writing Functions
    msgpi.io.iovabs.writeVABSIn(sg, fn_vabs_in='', fmt=1)
    -
    +

    Write SG to VABS input file

    + +++ + + + + + + + +
    Parameters:
      +
    • sg (StructureGene) – Structure Gene that will be written to file.
    • +
    • fn_vabs_in (str) – File name.
    • +
    • fmt (int) – Format of the input file.
    • +
    +
    Returns:

    VABS input file name.

    +
    Return type:

    str

    +
    +
    diff --git a/doc/build/html/objects.inv b/doc/build/html/objects.inv index 172a9d3..ad30697 100644 Binary files a/doc/build/html/objects.inv and b/doc/build/html/objects.inv differ diff --git a/doc/build/html/presg.html b/doc/build/html/presg.html new file mode 100644 index 0000000..d617082 --- /dev/null +++ b/doc/build/html/presg.html @@ -0,0 +1,277 @@ + + + + + + + + + + + presg Module — msgpi documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + +
    + + + + + +
    + +
    + + + + + + + + + + + + + + + + + +
    + + + + +
    +
    +
    +
    + +
    +

    presg Module

    +
    import msgpi.presg
    +
    +
    +
    +
    +msgpi.presg.readMaterialFromXMLElement(xem)
    +

    Read material data from XML elements.

    +
    + +
    +
    +msgpi.presg.preSG1D(xr_sg, smdim)
    +

    Preprocessor of 1D SG.

    + +++ + + + + + + + +
    Parameters:
      +
    • xr_sg (xml.etree.ElementTree.Element) – Root element of the input file.
    • +
    • smdim (int) – Dimension of the material/structural model.
    • +
    +
    Returns:

    Structure Gene.

    +
    Return type:

    StructureGene

    +
    +
    + +
    +
    +msgpi.presg.preSG(sg_xml, analysis, solver='swiftcomp', write_input=True, scrnout=True)
    +

    Preprocessor of a structure gene.

    + +++ + + + + + +
    Parameters:
      +
    • sg_xml (str) – File name of SG design parameters (XML format)
    • +
    • analysis (str) –

      The analysis that will be carried out after the generation of +the input file.

      +
        +
      • h - homogenization
      • +
      • d - dehomogenization/localization/recover
      • +
      • f - initial failure strength
      • +
      • fe - initial failure envelope
      • +
      • fi - initial failure indices and strength ratios
      • +
      +
    • +
    • solver (str) – Format of the generated input file (‘vabs’ or ‘swiftcomp’)
    • +
    • write_input (bool) – Whether to write input file.
    • +
    • scrnout (bool) – Whether to print messages to the screen.
    • +
    +
    Returns:

      +
    • str, int – (If write_input True) Input file name, dimension of the material/structural model.
    • +
    • StructureGene – (If write_input False) Structure Gene.
    • +
    +

    +
    +
    + +
    + + +
    + +
    + + +
    +
    + +
    + +
    + + + + + + + + + + + + \ No newline at end of file diff --git a/doc/build/html/search.html b/doc/build/html/search.html index fa0a1e3..80b1434 100644 --- a/doc/build/html/search.html +++ b/doc/build/html/search.html @@ -84,6 +84,8 @@
  • Class Module for MSM Structure Gene
  • SG I/O Module for VABS
  • I/O Utility Functions
  • +
  • presg Module
  • +
  • analysis Module
  • diff --git a/doc/build/html/searchindex.js b/doc/build/html/searchindex.js index 81dca0f..2cb4329 100644 --- a/doc/build/html/searchindex.js +++ b/doc/build/html/searchindex.js @@ -1 +1 @@ -Search.setIndex({docnames:["index","ioutils","iovabs","sg"],envversion:{"sphinx.domains.c":1,"sphinx.domains.changeset":1,"sphinx.domains.cpp":1,"sphinx.domains.javascript":1,"sphinx.domains.math":2,"sphinx.domains.python":1,"sphinx.domains.rst":1,"sphinx.domains.std":1,sphinx:54},filenames:["index.rst","ioutils.rst","iovabs.rst","sg.rst"],objects:{"msgpi.io.iovabs":{readVABSIn:[2,0,1,""],readVABSOutHomo:[2,0,1,""],writeVABSElementOrientations:[2,0,1,""],writeVABSElements:[2,0,1,""],writeVABSIn:[2,0,1,""],writeVABSMOCombos:[2,0,1,""],writeVABSMacroData:[2,0,1,""],writeVABSMaterials:[2,0,1,""],writeVABSNodes:[2,0,1,""]},"msgpi.io.utils":{textToMatrix:[1,0,1,""],writeFormatFloats:[1,0,1,""],writeFormatFloatsMatrix:[1,0,1,""],writeFormatIntegers:[1,0,1,""],writeFormatIntegersMatrix:[1,0,1,""]},"msgpi.sg":{MaterialSection:[3,1,1,""],StructureGene:[3,1,1,""]},"msgpi.sg.StructureGene":{analysis:[3,2,1,""],degen_element:[3,2,1,""],elem_orient:[3,2,1,""],elem_prop:[3,2,1,""],elements:[3,2,1,""],findComboByMaterialOrientation:[3,3,1,""],findMaterialByName:[3,3,1,""],fn_gmsh_msh:[3,2,1,""],global_displacements:[3,2,1,""],global_loads:[3,2,1,""],global_loads_dist:[3,2,1,""],global_loads_type:[3,2,1,""],global_rotations:[3,2,1,""],initial_curvature:[3,2,1,""],initial_twist:[3,2,1,""],materials:[3,2,1,""],mocombos:[3,2,1,""],model:[3,2,1,""],nodes:[3,2,1,""],nonuniform_temperature:[3,2,1,""],num_slavenodes:[3,2,1,""],oblique:[3,2,1,""],physics:[3,2,1,""],prop_elem:[3,2,1,""],summary:[3,3,1,""],trans_element:[3,2,1,""]}},objnames:{"0":["py","function","Python function"],"1":["py","class","Python class"],"2":["py","attribute","Python attribute"],"3":["py","method","Python method"]},objtypes:{"0":"py:function","1":"py:class","2":"py:attribute","3":"py:method"},terms:{"2e12":3,"2k12":3,"class":0,"default":3,"float":[1,3],"function":0,"import":[1,2,3],"int":3,"return":1,"true":[1,2],The:1,after:1,all:1,analysi:3,angl:3,append:1,arrai:1,beam:3,bernoulli:3,block:[1,3],bool:1,brief:3,c11:3,c12:3,c13:3,c21:3,c22:3,c23:3,c31:3,c32:3,c33:3,calcctmkeypoint:[],calcul:[],charact:1,cid:3,classic:3,combin:3,conduct:3,configur:3,connect:3,constitut:[],content:0,convert:1,coordin:3,cross:[],curvatur:3,data:2,defualt:3,degen_el:3,dehomogen:3,desir:1,dimens:3,dimensiona:3,distribut:3,e11:3,e12:3,e13:3,e22:3,e23:3,e33:3,each:1,effect:3,eid:3,elast:3,elem_ori:3,elem_prop:3,element:3,euler:3,exampl:[1,2],failur:3,file:[1,2,3],find:3,findcombobymaterialorient:3,findmaterialbynam:3,finit:3,flag:3,flatten:[],fmt:[1,2],fn_gmsh_msh:3,fn_vabs_in:2,fobj:[1,2],format:1,from:2,g12:3,g13:3,g23:3,gene:0,gener:3,genom:[],global:3,global_displac:3,global_load:3,global_loads_dist:3,global_loads_typ:3,global_rot:3,gmsh:3,going:1,height:[],homogen:[2,3],includ:3,index:0,initi:3,initial_curvatur:3,initial_twist:3,input:2,integ:1,iovab:2,k11:3,k12:3,k13:3,k22:3,kei:[],kirchhoff:3,length:[],lenticular:[],level:3,line:1,list:1,load:3,local:3,love:3,m11:3,m12:3,m22:3,macroscop:3,materi:0,materialsect:3,matrix:1,mesh:3,microscop:[],mid:3,middl:[],mindlin:3,mocombo:3,model:3,modul:0,msg:3,msgpi:[1,2,3],msm:0,msmio:[],n11:3,n12:3,n13:3,n22:3,n23:3,name:[2,3],newlin:1,nid1:3,nid2:3,nid:3,nodal:3,node:3,none:3,nonuniform_temperatur:3,num_slavenod:3,number:[1,3],numpi:1,object:[1,3],obliqu:3,onli:3,option:3,orient:3,output:2,page:0,paramet:[1,2,3],physic:3,piezoelectr:3,piezoelectromagnet:3,piezomagnet:3,plate:3,point:[],print:3,prop_elem:3,properti:3,radian:[],radiu:[],read:0,readvabsin:2,readvabsouthomo:2,recov:3,refin:3,reissner:3,repres:1,result:2,s11:3,s12:3,s13:3,s22:3,s23:3,s33:3,scrnout:2,search:0,section:0,sff:2,sfi:2,sgdim:3,shell:3,side:[],slave:3,smdim:3,solid:3,store:3,str:[2,3],strain:3,stress:3,string:1,structur:0,structuregen:3,subtend:[],summari:3,swiftcomp:3,temperatur:3,tempscript:[],text:1,textlist:1,texttomatrix:1,theori:3,thermoelast:3,thermopiezoelectr:3,thermopiezoelectromagnet:3,thermopiezomagnet:3,timoshenko:3,trans_el:3,transform:3,trapez:3,twist:3,type:[1,3],uniform:3,util:0,vab:[0,3],vlasov:3,web:[],what:[],writ:1,write:[0,1],writeformatfloat:1,writeformatfloatsmatrix:1,writeformatinteg:1,writeformatintegersmatrix:1,writevabsel:2,writevabselementorient:2,writevabsin:2,writevabsmacrodata:2,writevabsmateri:2,writevabsmocombo:2,writevabsnod:2,written:1,zero:3},titles:["Welcome to Some scripts\u2019s documentation!","I/O Utility Functions","SG I/O Module for VABS","Class Module for MSM Structure Gene"],titleterms:{"class":3,"function":[1,2],beam:[],code:[],cross:[],document:0,gene:3,genom:[],indic:0,materi:3,modul:[2,3],msm:3,other:[],read:2,script:0,section:3,some:0,structur:3,tabl:0,util:1,vab:2,welcom:0,write:2}}) \ No newline at end of file +Search.setIndex({docnames:["analysis","index","ioutils","iovabs","presg","sg"],envversion:{"sphinx.domains.c":1,"sphinx.domains.changeset":1,"sphinx.domains.cpp":1,"sphinx.domains.javascript":1,"sphinx.domains.math":2,"sphinx.domains.python":1,"sphinx.domains.rst":1,"sphinx.domains.std":1,sphinx:54},filenames:["analysis.rst","index.rst","ioutils.rst","iovabs.rst","presg.rst","sg.rst"],objects:{"msgpi.analysis":{run:[0,0,1,""],solve:[0,0,1,""]},"msgpi.io.iovabs":{readVABSIn:[3,0,1,""],readVABSOutHomo:[3,0,1,""],writeVABSElementOrientations:[3,0,1,""],writeVABSElements:[3,0,1,""],writeVABSIn:[3,0,1,""],writeVABSMOCombos:[3,0,1,""],writeVABSMacroData:[3,0,1,""],writeVABSMaterials:[3,0,1,""],writeVABSNodes:[3,0,1,""]},"msgpi.io.utils":{textToMatrix:[2,0,1,""],writeFormatFloats:[2,0,1,""],writeFormatFloatsMatrix:[2,0,1,""],writeFormatIntegers:[2,0,1,""],writeFormatIntegersMatrix:[2,0,1,""]},"msgpi.presg":{preSG1D:[4,0,1,""],preSG:[4,0,1,""],readMaterialFromXMLElement:[4,0,1,""]},"msgpi.sg":{MaterialSection:[5,1,1,""],StructureGene:[5,1,1,""]},"msgpi.sg.MaterialSection":{compliance:[5,2,1,""],compliance_refined:[5,2,1,""],constants:[5,2,1,""],density:[5,2,1,""],eff_props:[5,2,1,""],failure_criterion:[5,2,1,""],mass_center:[5,2,1,""],mass_mc:[5,2,1,""],mass_origin:[5,2,1,""],name:[5,2,1,""],shear_center:[5,2,1,""],smdim:[5,2,1,""],stiffness:[5,2,1,""],stiffness_refined:[5,2,1,""],strength:[5,2,1,""],type:[5,2,1,""]},"msgpi.sg.StructureGene":{analysis:[5,2,1,""],degen_element:[5,2,1,""],elem_orient:[5,2,1,""],elem_prop:[5,2,1,""],elementids1d:[5,2,1,""],elementids2d:[5,2,1,""],elementids3d:[5,2,1,""],elementids:[5,2,1,""],elements:[5,2,1,""],findComboByMaterialOrientation:[5,3,1,""],findMaterialByName:[5,3,1,""],fn_gmsh_msh:[5,2,1,""],global_displacements:[5,2,1,""],global_loads:[5,2,1,""],global_loads_dist:[5,2,1,""],global_loads_type:[5,2,1,""],global_rotations:[5,2,1,""],initial_curvature:[5,2,1,""],initial_twist:[5,2,1,""],materials:[5,2,1,""],mocombos:[5,2,1,""],model:[5,2,1,""],name:[5,2,1,""],nodes:[5,2,1,""],nonuniform_temperature:[5,2,1,""],num_slavenodes:[5,2,1,""],oblique:[5,2,1,""],omega:[5,2,1,""],physics:[5,2,1,""],prop_elem:[5,2,1,""],sgdim:[5,2,1,""],smdim:[5,2,1,""],summary:[5,3,1,""],trans_element:[5,2,1,""]}},objnames:{"0":["py","function","Python function"],"1":["py","class","Python class"],"2":["py","attribute","Python attribute"],"3":["py","method","Python method"]},objtypes:{"0":"py:function","1":"py:class","2":"py:attribute","3":"py:method"},terms:{"2e12":5,"2k12":5,"class":1,"default":5,"float":[2,5],"function":1,"import":[0,2,3,4,5],"int":[0,2,3,4,5],"return":[2,3,4,5],"true":[0,2,3,4],The:[2,4],after:[2,4],all:2,analysi:[1,4,5],angl:5,anisotrop:5,append:2,arrai:2,beam:5,bernoulli:5,block:2,bool:[0,2,3,4],brief:5,c11:5,c12:5,c13:5,c21:5,c22:5,c23:5,c31:5,c32:5,c33:5,calcctmkeypoint:[],calcul:[],carri:[0,4],center:5,charact:2,cid:5,classic:5,code:0,combin:5,command:0,complianc:5,compliance_refin:5,conduct:5,configur:5,connect:5,constant:5,constitut:[],content:1,continuum:5,convert:2,coordin:5,criterion:5,cross:[],curvatur:5,data:[3,4],defualt:5,degen_el:5,dehomogen:[0,4,5],densiti:5,deprec:5,design:[0,4],desir:2,dict:5,dimens:[0,4,5],dimensiona:[],displac:5,distribut:5,e11:5,e12:5,e13:5,e22:5,e23:5,e33:5,each:[2,5],eff_prop:5,effect:5,eid:5,elast:5,elem_ori:5,elem_prop:5,element:[4,5],elementid:5,elementids1d:5,elementids2d:5,elementids3d:5,elementtre:4,engin:5,envelop:[0,4],etre:4,euler:5,exampl:[2,3],excect:0,failur:[0,4,5],failure_criterion:5,fals:4,file:[0,2,3,4,5],find:5,findcombobymaterialorient:5,findmaterialbynam:5,finit:5,flag:5,flatten:[],fmt:[2,3],fn_gmsh_msh:5,fn_vabs_in:3,fobj:[2,3],format:[0,2,3,4],found:5,from:[3,4],g12:5,g13:5,g23:5,gene:[1,3,4],gener:[0,4,5],genom:[],global:5,global_displac:5,global_load:5,global_loads_dist:5,global_loads_typ:5,global_rot:5,gmsh:5,going:2,goint:2,height:[],homogen:[0,3,4,5],ids:5,includ:5,index:1,indic:[0,4],initi:[0,4,5],initial_curvatur:5,initial_twist:5,input:[0,3,4],input_nam:0,integ:2,iovab:3,isotrop:5,isotropi:5,k11:5,k12:5,k13:5,k22:5,kei:5,kirchhoff:5,length:[],lenticular:[],level:5,line:2,list:[2,5],load:5,local:[0,4,5],love:5,m11:5,m12:5,m22:5,macroscop:[0,5],manual:5,mass:5,mass_cent:5,mass_mc:5,mass_origin:5,materi:[1,4],materialsect:5,matrix:[2,5],mesh:5,messag:[0,3,4],microscop:[],mid:5,middl:[],mindlin:5,mocombo:5,model:[0,4,5],modul:1,msg:5,msgpi:[0,2,3,4,5],msm:1,msmio:[],n11:5,n12:5,n13:5,n22:5,n23:5,name:[0,3,4,5],newlin:2,nid1:5,nid2:5,nid:5,nodal:5,node:5,none:5,nonuniform_temperatur:5,nu12:5,nu13:5,nu23:5,num_slavenod:5,number:[2,5],numpi:2,object:[2,5],obliqu:5,omega:5,onli:5,option:[],orient:5,origin:5,orthotrop:5,out:[0,4],output:[2,3],page:1,paramet:[0,2,3,4,5],physic:5,piezoelectr:5,piezoelectromagnet:5,piezomagnet:5,plate:5,point:[],preprocessor:4,presg1d:4,presg:1,print:[0,3,4,5],prop_elem:5,properti:5,radian:[],radiu:[],ratio:[0,4],read:[1,4],readmaterialfromxmlel:4,readvabsin:3,readvabsouthomo:3,recov:[0,4,5],refin:5,reissner:5,repres:2,result:3,root:4,rotat:5,run:0,s11:5,s12:5,s13:5,s22:5,s23:5,s33:5,screen:[3,4],scrnout:[0,3,4],search:1,section:1,see:5,sff:3,sfi:3,sg_xml:[0,4],sgdim:5,shear:5,shear_cent:5,shell:5,side:[],slave:5,smdim:[0,4,5],solid:[],solv:0,solver:[0,4],stiff:5,stiffness_refin:5,store:5,str:[0,2,3,4,5],strain:5,strength:[0,4,5],stress:5,string:0,structur:[0,1,3,4],structuregen:[3,4,5],subtend:[],summari:5,swiftcomp:[0,4,5],temperatur:5,tempscript:[],text:2,textlist:2,texttomatrix:2,theori:5,thermoelast:5,thermopiezoelectr:5,thermopiezoelectromagnet:5,thermopiezomagnet:5,timoshenko:5,trans_el:5,transform:5,trapez:5,twist:5,type:[2,3,4,5],uniform:5,util:1,vab:[0,1,4,5],vlasov:5,web:[],what:[],whether:[3,4],writ:2,write:[1,2,4],write_input:4,writeformatfloat:2,writeformatfloatsmatrix:2,writeformatinteg:2,writeformatintegersmatrix:2,writevabsel:3,writevabselementorient:3,writevabsin:3,writevabsmacrodata:3,writevabsmateri:3,writevabsmocombo:3,writevabsnod:3,written:[2,3],xem:4,xml:[0,4],xr_sg:4,zero:5},titles:["analysis Module","Welcome to Some scripts\u2019s documentation!","I/O Utility Functions","SG I/O Module for VABS","presg Module","Class Module for MSM Structure Gene"],titleterms:{"class":5,"function":[2,3],analysi:0,beam:[],code:[],cross:[],document:1,gene:5,genom:[],indic:1,materi:5,modul:[0,3,4,5],msm:5,other:[],presg:4,read:3,script:1,section:5,some:1,structur:5,tabl:1,util:2,vab:3,welcom:1,write:3}}) \ No newline at end of file diff --git a/doc/build/html/sg.html b/doc/build/html/sg.html index 48e1277..403fb45 100644 --- a/doc/build/html/sg.html +++ b/doc/build/html/sg.html @@ -169,12 +169,240 @@

    Material Section -Parameters:smdim (int, optional) – Dimension of material/structure model. Defualt to 3. +Parameters:smdim (int) – Dimension of material/structure model. +Beam (1), plate/shell (2), or 3D continuum (3). +Defualt to 3. + + + +
    +
    +compliance = None
    +

    Compliance matrix.

    + +++ + + + +
    Type:list(list(float))
    +
    + +
    +
    +compliance_refined = None
    +

    (beam/plate/shell models) Refined compliance matrix

    + +++ + + + +
    Type:list(list(float))
    +
    + +
    +
    +constants = None
    +

    Engineering constants. +Keys: e1, e2, e3, nu12, nu13, nu23, g12, g13, g23

    + +++ + + + +
    Type:dict
    +
    + +
    +
    +density = None
    +

    Density of the material/structure.

    + +++ +
    Type:float
    +
    +
    +eff_props = None
    +

    (will be deprecated) Effective properties of the material/structure

    + +++ + + + +
    Type:dict
    +
    + +
    +
    +failure_criterion = None
    +

    Failure criterion.

    + +++ + + + +
    Type:int
    +
    + +
    +
    +mass_center = None
    +

    Mass center.

    + +++ + + + +
    Type:list(float)
    +
    + +
    +
    +mass_mc = None
    +

    Mass matrix at the mass center.

    + +++ + + + +
    Type:list(list(float))
    +
    + +
    +
    +mass_origin = None
    +

    Mass matrix at the origin.

    + +++ + + + +
    Type:list(list(float))
    +
    + +
    +
    +name = None
    +

    Name of the material/structure.

    + +++ + + + +
    Type:str
    +
    + +
    +
    +shear_center = None
    +

    (beam model) Shear center.

    + +++ + + + +
    Type:list(float)
    +
    + +
    +
    +smdim = None
    +

    Dimension of material/structure model.

    + +++ + + + +
    Type:int
    +
    + +
    +
    +stiffness = None
    +

    Stiffness matrix.

    + +++ + + + +
    Type:list(list(float))
    +
    + +
    +
    +stiffness_refined = None
    +

    (beam/plate/shell models) Refined stiffness matrix

    + +++ + + + +
    Type:list(list(float))
    +
    + +
    +
    +strength = None
    +

    Strength properties.

    + +++ + + + +
    Type:dict
    +
    + +
    +
    +type = None
    +

    (continuum model) Isotropy type. +Isotropic (0), orthotropic (1), anisotropic (2).

    + +++ + + + +
    Type:int
    +
    + +

    +

    Structure Gene

    @@ -188,8 +416,9 @@

    Structure Gene Parameters:
    • name (str) – Name of the SG.
    • -
    • sgdim (int) – Dimensiona of the SG.
    • -
    • smdim (int) – Dimension of the material/structural model. (1: beam, 2: plate/shell, 3: solid/block)
    • +
    • sgdim (int) – Dimension of the SG.
    • +
    • smdim (int) – Dimension of the material/structural model. +Beam (1), plate/shell (2), 3D continuum (3).
    @@ -204,30 +433,129 @@

    Structure Gene + + + +Type:int + + +
    degen_element = None

    Flag of the type of elements (SC)

    + +++ + + + +
    Type:int
    elem_orient = None
    -

    {eid: [[a1, a2, a3], [b1, b2, b3], [c1, c2, c3]], …}

    +

    Element local orientations.

    +

    {eid: [[a1, a2, a3], [b1, b2, b3], [c1, c2, c3]], …}

    + +++ + + + +
    Type:dict(int, list(list(float)))
    elem_prop = None
    -

    {eid: mid/cid, …}

    +

    Material/Combination id for each element.

    +

    {eid: mid/cid, …}

    + +++ + + + +
    Type:dict(int, int)
    +
    + +
    +
    +elementids = None
    +

    Element ids

    + +++ + + + +
    Type:list(int)
    +
    + +
    +
    +elementids1d = None
    +

    1D element ids

    + +++ + + + +
    Type:list(int)
    +
    + +
    +
    +elementids2d = None
    +

    2D element ids

    + +++ + + + +
    Type:list(int)
    +
    + +
    +
    +elementids3d = None
    +

    3D element ids

    + +++ + + + +
    Type:list(int)
    elements = None
    -

    Elemental connectivities {eid: [nid1, nid2, …], …}, no zeros

    +

    Elemental connectivities

    +

    {eid: [nid1, nid2, …], …}, no zeros

    + +++ + + + +
    Type:dict(int, list(int))
    @@ -238,12 +566,18 @@

    Structure Gene -Parameters:
      +Parameters:
      • name (str) – Material name.
      • angle (float) – Orientation angle.
      +Returns:

      Combination id. 0 if not found.

      + + +Return type:

      int

      + +

    @@ -258,6 +592,10 @@

    Structure Gene Parameters:name (str) – Material name. +Returns:Material id. 0 if not found. + +Return type:int + @@ -271,111 +609,289 @@

    Structure Gene
    global_displacements = None
    -

    [u1, u2, u3]

    +

    Global displacements.

    +

    [u1, u2, u3]

    + +++ + + + +
    Type:list(float)
    global_loads = None
    -

    Global loads -3D structures

    +

    Global loads

    +
      +
    • 3D continuum model
    • +
    +
    +
      +
    • generalized stresses = [s11, s22, s33, s23, s13, s12]
    • +
    • generalized strains = [e11, e22, e33, e23, e13, e12]
    • +
    +
    +
      +
    • Kirchhoff-Love plate/shell model
    • +
    +
    +
      +
    • generalized stresses = [N11, N22, N12, M11, M22, M12]
    • +
    • generalized strains = [e11, e22, 2e12, k11, k22, 2k12]
    • +
    +
    +
      +
    • Reissner-Mindlin plate/shell model
    • +
    +
    +
      +
    • generalized stresses = [N11, N22, N12, M11, M22, M12, N13, N23]
    • +
    • generalized strains = [e11, e22, 2e12, k11, k22, 2k12, g13, g23]
    • +
    +
    +
      +
    • Euler-Bernoulli beam model
    • +
    +
    +
      +
    • generalized stresses = [F1, M1, M2, M3]
    • +
    • generalized strains = [e11, k11, k12, k13]
    • +
    +
    +
      +
    • Timoshenko beam model
    • +
    -
    generalized stresses = [s11, s22, s33, s23, s13, s12] -generalized strains = [e11, e22, e33, e23, e13, e12]
    -
    -
    Kirchhoff-Love plate/shell model
    -
    generalized stresses = [N11, N22, N12, M11, M22, M12] -generalized strains = [e11, e22, 2e12, k11, k22, 2k12]
    -
    Reissner-Mindlin plate/shell model
    -
    generalized stresses = [N11, N22, N12, M11, M22, M12, N13, N23] -generalized strains = [e11, e22, 2e12, k11, k22, 2k12, g13, g23]
    -
    Euler-Bernoulli beam model
    -
    generalized stresses = [F1, M1, M2, M3] -generalized strains = [e11, k11, k12, k13]
    -
    Timoshenko beam model
    -
    generalized stresses = [F1, F2, F3, M1, M2, M3] -generalized strains = [e11, g12, g13, k11, k12, k13]
    -
    +
      +
    • generalized stresses = [F1, F2, F3, M1, M2, M3]
    • +
    • generalized strains = [e11, g12, g13, k11, k12, k13]
    • +
    +
    + +++ + + + +
    Type:list(float)
    global_loads_dist = None

    Distributed loads for Timoshenko beam model (VABS only)

    + +++ + + + +
    Type:list(list(float))
    global_loads_type = None
    -

    0 - generalized stresses, 1 - generalized strains

    +

    Global load type.

    +
      +
    • 0 - generalized stresses
    • +
    • 1 - generalized strains
    • +
    + +++ + + + +
    Type:int
    global_rotations = None
    -

    [[C11, C12, C13], [C21, C22, C23], [C31, C32, C33]]

    +

    Global rotation matrix.

    +

    [[C11, C12, C13], [C21, C22, C23], [C31, C32, C33]]

    + +++ + + + +
    Type:list(list(float))
    initial_curvature = None

    Initial curvature

    + +++ + + + +
    Type:list(float)
    initial_twist = None

    Initial twist (beam only)

    + +++ + + + +
    Type:float
    materials = None
    -

    Materials {mid: MaterialSection object, …}

    +

    Materials

    +

    {mid: MaterialSection object, …}

    + +++ + + + +
    Type:dict(int, MaterialSection)
    mocombos = None
    -

    Material-orientation combinations -{cid: [mid, orientation], …}

    +

    Material-orientation combinations

    +

    {cid: [mid, orientation], …}

    + +++ + + + +
    Type:dict(int, list(int, float))
    model = None
    -

    Macroscopic structural model -0 - classical (default) -1 - refined (e.g. generalized Timoshenko) -2 - Vlasov model (beam only) -3 - trapeze effect (beam only)

    +

    Macroscopic structural model

    +
      +
    • 0 - classical (default)
    • +
    • 1 - refined (e.g. generalized Timoshenko)
    • +
    • 2 - Vlasov model (beam only)
    • +
    • 3 - trapeze effect (beam only)
    • +
    + +++ + + + +
    Type:int
    +
    + +
    +
    +name = None
    +

    Name of the SG.

    + +++ + + + +
    Type:str
    nodes = None
    -

    Nodal coordinates -3D SG: {nid: [y1, y2, y3], …} -2D SG: {nid: [y2, y3], …} -1D SG: {nid: [y3], …}

    +

    Nodal coordinates

    +
      +
    • 3D SG: {nid: [y1, y2, y3], …}
    • +
    • 2D SG: {nid: [y2, y3], …}
    • +
    • 1D SG: {nid: [y3], …}
    • +
    + +++ + + + +
    Type:dict(int, list(float))
    nonuniform_temperature = None

    Flag of uniform temperature

    + +++ + + + +
    Type:int
    num_slavenodes = None

    Number of slave nodes

    + +++ + + + +
    Type:int
    oblique = None

    Oblique (beam only)

    + +++ + + + +
    Type:list(float)
    +
    + +
    +
    +omega = None
    +

    Omega (see SwiftComp manual).

    + +++ + + + +
    Type:float
    @@ -391,12 +907,57 @@

    Structure Gene + + + +Type:int + + +

    prop_elem = None
    -

    {mid/cid: [eid, …], …}

    +

    Element id for each material/combination.

    +

    {mid/cid: [eid, …], …}

    + +++ + + + +
    Type:dict(int, int)
    +
    + +
    +
    +sgdim = None
    +

    Dimension of the SG.

    + +++ + + + +
    Type:int
    +
    + +
    +
    +smdim = None
    +

    Dimension of the material/structural model.

    + +++ + + + +
    Type:int
    @@ -409,6 +970,14 @@

    Structure Gene trans_element = None

    Flag of transformation of elements

    + +++ + + + +
    Type:int

    diff --git a/doc/source/analysis.rst b/doc/source/analysis.rst new file mode 100644 index 0000000..2a3cb13 --- /dev/null +++ b/doc/source/analysis.rst @@ -0,0 +1,13 @@ +analysis Module +=============== + +.. highlight:: python + +:: + + import msgpi.analysis + +.. autofunction:: msgpi.analysis.solve + +.. autofunction:: msgpi.analysis.run + diff --git a/doc/source/conf.py b/doc/source/conf.py index 544e3ce..ae26899 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -42,6 +42,7 @@ extensions = [ 'sphinx.ext.autodoc', 'sphinx.ext.mathjax', + 'sphinx.ext.napoleon', ] # Add any paths that contain templates here, relative to this directory. diff --git a/doc/source/index.rst b/doc/source/index.rst index a18e361..cc41001 100644 --- a/doc/source/index.rst +++ b/doc/source/index.rst @@ -13,6 +13,8 @@ Welcome to Some scripts's documentation! sg iovabs ioutils + presg + analysis Indices and tables ================== diff --git a/doc/source/presg.rst b/doc/source/presg.rst new file mode 100644 index 0000000..a9c8241 --- /dev/null +++ b/doc/source/presg.rst @@ -0,0 +1,15 @@ +presg Module +============ + +.. highlight:: python + +:: + + import msgpi.presg + +.. autofunction:: msgpi.presg.readMaterialFromXMLElement + +.. autofunction:: msgpi.presg.preSG1D + +.. autofunction:: msgpi.presg.preSG + diff --git a/io/iosc.pyc b/io/iosc.pyc index d0d4a6c..e7eee47 100644 Binary files a/io/iosc.pyc and b/io/iosc.pyc differ diff --git a/io/iovabs.py b/io/iovabs.py index 2aa3d07..7fe3170 100644 --- a/io/iovabs.py +++ b/io/iovabs.py @@ -17,8 +17,10 @@ def readVABSIn(fn_vabs_in): """ Read data from the VABS input file - :param fn_vabs_in: File name of the VABS input file - :type fn_vabs_in: str + Parameters + ---------- + fn_vabs_in : str + File name of the VABS input file """ try: @@ -218,8 +220,12 @@ def readVABSIn(fn_vabs_in): def readVABSOutHomo(fn, scrnout=True): """Read VABS homogenization results - :param fn: VABS output file name (e.g. example.sg.k) - :type fn: str + Parameters + ---------- + fn : str + VABS output file name (e.g. example.sg.k). + scrnout : bool + Whether to print message to screen. """ sm = sgm.MaterialSection(1) @@ -412,6 +418,22 @@ def writeVABSMacroData(sg, fobj, sff): def writeVABSIn(sg, fn_vabs_in='', fmt=1): + """Write SG to VABS input file + + Parameters + ---------- + sg : :obj:`StructureGene` + Structure Gene that will be written to file. + fn_vabs_in : str + File name. + fmt : int + Format of the input file. + + Returns + ------- + str + VABS input file name. + """ if not isinstance(sg, sgm.StructureGene): return diff --git a/io/iovabs.pyc b/io/iovabs.pyc index 38a348a..008f491 100644 Binary files a/io/iovabs.pyc and b/io/iovabs.pyc differ diff --git a/io/utils.py b/io/utils.py index aa948ad..44c21e7 100644 --- a/io/utils.py +++ b/io/utils.py @@ -2,20 +2,19 @@ def writeFormatIntegers(file, numbers, fmt='8d', newline=True): - ''' Write a list of integers into a file - - :param file: The file object for writing - :type file: file - - :param numbers: The list of numbers that is going to be written - :type numbers: list - - :param fmt: The desired format for each number - :type fmt: string - - :param newline: If append the character ``\\n`` after writting all numbers or not - :type newline: bool - ''' + """Write a list of integers into a file + + Parameters + ---------- + file : file + The file object for writing. + numbers : list(int) + The list of numbers that is going to be written. + fmt : str + The desired format for each number. + newline : bool + If append the character ``\\n`` after writting all numbers or not. + """ fmt = '{0:' + fmt + '}' for i in numbers: file.write(fmt.format(i)) @@ -25,20 +24,19 @@ def writeFormatIntegers(file, numbers, fmt='8d', newline=True): def writeFormatFloats(file, numbers, fmt='16.6E', newline=True): - ''' Write a list of floats into a file - - :param file: The file object for writing - :type file: file - - :param numbers: The list of numbers that is going to be written - :type numbers: list - - :param fmt: The desired format for each number - :type fmt: string - - :param newline: If append the character ``\\n`` after writting all numbers or not - :type newline: bool - ''' + """Write a list of floats into a file + + Parameters + ---------- + file : file + The file object for writing. + numbers : list(float) + The list of numbers that is going to be written. + fmt : str + The desired format for each number. + newline : bool + If append the character ``\\n`` after writting all numbers or not. + """ fmt = '{0:' + fmt + '}' for f in numbers: file.write(fmt.format(f)) @@ -48,6 +46,15 @@ def writeFormatFloats(file, numbers, fmt='16.6E', newline=True): def writeFormatFloatsMatrix(fobj, matrix, fmt='16.6E'): + """Write a 2D list/array of float as a format matrix into file. + + Parameters + ---------- + fobj : file object + Output file. + matrix : list/array + Matrix of float that is goint to be written into file. + """ for row in matrix: writeFormatFloats(fobj, row, fmt) return @@ -60,22 +67,27 @@ def writeFormatIntegersMatrix(fobj, matrix, fmt='8d'): def textToMatrix(textList): - ''' Convert the text of a block of numbers into a matrix + """Convert the text of a block of numbers into a matrix - :param textList: The block of text representing a matrix - :type textList: list + Parameters + ---------- + textList : list(str) + The block of text representing a matrix - :return: A matrix of numbers - :rtype: numpy.array + Returns + ------- + :obj:`numpy.array` + A matrix of numbers. - :Example: + Examples + -------- >>> lines = ['1 2 3', '4 5 6', '7 8 9'] >>> utilities.textToMatrix(lines) array([[1., 2., 3.], [4., 5., 6.], [7., 8., 9.]]) - ''' + """ matrix = [] for line in textList: line = line.strip() diff --git a/io/utils.pyc b/io/utils.pyc index 5dffa6b..24d7c89 100644 Binary files a/io/utils.pyc and b/io/utils.pyc differ diff --git a/presg.py b/presg.py index 189f832..436dab6 100644 --- a/presg.py +++ b/presg.py @@ -11,6 +11,8 @@ def readMaterialFromXMLElement(xem): + """Read material data from XML elements. + """ type_flag = { 'isotropic': 0, 'orthotropic': 1, @@ -67,6 +69,20 @@ def readMaterialFromXMLElement(xem): def preSG1D(xr_sg, smdim): + """Preprocessor of 1D SG. + + Parameters + ---------- + xr_sg : xml.etree.ElementTree.Element + Root element of the input file. + smdim : int + Dimension of the material/structural model. + + Returns + ------- + `StructureGene` + Structure Gene. + """ # debug = True # print('running presc...') @@ -263,7 +279,7 @@ def preSG1D(xr_sg, smdim): def preSG(sg_xml, analysis, solver='swiftcomp', write_input=True, scrnout=True): - """ Preprocessor of a structure gene + """ Preprocessor of a structure gene. Parameters ---------- @@ -272,13 +288,25 @@ def preSG(sg_xml, analysis, solver='swiftcomp', write_input=True, scrnout=True): analysis : str The analysis that will be carried out after the generation of the input file. - h - homogenization - d - dehomogenization/localization/recover - f - initial failure strength - fe - initial failure envelope - fi - initial failure indices and strength ratios + + * h - homogenization + * d - dehomogenization/localization/recover + * f - initial failure strength + * fe - initial failure envelope + * fi - initial failure indices and strength ratios solver : str Format of the generated input file ('vabs' or 'swiftcomp') + write_input : bool + Whether to write input file. + scrnout : bool + Whether to print messages to the screen. + + Returns + ------- + str, int + (If write_input True) Input file name, dimension of the material/structural model. + :obj:`StructureGene` + (If write_input False) Structure Gene. """ if scrnout: print(' - preprocessing structure gene...') diff --git a/presg.pyc b/presg.pyc index 581cae7..d62694e 100644 Binary files a/presg.pyc and b/presg.pyc differ diff --git a/sg.py b/sg.py index f49a73a..e3e76ed 100644 --- a/sg.py +++ b/sg.py @@ -5,13 +5,56 @@ class MaterialSection(object): """ A macroscopic structure model. Stores material or structural properties. - :param smdim: Dimension of material/structure model. Defualt to 3. - :type smdim: int, optional + Parameters + ---------- + smdim : int + Dimension of material/structure model. + Beam (1), plate/shell (2), or 3D continuum (3). + Defualt to 3. """ def __init__(self, smdim=3): + #: int: Dimension of material/structure model. self.smdim = smdim + #: str: Name of the material/structure. self.name = '' + #: float: Density of the material/structure. + self.density = None + #: list(list(float)): Mass matrix at the origin. + self.mass_origin = None + #: list(list(float)): Mass matrix at the mass center. + self.mass_mc = None + + #: int: (continuum model) Isotropy type. + #: Isotropic (0), orthotropic (1), anisotropic (2). + self.type = None + #: dict: Engineering constants. + #: Keys: `e1`, `e2`, `e3`, `nu12`, `nu13`, `nu23`, `g12`, `g13`, `g23` + self.constants = None + #: list(list(float)): Stiffness matrix. + self.stiffness = None + #: list(list(float)): Compliance matrix. + self.compliance = None + + #: list(list(float)): + #: (beam/plate/shell models) Refined stiffness matrix + self.stiffness_refined = None + #: list(list(float)): + #: (beam/plate/shell models) Refined compliance matrix + self.compliance_refined = None + + #: list(float): Mass center. + self.mass_center = None + #: list(float): (beam model) Shear center. + self.shear_center = None + + #: int: Failure criterion. + self.failure_criterion = None + #: dict: Strength properties. + self.strength = None + + #: dict: + #: (will be deprecated) Effective properties of the material/structure self.eff_props = { 3: { 'density': 0, @@ -53,11 +96,11 @@ def __init__(self, smdim=3): } } - self.strength = { - 'criterion': 0, - 'chara_len': 0, - 'constants': [] - } + # self.strength = { + # 'criterion': 0, + # 'chara_len': 0, + # 'constants': [] + # } def __str__(self): s = '\n' @@ -96,116 +139,152 @@ def summary(self): class StructureGene(object): """ A finite element level structure gene model in the theory of MSG. - :param name: Name of the SG. - :type name: str - - :param sgdim: Dimensiona of the SG. - :type sgdim: int - - :param smdim: Dimension of the material/structural model. (1: beam, 2: plate/shell, 3: solid/block) - :type smdim: int + Parameters + ---------- + name : str + Name of the SG. + sgdim : int + Dimension of the SG. + smdim : int + Dimension of the material/structural model. + Beam (1), plate/shell (2), 3D continuum (3). """ def __init__(self, name, sgdim, smdim): + #: str: Name of the SG. self.name = name + #: int: Dimension of the SG. self.sgdim = sgdim + #: int: Dimension of the material/structural model. self.smdim = smdim - #: Analysis configurations + #: int: Analysis configurations #: - #: * 0 - homogenization (default) - #: * 1 - dehomogenization/localization/recover - #: * 2 - failure (SwiftComp only) + #: * 0 - homogenization (default) + #: * 1 - dehomogenization/localization/recover + #: * 2 - failure (SwiftComp only) self.analysis = 0 self.fn_gmsh_msh = self.name + '.msh' #: File name of the Gmsh mesh file - #: Physics included in the analysis + #: int: Physics included in the analysis #: - #: * 0 - elastic (default) - #: * 1 - thermoelastic - #: * 2 - conduction - #: * 3 - piezoelectric/piezomagnetic - #: * 4 - thermopiezoelectric/thermopiezomagnetic - #: * 5 - piezoelectromagnetic - #: * 6 - thermopiezoelectromagnetic + #: * 0 - elastic (default) + #: * 1 - thermoelastic + #: * 2 - conduction + #: * 3 - piezoelectric/piezomagnetic + #: * 4 - thermopiezoelectric/thermopiezomagnetic + #: * 5 - piezoelectromagnetic + #: * 6 - thermopiezoelectromagnetic self.physics = 0 - #: Macroscopic structural model - #: 0 - classical (default) - #: 1 - refined (e.g. generalized Timoshenko) - #: 2 - Vlasov model (beam only) - #: 3 - trapeze effect (beam only) + #: int: Macroscopic structural model + #: + #: * 0 - classical (default) + #: * 1 - refined (e.g. generalized Timoshenko) + #: * 2 - Vlasov model (beam only) + #: * 3 - trapeze effect (beam only) self.model = 0 - self.trans_element = 0 #: Flag of transformation of elements - self.nonuniform_temperature = 0 #: Flag of uniform temperature + #: int: Flag of transformation of elements + self.trans_element = 0 + #: int: Flag of uniform temperature + self.nonuniform_temperature = 0 - self.initial_twist = 0.0 #: Initial twist (beam only) - self.initial_curvature = [0.0, 0.0] #: Initial curvature - self.oblique = [1.0, 0.0] #: Oblique (beam only) + #: float: Initial twist (beam only) + self.initial_twist = 0.0 + #: list(float): Initial curvature + self.initial_curvature = [0.0, 0.0] + #: list(float): Oblique (beam only) + self.oblique = [1.0, 0.0] - # Materials - # self.num_materials = 0 #: Number of materials - self.materials = {} #: Materials {mid: MaterialSection object, ...} + #: dict(int, :obj:`MaterialSection`): Materials + #: + #: `{mid: MaterialSection object, ...}` + self.materials = {} - # self.num_mocombos = 0 #: Number of material-orientation combinations - #: Material-orientation combinations - #: {cid: [mid, orientation], ...} + #: dict(int, list(int, float)): Material-orientation combinations + #: + #: `{cid: [mid, orientation], ...}` self.mocombos = {} - # Discretization - # self.global_mesh_size = 0 #: Global mesh size - self.degen_element = 0 #: Flag of the type of elements (SC) - # self.num_nodes = 0 #: Number of nodes - # self.num_elements = 0 #: Number of elements - self.num_slavenodes = 0 #: Number of slave nodes - - #: Nodal coordinates - #: 3D SG: {nid: [y1, y2, y3], ...} - #: 2D SG: {nid: [y2, y3], ...} - #: 1D SG: {nid: [y3], ...} + #: int: Flag of the type of elements (SC) + self.degen_element = 0 + #: int: Number of slave nodes + self.num_slavenodes = 0 + + #: dict(int, list(float)): Nodal coordinates + #: + #: * 3D SG: `{nid: [y1, y2, y3], ...}` + #: * 2D SG: `{nid: [y2, y3], ...}` + #: * 1D SG: `{nid: [y3], ...}` self.nodes = {} - #: Elemental connectivities {eid: [nid1, nid2, ...], ...}, no zeros + #: dict(int, list(int)): Elemental connectivities + #: + #: `{eid: [nid1, nid2, ...], ...}`, no zeros self.elements = {} + #: list(int): Element ids self.elementids = [] + #: list(int): 1D element ids self.elementids1d = [] + #: list(int): 2D element ids self.elementids2d = [] + #: list(int): 3D element ids self.elementids3d = [] - #: Assignment of property to each element - self.elem_prop = {} #: {eid: mid/cid, ...} - self.prop_elem = {} #: {mid/cid: [eid, ...], ...} + #: dict(int, int): Material/Combination id for each element. + #: + #: `{eid: mid/cid, ...}` + self.elem_prop = {} + #: dict(int, int): Element id for each material/combination. + #: + #: `{mid/cid: [eid, ...], ...}` + self.prop_elem = {} - #: Element local orientations - self.elem_orient = {} #: {eid: [[a1, a2, a3], [b1, b2, b3], [c1, c2, c3]], ...} + #: dict(int, list(list(float))): Element local orientations. + #: + #: `{eid: [[a1, a2, a3], [b1, b2, b3], [c1, c2, c3]], ...}` + self.elem_orient = {} + #: float: Omega (see SwiftComp manual). self.omega = 1 - # Dehomogenization - self.global_displacements = [] #: [u1, u2, u3] - self.global_rotations = [] #: [[C11, C12, C13], [C21, C22, C23], [C31, C32, C33]] - self.global_loads_type = 0 #: 0 - generalized stresses, 1 - generalized strains - - #: Global loads - #: 3D structures - #: generalized stresses = [s11, s22, s33, s23, s13, s12] - #: generalized strains = [e11, e22, e33, e23, e13, e12] - #: Kirchhoff-Love plate/shell model - #: generalized stresses = [N11, N22, N12, M11, M22, M12] - #: generalized strains = [e11, e22, 2e12, k11, k22, 2k12] - #: Reissner-Mindlin plate/shell model - #: generalized stresses = [N11, N22, N12, M11, M22, M12, N13, N23] - #: generalized strains = [e11, e22, 2e12, k11, k22, 2k12, g13, g23] - #: Euler-Bernoulli beam model - #: generalized stresses = [F1, M1, M2, M3] - #: generalized strains = [e11, k11, k12, k13] - #: Timoshenko beam model - #: generalized stresses = [F1, F2, F3, M1, M2, M3] - #: generalized strains = [e11, g12, g13, k11, k12, k13] + #: list(float): Global displacements. + #: + #: `[u1, u2, u3]` + self.global_displacements = [] + #: list(list(float)): Global rotation matrix. + #: + #: `[[C11, C12, C13], [C21, C22, C23], [C31, C32, C33]]` + self.global_rotations = [] + #: int: Global load type. + #: + #: * 0 - generalized stresses + #: * 1 - generalized strains + self.global_loads_type = 0 + + #: list(float): Global loads + #: + #: * 3D continuum model + #: * generalized stresses = `[s11, s22, s33, s23, s13, s12]` + #: * generalized strains = `[e11, e22, e33, e23, e13, e12]` + #: * Kirchhoff-Love plate/shell model + #: * generalized stresses = `[N11, N22, N12, M11, M22, M12]` + #: * generalized strains = `[e11, e22, 2e12, k11, k22, 2k12]` + #: * Reissner-Mindlin plate/shell model + #: * generalized stresses = `[N11, N22, N12, M11, M22, M12, N13, N23]` + #: * generalized strains = `[e11, e22, 2e12, k11, k22, 2k12, g13, g23]` + #: * Euler-Bernoulli beam model + #: * generalized stresses = `[F1, M1, M2, M3]` + #: * generalized strains = `[e11, k11, k12, k13]` + #: * Timoshenko beam model + #: * generalized stresses = `[F1, F2, F3, M1, M2, M3]` + #: * generalized strains = `[e11, g12, g13, k11, k12, k13]` self.global_loads = [] - self.global_loads_dist = [] #: Distributed loads for Timoshenko beam model (VABS only) + #: list(list(float)): + #: Distributed loads for Timoshenko beam model (VABS only) + self.global_loads_dist = [] def summary(self): """Print a brief summary of the SG. @@ -226,8 +305,15 @@ def summary(self): def findMaterialByName(self, name): """Find material by name. - :param name: Material name. - :type name: str + Parameters + ---------- + name : str + Material name. + + Returns + ------- + int + Material id. 0 if not found. """ for i, m in self.materials.items(): if m.name == name: @@ -237,11 +323,17 @@ def findMaterialByName(self, name): def findComboByMaterialOrientation(self, name, angle): """Find material-orientation combination. - :param name: Material name. - :type name: str - - :param angle: Orientation angle. - :type angle: float + Parameters + ---------- + name : str + Material name. + angle : float + Orientation angle. + + Returns + ------- + int + Combination id. 0 if not found. """ for i, mo in self.mocombos.items(): if (self.materials[mo[0]].name == name) and (mo[1] == angle): diff --git a/sg.pyc b/sg.pyc index 2cd7761..d56f158 100644 Binary files a/sg.pyc and b/sg.pyc differ diff --git a/utils.pyc b/utils.pyc index 77e1dc0..38be490 100644 Binary files a/utils.pyc and b/utils.pyc differ