Założenia: zdefiniowane sety z węzłów na każdej krawędzi jako LEFT, RIGHT, TOP, BOTTOM i stworzone dwa punkty referencyjne w złożeniu oraz dwa sety z nimi o nazwach REF-PT-1 i REF-PT-2
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 |
# -*- coding: mbcs -*- # Do not delete the following import lines from abaqus import * from abaqusConstants import * import collections import __main__ import section import regionToolset import displayGroupMdbToolset as dgm import part import material import assembly import optimization import step import interaction import load import mesh import job import sketch import visualization import xyPlot import displayGroupOdbToolset as dgo import connectorBehavior modelName = 'COMPRESSION_XY' periodicityLeftRight = True periodicityBottomTop = True #modelName = getInput('Enter model name:') root = mdb.models[modelName].rootAssembly # Clear all sets and equations connected to previous constaints names = [set[0] for set in root.sets.items()] for name in names: if "PERIOD-" in name: del root.sets[name] names = [c[0] for c in mdb.models[modelName].constraints.items()] for name in names: if "PERIOD-" in name: del mdb.models[modelName].constraints[name] # Get nodes from edges. Sets need to be prepared before this step leftSet = root.sets['LEFT'].nodes rightSet = root.sets['RIGHT'].nodes bottomSet = root.sets['BOTTOM'].nodes topSet = root.sets['TOP'].nodes # Connect Left to Right node if periodicityLeftRight: idsLR = collections.OrderedDict() for nodeL in leftSet: for nodeR in rightSet: if nodeL.coordinates[1] == nodeR.coordinates[1]: idsLR[nodeL.label] = nodeR.label sortedLeft = tuple(idsLR.keys()) sortedRight = tuple(idsLR.values()) # Connect Bottom to Top node if periodicityBottomTop: idsBT = collections.OrderedDict() for nodeB in bottomSet: for nodeT in topSet: if nodeB.coordinates[0] == nodeT.coordinates[0]: idsBT[nodeB.label] = nodeT.label sortedBottom = tuple(idsBT.keys()) sortedTop = tuple(idsBT.values()) i = 1 for n1, n2 in zip(sortedLeft, sortedRight): leftSetName = "PERIOD-LEFT"+str(i) rightSetName = "PERIOD-RIGHT"+str(i) root.SetFromNodeLabels(name=leftSetName, nodeLabels=(('PART-1-1', (n1,)), )) root.SetFromNodeLabels(name=rightSetName, nodeLabels=(('PART-1-1', (n2,)), )) eqName = "PERIOD-1-"+str(i) mdb.models[modelName].Equation(name=eqName, terms=((1.0, leftSetName, 1), (-1.0, rightSetName, 1), (1.0, 'REF-PT-1', 1), (0, 'REF-PT-1', 1))) # eqName = "PERIOD-2-"+str(i) # mdb.models[modelName].Equation(name=eqName, terms=((1.0, leftSetName, 2), (-1.0, rightSetName, 2), (1.0, 'REF-PT-2', 2), (0, 'REF-PT-2', 2))) i += 1 for n1, n2 in zip(sortedBottom, sortedTop): bottomSetName = "PERIOD-BOTTOM"+str(i) topSetName = "PERIOD-TOP"+str(i) root.SetFromNodeLabels(name=bottomSetName, nodeLabels=(('PART-1-1', (n1,)), )) root.SetFromNodeLabels(name=topSetName, nodeLabels=(('PART-1-1', (n2,)), )) eqName = "PERIOD-2-"+str(i) mdb.models[modelName].Equation(name=eqName, terms=((1.0, bottomSetName, 2), (-1.0, topSetName, 2), (1.0, 'REF-PT-2', 2), (0, 'REF-PT-2', 2))) # eqName = "PERIOD-1-"+str(i) # mdb.models[modelName].Equation(name=eqName, terms=((1.0, bottomSetName, 1), (-1.0, topSetName, 1), (1.0, 'REF-PT-1', 1), (0, 'REF-PT-1', 1))) i += 1 |
