Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MoorPy v1.1.0 #32

Merged
merged 84 commits into from
Sep 9, 2024
Merged

MoorPy v1.1.0 #32

merged 84 commits into from
Sep 9, 2024

Conversation

shousner
Copy link
Contributor

@shousner shousner commented Aug 27, 2024

Purpose

This pull request is to merge in many new features of the MoorPy dev into the master branch to make a new release. 1) To keep MoorPy more up to date with recent development, and 2) to ensure other tools that use MoorPy (like RAFT) are the most up to date with the master branch.

Type of change

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (non-backwards-compatible fix or feature)
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes, no API changes)
  • Documentation update
  • Maintenance update
  • Other (please describe)

Testing

  • Navigate to your main MoorPy directory
  • Run "pytest" in that directory

Checklist

  • I have run existing tests which pass locally with my changes
  • Contributors have added new tests or examples that prove my fix is effective or that my feature works
  • I have added necessary documentation

gbarter and others added 30 commits May 10, 2023 11:18
- MoorProps is updated with Brian's function to calculate anchor capacity or anchor mass (getAnchorMass). This inputs either Fx and Fz forces or capacity
- There are rough notes on where the anchor model assumptions come from - see Brian's spreadsheet for more details.
- new getAnchorCost function calls getAnchorMass then applies cost coefficient to anchor mass. Previous install/decommissioning costs are there too.
- Anchor mass cost coefficients are in for DEA and suction anchors (taken from Task 49 work). No material cost info for other types.
- old getAnchorProps is still there with same name (to maintain current workflow).
- New helper function pulled from Mattlib to read in main OpenFAST file (for DynLineDesign workflow)
- Transferred in the Catenary ProfileType 7 capability from Will
  with alpha the new catenary seabed slope parameteter, as well
  as slope calculations in Line.staticSolve.
- Reduced overlap in Line methods so that getLineCoords and
  getLineTens now just call staticSolve.
- Added "bathymetry" as optional input to System.init, which uses
  existing bathymetry file loading to store a grid for the system.
- Fixed possible typo in System.readBathymetryFile where depth grid
  dimensions were swapped.
- Added System.getDepthFromBathymetry(x,y) to get depth and normal
  vector from bathymetry grid at a given location, along with
  associated interpolation functions (these are copied from MoorDyn F).
- Connected slope and depth at a line's end A in Line.staticSolve
  to enable bathymetry slope based on the anchor's position on the
  grid.
- These capabilities are not yet generalized for when a line on
  the seabed crosses multiple grid panels or when more than one
  line section is along a sloped seabed.
This also features Matt's edits for clarity when calculating the drag on the line.
- Streamlined current drag rotational transformation approach
  by putting everything into a single rotation matrix that goes
  from the original 3D frame to a rotated frame with the loaded
  catenary in the local X-Z plane.
- In the process, found a simpler and more numerically accurate
  calculation for the slope angle alpha.
- Improved some general error message handling in Catenary.
- Solved some inconsistencies in arguments to catenary so that
  all system tests once again pass.
Through various changes, mainly in Line and Catenary, seabed
slope and current load capabilities should now work in general
including with taut line sections under currents.

Line
- Fixed some disconnects and bugs throughout related to seabed
  contact, and to ensure all tests still pass after new
  capabilities.
- Adding some hasty steps to ensure the seabed is ignored for
  lines that are off the seabed and experiencing current loads
  (especially a factor for taut lines, which may have huge
  rotations of the w vector).
- Simplified current force calculation to apply drag equation
  to line segments rather than nodes.

Catenary
- Add support for sloped seabed profile to work in more
  cases, such as when end B is below end A.
- Added support for sloped seabed in slack (L shaped) profile.
- Improved handling of different profile types for different
  scenarios and removed some unintended behavior when dealing
  with end B lower than end A and incorrect input of height
  off seabed.
- Internally replaced use of -CB for height off seabed with
  dedicated hA and hB values for each end (less confusing).
- More streamlining and some misc cleanup throughout code.
- dsolve2 now truncates empty parts of solve record list.
- New test added for sloped seabed in test_catenary.py.
- Previous commits had created a self.seabedMod to determine whether the system has a flat seabed, a simple slope, or a seabed based on a bathymetry file
- There was no option for the bathymetry file (seabedMod=2), and so getDepthFromBathymetry returned the results from seabedMod=0
- - So I simply indented the main gDFB code over and under an if statement for seabedMod=2
- It never set self.seabedMod=2 in __init__ because it had no self variable, so it stayed as self.seabedMod=0
 - Trimmed down the code in Line.staticSolve to just the key
   parts, including removing multiple calls to catenary and
   reorganizing the entire flow to eliminate duplicate steps.
 - The new flow of staticSolve means that the last current
   force is used in the next catenary solve, eliminating some
   convergence problems seen when coupled with RAFT FOWTs.
 - Removed three extra Line methods that are no longer needed
   (made a couple edits in Point and System to achieve this).
 - Updated some of the structure.rst documentation to mention
   new bathymetry and current features!
- Need to add a "-e" flag for "editable" for development.
- Otherwise, it installs in "regular" mode, that does not allow local changes to source code to change the installation
- Created a new addToDict helper function to transfer entries
  between dictionaries with some error handling (may be expanded).
- Expanded System.parseYAML to try to pass hydro coefficients
  that would have been put in the design dictionary by the OMDAO
  wrapper.
- Proper description will be provided in a later commit that finishes these...
This edit adds support for cases where a line end A is on the
seabed and end B is BELOW end A but off the seabed because the
seabed has a large downward slope. I.e. tan(alpha) < zf/xf where
both are negative. Because seabed contact is only set up for end
A, this edit allows - ZF values in these cases rather than
doing the reverse trick that swaps ends A and B in catenary.
- Catenary: adjustment to avoid error with never-ending recursive loop
  when solving profile of U shaped lines (by removing Tol from seabed contact).
- Catenary: fixed irregularity on node outputs of U shaped profiles. Now the
  nodes are evently distributed as expected.
- System plotting: editing optional bathymetry plotting arguments to now have
  "args_bath", a dictionary of optional arguments that go straight to the 3d
  surface plotting function to allow greater control. cmap_bath and alpha are
  now removed as separate options.
- Cleaned up moorprops-default.yaml, removing extra EAs entry and
  cleaning up notes.
- Cleaned up associated functions in helpers, line, and system to
  match and to just give a warning message when the users calls
  activateDynamicStiffness but EAd value isn't provided (only if
  display > 0).
- Added documention of the new feature in the Usage page!!
- Using Brian's old code, reran numbers for mass, buoyancy, (and MBL) for chain and polyester
- - Masses of chain (studlink and studless) were similar to old coefficients
- - Had to adjust MBLs from Brian's numbers (d^2 term AND d term)
- - Updated chain dvol/dnom values (pretty close)
- Implemented the option for a user to specify either dvol/dnom, material density, or specific gravity
- - specific gravity was given in the polyester catalogs, and rather than try to calculate dvol from that, you can now just input the specific gravity
- - Updated mass and MBL of polyester (much different than before)
- Changed getLineProps in helpers.py to support the new dvol implementations
- Still need to update the EA and cost values for chain and polyester - (in progress)
- Also updated the MBLs of chain to be a cubic function (with notes). Reminder, MBL of studless and studlink chain are the same.
- Updated chain EA values (for studlink and studless) (based off of DNV standards bc not in catalogs)
- Updated the dynamic stiffness (EA) coefficients for polyester based on my own Krd vs. %MBL curves
- Updated all of nylon and HMPE properties
- - Nylon mass decreased, MBL is now cubic and increased
- - Nylon EA_MBL estimated as 5 bc Krs is hard to find for nylon (and is likely very nonlinear)
- - Nylon EAd_MBL coefficients taken from research studies with empirical data
- - HMPE data derived similarly to nylon (with more catalog data for EA), and added to yaml
- Took out the old wire rope property list since it's not used much, and it's outdated

- Changed the mass units to [kg/m/m^2] to differentiate between d^2 and per length
- Fixed an undefined variable in system.py
…ntation

- loadLineProps now sets the two properties (out of the above 3) that are not used in the dictionary to None, and getLineProps still loads them in similarly.
- The error was that a dvol/dnom value was still being read in as 1.0 from the previous loadLineProps
- Removing specific gravity as a MoorProps input option since
  the reference density can be unclear and a source of discrepancy.
  Just using dvol_dnom and material density now.
- Trimming mass inputs to be mass/d^2 only, to avoid potential
  issues with buoyancy/density assumptions. It's all we use anyway.
- Updated MoorProps default YAML with the above edits.
- Updated MoorProps helper functions with the above changes, and also
  trimmed error checking to only be in the load function, since after
  that point the data should already be verified and may be used many
  times in the loop so we want to prioritize speed.
- Some function comment updates.
1) line.activateDynamicStiffness now takes the maximum value of the dynamic and static stiffness, at whatever line tension, to ensure that a dynamic stiffness value that is lower than a static stiffness value (usually at low tensions) is not used
2) unit error in the dynamic stiffness inputs: the beta term (in other research studies) is defined as the slope of the Krd vs. %MBL curve, where %MBL values are in units of 20,30,40...[%MBL]. So, we would have to add a factor of 100 to the mean tension value used to calculate the dynamic stiffness, or multiply the beta/slope values by 100 in MoorProps_default.yaml
- to better represent degrees of uncertainty, or standard deviations of catalog data away from the calculated regression line
lsirkis and others added 29 commits April 15, 2024 10:46
--Added a function that deletes lines and updates line and point indices to helpers
--Added a function that creates a moorpy subsystem for a set of connected lines and deletes the old lines
--Fixed issue with deleteLine method in helpers.py
--Added function to convert a subsystem to a line in helpers.py
--Fixed subsystem2Line method in helpers.py to update point types of end points to match original point types
--Removed reuirement to have rA and rB set in subsystem to find the end point locations
- helpers.py: added simple/placeholder loadPointProps and getPointProps for
  doing similarly as lineProps for connectors that could be MoorPy Points.
- SubSystem:
- - Added initialization method to initialize DAFs, etc.
- - Variables Te0/M/D now store undisplaced/mean/dynamic tensions of each section.
- - makeGeneric now has an optional "connectors" input that contains property
    info for connectors along the line.
- - added setDynamicOffset method, which includes dynamic stiffness and DAFs.
…sts updates:

- In Subsystem, "span" is now used consistently to be the horizontal
  distance from end A to end B.
- rAFair and rBFair are gone, replaced with rad_fair, z_fair , and span.
- Subsystem.Heading is now compass heading in degrees.
- Added a couple missing tests files, hopefully automated tests now pass.
- System.parseYAML wasn't setting the mass vs. weight correctly for some reason, so I put in a fix for that
- Wire rope properties are now added to MoorProps_default.yaml
- - However, they're still missing cost properties, and drag and added mass properties
Had to add an if statement to correct extreme LBot estimates.
- Added depth input to catenary, and buoyant sections now stop
  at the surface rather than crossing it.
- A few related changes eliminate some errors that can occur
  with non-ideal dynamic cables.
…ic line types

- The first damping value is set to critically damp segments that are 10 m long.
- The second value is set to achieve a desired half-way period (T_half) between
  the static and dynamic stiffness values.
- Needs testing!
- Added a System flag dynamic_stiffness_activated to track the state of
  the stiffness assumptions.
- Changed activateDynamicStiffness methods to only run if the system
  is currently in a static stiffness state. Otherwise calling these
  methods twice in a row would result in exagerated stiffnesses.
- Fixed a bug found by kasia129 with misnaming of CdAx and CaAx when
  loading line properties. The keys should now be consistent.
- Subsystem.staticSolve mistakenly used the finite-difference
  coupled stiffness method. Now it uses analytic. Should be
  faster and more robust.
- In System.addBody, added DOFs parameter.
Adding a function into helpers.py called line2ss that automatically detects all multi-segmented mooring lines and convert them into subsystems. Users can pass on a mooring system (ms) and get lines with multiple sections replaced with subsystems.

Also a couple nonstandard symbol corrections in input files.
This commit adds an optional linewidth argument to System.plot2d.

Adding linewidth as a kwargs in plot2d. The function "drawLine2d" was updated to read the linewidth value.
- Catenary now gives a very small (rather than zero)
  horizontal stiffness for slack lines.
- getCoupledStiffness now tries pinv if inv doesn't work.
  (pinv can invert signular matrices).
- getCoupledStiffness now tries pinv if inv doesn't work in the
  second step as well.
- The Subsystem uplift_ang calculation now uses arctan2 to avoid
  division by zero for vertical lines.
- Changed the various np.int_ style type commands (which have
  compatibility issues) to basic python types throughout.
- Fixed an edge case that crashed Catenary when a buoyant line
  passed through the water surface. It now ignores the surface
  in those cases.
- Deleted the lines2ss_function_test file to avoid tests failing.
-swapped C1 and C2 damping values for static dynamic tension in synthetic rope
-matches IOWTC paper
-also added color for buoy plotting
-edits to subsystem static solve and setOffset for symmetrical cases (where only half of the cable is modeled)
-added colorplot variable so that color input is no longer written over
- Note that I do also have a small update for polyester cost, but won't change it yet until we know when we can produce another release of MoorPy
@shousner shousner merged commit 9881074 into master Sep 9, 2024
38 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants