# Creates the Elements model.setDefaultElement(dnl.Element.ElQua4N2D) model.createElement(1, 1, 2, 3, 4) print("Number of elements created:", model.getElementsNumber()) # Creates the Groups allNS = dnl.NodeSet("NS_All") model.add(allNS, 1, 4) topNS = dnl.NodeSet("NS_Top") model.add(topNS, 3, 4) bottomNS = dnl.NodeSet("NS_Bottom") model.add(bottomNS, 1, 2) allES = dnl.ElementSet("ES_All") model.add(allES, 1) histNS = dnl.NodeSet("NS_Hist") model.add(histNS, 1) histES = dnl.NodeSet("ES_Hist") model.add(histES, 1) # Creates the hardening law hardLaw = dnl.JohnsonCookLaw() hardLaw.setParameters(A, B, C, n, m, depsp0, Tm, T0) # Creates the material steel = dnl.Material("Steel") steel.setHardeningLaw(hardLaw)
dxHeigh /= (1 / factor + 1) / 2 y = 0 for j in range(nbElementsHeigh + 1): for i in range(nbElementsWidth + 1): model.createNode(nbNodes, i * dxWidth * (1 + ddx * y), y, 0) model.add(nsAll, nbNodes) nbNodes += 1 if (j == nbElementsHeigh / 2): dxHeigh /= factor y += dxHeigh nbNodes -= 1 print("Number of nodes created:", model.getNodesNumber()) # Creates the Elements model.setDefaultElement(dnl.Element.ElQua4NAx) nbElements = 1 esAll = dnl.ElementSet("ES_All") for j in range(nbElementsHeigh): for i in range(nbElementsWidth): n1 = (i + (j * (nbElementsWidth + 1)) + 1) n2 = (i + (j * (nbElementsWidth + 1)) + 2) n3 = (i + ((j + 1) * (nbElementsWidth + 1)) + 2) n4 = (i + ((j + 1) * (nbElementsWidth + 1)) + 1) model.createElement(nbElements, n1, n2, n3, n4) model.add(esAll, nbElements) nbElements += 1 nbElements -= 1 print("Number of elements created:", model.getElementsNumber()) topNS = dnl.NodeSet("NS_Top") model.add(topNS, nbNodes - nbElementsWidth, nbNodes)