# Mesh ## Structural Elements In order to create structural elements required for the creation of some previous items; geometry and section are required, for which previously is necessary to create a material. For example to create a Beam the arguments needed are, Name of the Structural Element, Cross Section I, Cross Section J and the Geometry: ```{code-block} createSEBeam("BEAM","IPE 80","IPE 80","Curve") ``` You can also modify the properties of the Structural Element once created, such as mesh parameters. ```{code-block} s = StructuralElementsContainer.Find("BEAM") s.MeshTool1D.OptionMeshType = "MaxLength" s.MeshTool1D.ParameterMesh.Length = Double(0.5,"m") ``` To create a Shell the arguments needed are: Name of the Structural Element, Material, Thickness and Geometry: ```{code-block} createSEShell("SHELL","C30/37",Double(0.05,"m"),"Surface") ``` Modifying the properties of the Structural Element: ```{code-block} SE= StructuralElement("SHELL") SE.MeshTool2D.ParameterMesh.EType = "QUAD" SE.MeshTool2D.ParameterMesh.DivU = 12 ``` Change the structural elements color, with an hexadecimal value as a string: ```{code-block} changeEntityColor([SE],"#FFFFFF") ``` Structural Elements can be meshed one by one with the contextual command: ```{code-block} meshSESelected([SE1,SE2,...]) ``` As well the mesh of each structural element can be cleared: ```{code-block} clearMeshSESelected([SE1,SE2,...]) ## Model Utils and Contacts Model Utils have 4 different properties: Mass, Insertion, Spring and Connection. To create them proceed has follows: # Name, structural Element, Point, Mass createPointMass("Mass","StructElement",(0,0,0),1) # Name, Structural Element 1, Structural Element 2 createInsertion("Insertion","ShellSE","BeamSE") #Name, Structural Element,Spring stiffness,Degree Freedom X,Y,Z createCurveSpring("Spring","ShellSE",1200,True,True,False) # Name, Master node, Tied nodes (need a mesh) node0 = getNode(4) node1 = getNode(10) node2 = getNode(6) createConnection("Connection",node0,[node1, node2]) ``` Contacts only need a name and the contacted and contacting Structural Element to be defined: #Name, Contacted, Contacting ```{code-block} createContact("Contact pair","Beam SE","ShellSE") ``` ## Mesh and Mesh Tools Through the code you can mesh all the structural elements in the model, remove the mesh, change the elements type or do a merge of the nodes through these commands: ```{code-block} mesh() clearMesh() changeElementType("Quadratic") #Tolerance of merge mergeAllNodes(Double(0.5,"m")) ``` CivilFEM also has commands to obtain information of the mesh: ```{code-block} # getSEElements("Solid 3D"): Elements list of structural element "Solid 3D" elementObjects = getSEElements("Solid 3D") for element in elementObjects: print(element.Id) # getElementNodesId(10): Nodes Id list of element 10 elemNodeIds = getElementNodesId(10) for nodeId in elemNodeIds: print(nodeId) # getNodeCoords(10): Coordinates (x,y,z) of node 10 point = getNodeCoords(10) print(point) # getElementVolume(10): Volume of element 10 (hexaedrical and tetraedrical elements). That command takes document units. volume = getElementVolume(10) print("Element 10 Volume: " + str(volume)) # getElementArea(10): Area of element 10 (triangular and quadrangle elements). That command takes document units. area = getElementArea(10) print("Element 10 Area: " + str(area)) # getNumNodes(): Details the total number of nodes in a model. numNodes = getNumNodes() print("Number of nodes: " + str(numNodes)) # getNumElements(): Details the total number of elements in a model. numElements = getNumElements() print("Number of elements: " + str(numElements)) # getMaxNodeId(): Provides the maximum ID belonging to a node. maxNodeId = getMaxNodeId() print("Maximum node number id: " + str(maxNodeId)) # getMaxElementId(): Provides the maximum ID belonging to an element. maxElementId = getMaxElementId() print("Maximum element number id: " + str(maxElementId)) # getNodeIds(): Comes out a list detailing all the nodes ID. allNodeIds = getNodeIds() for nodeId in allNodeIds: print(nodeId) # getElementIds(): Comes out a list detailing all the element ID. allElementIds = getElementIds() for elementId in allElementIds: print(elementId) ``` Objects of nodes and elements contain information such as position or identifier: ```{image} img/Mesh/MeshOutput.png --- align: center --- ``` Objects or identifiers (IDs) can be interacted with to find those elements or nodes that meet certain conditions, and used in commands. The following example shows how certain nodes are selected to make a connection: ```{code-block} masterNode=[] seList = [ "SE1", "SE2", "SE3" ] # assuming we have a list of structural element names for seName in seList: nameListID = getSEElements(seName) # Obtain the element objects of the SE for j in nameListID: nodeList = getElementNodesId(j.Id) # Obtain the IDs of nodes of that element inserted = False for k in nodeList: node = getNode(k) # Get the node object by its ID if(node.Coords.y()==0.0): # Condition to filter: access the y coordinate and check if it's zero masterNode.append(node) # Store the selected master node for this SE and continue for the next inserted=True break if(inserted): break # Now for each master node stored (selected by each structural element) create a connection with a given tiedNode tiedNode=[] # assuming we have a list of tied nodes, one for each master node for i in range(len(masterNode)): createConnection("Barras_VigaTorque_"+str(i+1),masterNode[i],[tiedNode[i]]) ```