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