Skip to content

Commit

Permalink
subsystem maxIter and store min tensions
Browse files Browse the repository at this point in the history
-set the staticSolve and setOffset so that they can pass a maxIter to solveEquilibrium (neccessary for cable designs with more sections)
-added storage of minimum tensions (self.TeDmin)
  • Loading branch information
erickaloz committed Sep 18, 2024
1 parent 9278603 commit e226c84
Showing 1 changed file with 20 additions and 5 deletions.
25 changes: 20 additions & 5 deletions moorpy/subsystem.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ def initialize(self, daf_dict={}):
self.Te0 = np.zeros([self.nLines,2]) # undispalced values
self.TeM = np.zeros([self.nLines,2]) # mean offset values
self.TeD = np.zeros([self.nLines,2]) # dynamic values
self.TeDmin = np.zeros([self.nLines,2]) # dynamic minimum values

# adjustment on laylength... positive means that the dynamic lay length is greater than linedesign laylength
self.LayLen_adj = getFromDict(daf_dict, 'LayLen_adj', shape=0, default=0.0)
Expand Down Expand Up @@ -283,7 +284,7 @@ def setEndPosition(self, r, endB, sink=False):
raise LineError("setEndPosition: endB value has to be either 1 or 0")


def staticSolve(self, reset=False, tol=0, profiles=0):
def staticSolve(self, reset=False, tol=0, profiles=0, maxIter = 500):
'''Solve internal equilibrium of the Subsystem and saves the forces
and stiffnesses at the ends in the global reference frame. All the
This method mimics the behavior of the Line.staticSolve method and
Expand All @@ -309,7 +310,7 @@ def staticSolve(self, reset=False, tol=0, profiles=0):
self.pointList[-1].setPosition([ -self.span+LH, 0, self.rB[2]])

# get equilibrium
self.solveEquilibrium(tol=tol)
self.solveEquilibrium(tol=tol, maxIter = maxIter)

# get 2D stiffness matrices of end points
K = self.getCoupledStiffnessA()
Expand Down Expand Up @@ -379,7 +380,7 @@ def staticSolve(self, reset=False, tol=0, profiles=0):
plt.show()


def drawLine2d(self, Time, ax, color="k", endpoints=False, Xuvec=[1,0,0], Yuvec=[0,0,1], Xoff=0, Yoff=0, colortension=False, plotnodes=[], plotnodesline=[],label="",cmap='rainbow', alpha=1.0):
def drawLine2d(self, Time, ax, color="k", endpoints=False, Xuvec=[1,0,0], Yuvec=[0,0,1], Xoff=0, Yoff=0, colortension=False, plotnodes=[], plotnodesline=[],label="",cmap='rainbow', alpha=1.0, linewidth = 1):
'''wrapper to System.plot2d with some transformation applied'''

for i, line in enumerate(self.lineList):
Expand Down Expand Up @@ -487,8 +488,11 @@ def setOffset(self, offset, z=0):
self.rA = np.array([-self.span-self.rad_fair, 0, self.rA[2]])
self.rB = np.array([-self.rad_fair + offset, 0, self.z_fair+z])

self.staticSolve(tol=self.eqtol) # solve the subsystem

if hasattr(self, 'maxIter'):
self.staticSolve(tol=self.eqtol, maxIter = self.maxIter) # solve the subsystem
else:
self.staticSolve(tol=self.eqtol)

# Store some values at this offset position that may be used later
for i, line in enumerate(self.lineList):
self.TeM[i,0] = np.linalg.norm(line.fA)
Expand All @@ -498,6 +502,7 @@ def setOffset(self, offset, z=0):
self.anchorFz0 = self.lineList[0].fA[2]

self.TeD = np.copy(self.TeM) # set the dynamic values as well, in case they get queried right away
self.TeDmin = np.copy(self.TeM) # set the dynamic values as well, in case they get queried right away


def setDynamicOffset(self, offset, z=0):
Expand All @@ -521,6 +526,7 @@ def setDynamicOffset(self, offset, z=0):
# Store dynamic values at this offset position that may be used later
for i, line in enumerate(self.lineList):
self.TeD[i,:] = self.TeM[i,:] + self.DAFs[i]*( np.array([line.TA, line.TB]) - self.TeM[i,:] )
self.TeDmin[i,:] = self.TeM[i,:] - self.DAFs[i]*( np.array([line.TA, line.TB]) - self.TeM[i,:] )



Expand Down Expand Up @@ -657,6 +663,15 @@ def getTen(self, iLine):

return dynamicTe

def getMinTen(self, iLine):
'''Compute the end (maximum) tension for a specific line, including
a dynamic amplification factor.'''
line = self.lineList[iLine]

dynamicTe = min( self.TeDmin[iLine,:] )

return dynamicTe


def getTenSF(self, iLine):
'''Compute MBL/tension for a specific line.'''
Expand Down

0 comments on commit e226c84

Please sign in to comment.