# Declaration of a boundary condition for left part leftBC = dnl.BoundaryRestrain('BC_left') leftBC.setValue(1, 1, 1) model.attachConstantBC(leftBC, leftNS) # Declaration of a boundary condition for right part rightBC = dnl.BoundaryRestrain('BC_right') rightBC.setValue(0, 1, 1) model.attachConstantBC(rightBC, rightNS) # Declaration of a ramp function to apply the load ramp = dnl.RampFunction("constantFunction") ramp.setFunction(dnl.RampFunction.Constant, 0, stopTime) # Declaration of a boundary condition for right part rightSpeed = dnl.BoundarySpeed() rightSpeed.setValue(displacement, 0, 0) rightSpeed.setFunction(ramp) model.attachConstantBC(rightSpeed, rightNS) # Declaration of the explicit solver solver = dnl.Explicit("Solver") solver.setTimes(0, stopTime) model.add(solver) model.setSaveTimes(0, stopTime, stopTime / nbreSaves) # Declaration of the history files vonMisesHist = dnl.HistoryFile("vonMisesHistory") vonMisesHist.setFileName(dnl.String("vonMises.plot")) vonMisesHist.add(allES, 0, dnl.Field.vonMises) vonMisesHist.setSaveTime(stopTime / nbrePoints)
# Declaration of a boundary condition for bottom part bottomBC = dnl.BoundaryRestrain('BC_bottom') bottomBC.setValue(1, 1, 1) model.attachConstantBC(bottomBC, bottomNS) # Declaration of a boundary condition for top part topBC = dnl.BoundaryRestrain('BC_top') topBC.setValue(0, 1, 1) model.attachConstantBC(topBC, topNS) # Declaration of a ramp function to apply the load ramp = dnl.RampFunction("constantFunction") ramp.setFunction(dnl.RampFunction.Constant, 0, stopTime) # Declaration of a boundary condition for top part topSpeed = dnl.BoundarySpeed() topSpeed.setValue(displacement, 0, 0) topSpeed.setFunction(ramp) model.attachConstantBC(topSpeed, topNS) # Declaration of the explicit solver solver = dnl.Explicit("Solver") solver.setTimes(0, stopTime) model.add(solver) model.setSaveTimes(0, stopTime, stopTime / nbreSaves) # Declaration of the history files vonMisesHist = dnl.HistoryFile("vonMisesHistory") vonMisesHist.setFileName(dnl.String("vonMises.plot")) vonMisesHist.add(histNS, dnl.Field.vonMises) vonMisesHist.setSaveTime(stopTime / nbrePoints)
# Declaration of a boundary condition for bottom line bottomBC = dnl.BoundaryRestrain('BC_bottom') bottomBC.setValue(0, 1, 1) model.attachConstantBC(bottomBC, bottomNS) # Declaration of a boundary condition for axis line axisBC = dnl.BoundaryRestrain('BC_axis') axisBC.setValue(1, 0, 1) model.attachConstantBC(axisBC, axisNS) # Declaration of a ramp function to apply the load ramp = dnl.RampFunction("constantFunction") ramp.setFunction(dnl.RampFunction.Constant, 0, stopTime) # Declaration of a boundary condition for top line speedBC = dnl.BoundarySpeed('BC_speed') speedBC.setValue(0, displacement, 0) speedBC.setFunction(ramp) model.attachConstantBC(speedBC, topNS) solver = dnl.Explicit("Solver") solver.setTimes(0, stopTime) model.add(solver) solver.setTimeStepMethod(solver.PowerIteration) #solver.setTimeStepSafetyFactor(0.6) model.setSaveTimes(0, stopTime, stopTime / nbreSaves) # Declaration of the history files vonMisesHist = dnl.HistoryFile("vonMisesHistory") vonMisesHist.setFileName(dnl.String("vonMises.plot")) vonMisesHist.add(histES, 0, dnl.Field.vonMises)