Conversation
- Edited new Line dynamic methods to streamline passing of arguments and to only load the new functions on demand. - Added Subsystem.getDynamicMatrices method - copied closely from the CompositeLine method. This allows the new methods to work with Subsystem (all other methods are already inherited from Line). - Added Subsystem.makeFromSystem method - adapted from CompositeLine initialization to allow similar functionality for Subsystem. Not tested. - Made Examples/dynamic.py script to test some things out simply.
- functions from dynamic_tension_functions.py are now on helpers - Because the dynamic calculations depend on the number of nodes in the subsystem/line, I slightly modified functions lines2subsystem and makeGeneric to specify the number of segments to be used in addLine. - I have not used subsystem.makeFromSystem or getNodes yet
Applied the same idea of getSystemStiffnessA to lump the dynamic matrices (inertia, added mass, damping, and stiffness) in 3x3 matrices at the fairlead
- In system.getSystemDynamicMatrices, the effect of other attached points (the loop on point2) is already lumped in point.getDynamicMatrices - Replaced np.linalg.inv with np.linalg.pinv (which computes the pseudo-inverse of the matrix) because we can have some cases where rows and columns of the matrix are zero (e.g., when adopting Ca=0 in a given direction) - The procedure to lump the dynamic matrices in a point involves inverting the matrices twice. If the input matrix is not exactly symmetrical, this can greatly amplify the spurious asymmetry. For this reason, we make the matrices computed with the lumped mass symmetrical. - For some reason that I don't know yet, the procedure does not work if we use the whole matrix. We need to remove the rows and columns associated with the dofs of the node opposite to the node where we want to lump the matrices.
- Implemented getDynamicMatricesLumped method in the line class that lumps the added mass, inertia, damping, and stiffness matrices of a line at its extremities based on the matrices for each node (applied for a line modeled using a lumped mass model) - Method getDynamicMatrices in the body class similar to getStiffnessA, but for the dynamic matrices - Reorganized the code in point.getDynamicMatrices to use the new line.getDynamicMatricesLumped method - Changed some np.liang.inv for np.linalg.pinv. We need that for cases where the matrices are singular. For instance, the added mass matrix of the line is singular if the axial added mass coefficient is zero. WIP: There seems to be something wrong in line.getDynamicMatricesLumped if part of the line rests on the seabed, as the resulting stiffness matrix is not consistent with getStiffnessA. The agreement is much better when we totally remove those nodes, but they are still off. Need to figure out what is the correct way of dealing with that.
There is still something weird with the lumped mass approach regarding the nodes on the seabed. I'm still working on it, but for now we get the best results if we neglect those nodes when lumping the matrices at the extremities of the line.
The previous code to remove nodes on the sea bed wasn't working properly for subsystem
- Added number of segments (nSegs) in subsystem.makeGeneric to make sure that we are using the correct number of nodes (i.e., the one specified by the user) in the lumped mass approach - Initialize any subsystem that is within a system in system.initialize
Removed *args and **kwargs to make the inputs more explicit
Previously, each call of system.getSystemDynamicMatrices() (and other equivalent functions in the body and point classes) would recompute the dynamic matrices of the line (inertia, added mass, damping, and stiffness). That required the sea state and the motions of the line nodes at each call. Now, we need to precompute the dynamic matrices of each line using line.updateLumpedMass(). The advantages are: 1. Fewer computations 2. It is simpler to integrate the lumped mass approach in RAFT because now it's easier to account for motions of the fairlead Also, the only matrix that requires the sea state and motions of the line is the damping matrix. So this commit reformulates the system, body, and line usage of the lumped mass approach to be able to provide inertia, added mass, and stiffness matrices without knowledge of the sea state or motions of the line. I will add some examples, but you just need to call system.updateSystemDynamicMatrices() and then system.getSystemDynamicMatrices()
- The wave amplitude is now 2*Sw*dw (it was missing the factor 2) - The tension amplitude is now a complex value which is important to get the correct phase for shared moorings
This example is a modified/simplified version of one of the tests we made. As this example is meant to show how to use this new functionality only, I didn't check the results of the example case thoroughly.
Dynamic tensions on mooring lines
-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)
-- bathymetry input can now be a dictionary with 'x':x vector 'y':y vector 'depth': depth grid
It seems that np.linalg.solve() changed between Numpy 1.26.4 and Numpy 2.1.3 so that a part of the code related to the lumped mass approach stopped working. I'm not sure in which exact version that changed, but the new code should work with both.
I mistakenly discarded the imaginary part of the fairlead RAOs used in examples\lumped_mass.py when saving the pkl file. This could mislead users to think that the lumped mass approach requires real RAOs. Fixing that to make the example clearer.
-modified unload so that it inputs a list of Lm values, so that the mean load can vary for upwind or downwind lines -if you want to use the previous functionality of a single Lm, then input a list of length 1 -moorpy helper function automatically makes copys of linetypes with nonzero EAd (need to do this before unloading with multiple Lms) -added buoy plotting color
- Modifications in Line to apply reduced weight per unit length for Line objects with one end out of the water. These are a rough job and may best be replaced with an improved depth-aware Catenary function in the future.
- Seabed slope for each Line is now calculated based on the depth beneath each endpoint (assuming a uniformly sloped seabed underneath the line) rather than looking at the panel slope under end A. - This should be more robust by avoiding inconsistencies when lines cross panels, though could reduce accuracy for finer grids with Lines that only slightly touch.
Update gravity anchor cost based on new data
This reverts commit c4069ac.
- Implemented some index reordering stuff for using Guyan reduction in getCoupledStiffnessA instead of the original approach. Needs some stuff filled in! - Also a couple forgotten changes to Subsystem to clear out unused extra features.
Replacing previous method of double inverting the stiffness matrix by Guyan reduction. Coupled dofs are taken as the loaded dofs, whereas free dofs are taken as unloaded dofs. Guyan reduction: https://hal.science/hal-01711552v1/document
-- add ability to send in a list of labels for subsystem 2d plotting the same length as # of lines in subsystem -- used so you can have a different label for different line segments if you want -- backwards compatible, you can send in one value instead of a list still!
In commit 9b175e0 we adopted Guyan reduction instead of the double-inversion method to compute system stiffness in system.getCoupledStiffnessA(). Doing the same in the methods that compute dynamic matrices (stiffness, mass, damping, and added mass) using the lumped mass approach. This isn't working fully as expected yet. The stiffness matrix returned by line.getCoupledDynamicMatrices() still does not match line.KA, line.KB, and line.KBA computed with the quasi-static method very well. For some reason, we still need to remove the nodes on the floor to get a good agreement with the quasi-static results. We will investigate that in the future. Also, in the lumped mass approach, the guyan_reduce function is being applied to all dynamic matrices in the same way, but the damping and inertia matrices would need to have a special treatment. Will get back to this once the stiffness matrix is working as expected. 235299
- For certain applications, solveEquilibrium was not able to converge because it would alternate between ProfileTypes (1 and 2 or 3) when a floating free point was above the seabed at exactly 10% of the horizontal distance of the point - - For example, when an anchor point is at x=-100m, the depth is 100m, and the free point's position as its solving for equilibrium is at x=-50, z=-95, then it's ZF/XF ratio is right around 10%, which is what was used in Catenary to determine what ProfileType to use - Included a dynamic_stiffness_activated flag in subsystem.py too because I ran into an issue where I was only using Subsystems and trying to activate dynamic stiffnesses but because they weren't derived from an original system, this parameter did not trace through - - Most other cases should be fine -- what I was running was relatively unconventional
To fix warning "`trapz` is deprecated. Use `trapezoid` instead, or one of the numerical integration functions in `scipy.integrate`."
…sed for line costs
- Enabled bathymetry handling in Subsystem, with a modified updateBathymetry method that queries the System bathymetry grid. Needs checking and probably a couple additions. - A couple adjustments in Subsystem and System to hopefully work with this. Needs checking. - Some documentation updates in progress. Adding recent papers, mentioning subsystem, etc.
--some bug fixes and adjustments to bathymetry addition in MoorPy subsystem
-subsystem now calculates anchorfxD and anchorfxM where D is the dynamic maximum load and M is the mean load -matches implementation of dynamic and mean tensions (TeD and TeM) -DAFs[-1] is for anchor horizontal load and DAFs[-2] is for anchor vertical load
…o lines: 1) the old method subsystem2Line did not cover cases like shared anchors. The new method does. 2) the new method ensures no overlaying points are created and keep them fixed instead of coupled (the default)
- dynamic offset for shared lines is divided by two just like in the static offset. - deleting .DS_Store hidden useless file in examples
- helpers.getAnchorCost(fx, fz, type) added to be a convenient interface to anchor cost functions as they get updated over time. - Added image for documentation.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This merges in all MoorPy updates since v1.1.0 -- about a year's worth of improvements.