# 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) model.add(vonMisesHist) StressHist = dnl.HistoryFile("StressHistory") StressHist.setFileName(dnl.String("Stress.plot")) StressHist.add(histNS, dnl.Field.StressXX) StressHist.add(histNS, dnl.Field.StressYY) StressHist.add(histNS, dnl.Field.StressZZ) StressHist.add(histNS, dnl.Field.StressXY) StressHist.setSaveTime(stopTime / nbrePoints) model.add(StressHist) temperatureHist = dnl.HistoryFile("temperatureHistory") temperatureHist.setFileName(dnl.String("temperature.plot"))
# Declaration of the initial speed speedBC = dnl.BoundarySpeed('BC_speed') speedBC.setValue(0, -speed, 0) model.attachInitialBC(speedBC, allNS) solver = dnl.Explicit("Solver") solver.setTimes(0, stopTime) model.add(solver) solver.setComputeTimeStepFrequency(1) solver.setTimeStepMethod(solver.PowerIteration) #solver.setTimeStepSafetyFactor(1.09) 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) vonMisesHist.setSaveTime(stopTime / nbrePoints) model.add(vonMisesHist) plasticStrainHist = dnl.HistoryFile("plasticStrainHistory") plasticStrainHist.setFileName(dnl.String("plasticStrain.plot")) plasticStrainHist.add(histES, 0, dnl.Field.plasticStrain) plasticStrainHist.setSaveTime(stopTime / nbrePoints) model.add(plasticStrainHist) temperatureHist = dnl.HistoryFile("temperatureHistory") temperatureHist.setFileName(dnl.String("temperature.plot")) temperatureHist.add(histES, 0, dnl.Field.temperature) temperatureHist.setSaveTime(stopTime / nbrePoints) model.add(temperatureHist)
# 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) vonMisesHist.setSaveTime(stopTime / nbrePoints) model.add(vonMisesHist) plasticStrainHist = dnl.HistoryFile("plasticStrainHistory") plasticStrainHist.setFileName(dnl.String("plasticStrain.plot")) plasticStrainHist.add(histES, 0, dnl.Field.plasticStrain) plasticStrainHist.setSaveTime(stopTime / nbrePoints) model.add(plasticStrainHist) temperatureHist = dnl.HistoryFile("temperatureHistory") temperatureHist.setFileName(dnl.String("temperature.plot")) temperatureHist.add(histES, 0, dnl.Field.temperature) temperatureHist.setSaveTime(stopTime / nbrePoints) model.add(temperatureHist)
# 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) model.add(vonMisesHist) temperatureHist = dnl.HistoryFile("temperatureHistory") temperatureHist.setFileName(dnl.String("temperature.plot")) temperatureHist.add(allES, 0, dnl.Field.temperature) temperatureHist.setSaveTime(stopTime/nbrePoints) model.add(temperatureHist) plasticStrainHist = dnl.HistoryFile("plasticStrainHistory") plasticStrainHist.setFileName(dnl.String("plasticStrain.plot")) plasticStrainHist.add(allES, 0, dnl.Field.plasticStrain) plasticStrainHist.setSaveTime(stopTime/nbrePoints) model.add(plasticStrainHist)