in pyansys how do I specify two element types?
I have a pyansys script that creates a triangle area, with a 1D link to it. How do I give the area element one element type and the linking line another? (e.g. SOLID186 and LINK1).
I think an additional, relevant, question is what does the element type number mean?
from ansys.mapdl.core import launch_mapdl mapdl = launch_mapdl() mapdl.prep7() k0 = mapdl.k(1, 0, 0) k1 = mapdl.k(2, 0, 1) k2 = mapdl.k(3, 1, 0) mapdl.k(4, 2, 0) mapdl.l(3, 4) mapdl.a(k0, k1, k2)
Answers
-
The element type enables the user to determine the physics involved with the element. For example, if you want to model a linear spring, you will need to use a COMBIN14 element.
The line body could indeed be meshed with LINK1 (1-D) element. However the surface body cannot be meshed with solid elements (such as SOLID186). Maybe shell elements are what you are looking for (SHELL181 for example).
Once you have decided the type of elements you want to use (COMBIN14, SOLID186, etc); you will need to define element type IDs : this is an identification number to tell MAPDL that a specific element type (and keyopts) will have to be used:
ET,1,MESH200 defines that all elements of ID type 1 will be MESH200 elements.
To mesh a structure with different element type IDs, you will need to activate the element type of interest to generate the mesh on the appropriate part. For example :
ET,1,SHELL281 ! Element type n°1 is SHELL281 elements
ET,2,LINK1 ! Element type n°2 is LINK1 elements
MP,EX,1,210000 ! Define material properties (material 1, Young Modulus)
MP,NUXY,1,0.3 ! Define material properties (material 1, Poisson Ratio)
MP,DENS,1,3E-09 ! Define material properties (material 1, Density)
TYPE,1 ! Activate element type n°1
MAT,1 ! Activate material n°1
AESIZE,ALL,50 ! Define mesh sizing
AMESH,ALL ! Mesh all areas with active element type (element type 1, so SHELL281 elements)
TYPE,2 ! Activate element type n°2
MAT,1 ! Activate material n°1
LMESH,ALL ! Mesh all lines with active element type (element type 2, so LINK1 elements)
0 -
We can associate an element attribute (such as element type, section etc) to an element, by issuing the commands like TYPE or SECNUM etc just before creating the element/generating the mesh.
In the below script, I have added 2 element types and corresponding sections (needed for shell and beam/link elements) and associated them accordingly to respective elements.
There are other ways ofcourse, but this is one of the way.
from ansys.mapdl.core import launch_mapdl mapdl = launch_mapdl() mapdl.prep7() #Keypoint definition k0 = mapdl.k(1, 0, 0) k1 = mapdl.k(2, 0, 1) k2 = mapdl.k(3, 1, 0) mapdl.k(4, 2, 0) #Creating Geometry line = mapdl.l(3, 4) area = mapdl.a(k0, k1, k2) #Element Types mapdl.et(1,'Shell181') mapdl.et(2,'Link180') #Defining sections for shell and beam mapdl.sectype(1,'shell') mapdl.secdata(0.1) mapdl.sectype(2,'link') mapdl.secdata(0.1) #Setting Element Attributes and Meshing mapdl.esize(1) mapdl.type(1) mapdl.secnum(1) mapdl.amesh(area) mapdl.secnum(2) mapdl.type(2) mapdl.lmesh(line) print(mapdl.etlist()) print(mapdl.elist())
2