ANCFcableCantilevered.py

You can view and download this file on Github: ANCFcableCantilevered.py

 1#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 2# This is an EXUDYN example
 3#
 4# Details:  ANCFCable test with many cable elements
 5#
 6# Author:   Johannes Gerstmayr
 7# Date:     2023-10-15
 8#
 9# Copyright:This file is part of Exudyn. Exudyn is free software. You can redistribute it and/or modify it under the terms of the Exudyn license. See 'LICENSE.txt' for more details.
10#
11#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
12
13import exudyn as exu
14from exudyn.utilities import *
15from exudyn.beams import *
16
17import numpy as np
18
19#create an environment for mini example
20SC = exu.SystemContainer()
21mbs = SC.AddSystem()
22
23oGround=mbs.AddObject(ObjectGround(referencePosition= [0,0,0]))
24nGround = mbs.AddNode(NodePointGround(referenceCoordinates=[0,0,0]))
25
26np.random.seed(0) #reproducible results (also for SolutionViewer when reloading ...)
27
28rhoA = 78.
29EA = 100000.
30EI = 200
31
32nCables = 10000
33for i in range(nCables):
34    p0 = np.random.rand(3)
35    if i < nCables/2:
36        p0[0]=0.5
37        p1 = p0 + [2+np.random.rand()*0.25,0,0]
38    else:
39        p0[0]=-0.5
40        p1 = p0 - [2+np.random.rand()*0.25,0,0]
41
42
43    cable = ObjectANCFCable(physicsMassPerLength=rhoA,
44                  physicsBendingStiffness=EI*(0.5+np.random.rand()*0.25),
45                  physicsBendingDamping = EI,
46                  physicsAxialStiffness=EA,
47                  )
48
49    ancf=GenerateStraightLineANCFCable(mbs=mbs,
50                  positionOfNode0=p0, positionOfNode1=p1,
51                  numberOfElements=12, #converged to 4 digits
52                  cableTemplate=cable, #this defines the beam element properties
53                  massProportionalLoad = [0,-9.81,0],
54                  fixedConstraintsNode0 = [1,1,1, 0,1,1], #add constraints for pos and rot (r'_y,r'_z)
55                  )
56
57#assemble and solve system for default parameters
58mbs.Assemble()
59
60endTime=10
61stepSize = 0.5e-3
62
63simulationSettings = exu.SimulationSettings()
64
65#simulationSettings.solutionSettings.writeSolutionToFile = False
66simulationSettings.solutionSettings.solutionWritePeriod = 0.02 #data not used
67simulationSettings.solutionSettings.binarySolutionFile = True
68simulationSettings.solutionSettings.outputPrecision = 6 #float
69simulationSettings.solutionSettings.sensorsWritePeriod = 0.002 #data not used
70simulationSettings.timeIntegration.verboseMode = 1 #turn off, because of lots of output
71simulationSettings.linearSolverType = exu.LinearSolverType.EigenSparse
72simulationSettings.parallel.numberOfThreads = 8
73simulationSettings.displayComputationTime = True
74simulationSettings.displayStatistics = True
75
76simulationSettings.timeIntegration.numberOfSteps = int(endTime/stepSize)
77simulationSettings.timeIntegration.endTime = endTime
78simulationSettings.timeIntegration.newton.useModifiedNewton = True
79
80#simulationSettings.timeIntegration.simulateInRealtime = True
81#simulationSettings.timeIntegration.realtimeFactor = 0.5
82
83SC.visualizationSettings.general.graphicsUpdateInterval = 0.02
84SC.visualizationSettings.window.renderWindowSize=[1200,1024]
85SC.visualizationSettings.nodes.show = False
86SC.visualizationSettings.loads.show = False
87SC.visualizationSettings.connectors.show = False
88#+++++++++++++++++++++++++++++++++++++++++++++++++++++++
89
90exu.StartRenderer()
91#mbs.WaitForUserToContinue()
92
93mbs.SolveDynamic(simulationSettings)
94
95SC.WaitForRenderEngineStopFlag()
96exu.StopRenderer() #safely close rendering window!
97
98#mbs.SolutionViewer()