### Install pycatenary Development Version Source: https://github.com/tridelat/pycatenary/blob/main/docs/source/index.md Install a development version of pycatenary by cloning the repository and installing it in editable mode. ```bash git clone https://github.com/tridelat/pycatenary cd pycatenary pip install -e . ``` -------------------------------- ### Install pycatenary via PyPI Source: https://github.com/tridelat/pycatenary/blob/main/docs/source/index.md Install the latest official release of the pyCatenary library from the Python Package Index. ```bash pip install pycatenary ``` -------------------------------- ### Retrieve Fairlead and Anchor Forces Source: https://github.com/tridelat/pycatenary/blob/main/docs/source/index.md Get the forces experienced at the fairlead and anchor points of the mooring line. ```python # get force at the fairlead line1.get_fairlead_force() # get force at the anchor line1.get_anchor_force() ``` -------------------------------- ### Create Multisegmented Mooring Line Source: https://github.com/tridelat/pycatenary/blob/main/docs/source/index.md Example of initializing a multisegmented mooring line with different segment properties and computing its solution. The floor is enabled. ```python from pycatenary import MooringLine import numpy as np line4 = MooringLine( fairlead=[0.142, 0.0, 5.486], anchor=[7.083, 0.0, 0.0], L=[5.672, 0.126, 4.0, 0.259], w=np.array([0.402, 1.558, 0.00425, 1.529]) * 9.81, EA=[2.050e3, 3.636e6, 10.873e3, 6.464e6], floor=True ) line4.compute_solution() line4.plot() ``` -------------------------------- ### Create and Compute a Hanging Cable (2D) Source: https://github.com/tridelat/pycatenary/blob/main/docs/source/index.md Example of an inextensible cable hanging between two points at the same height with no floor. Requires 'pycatenary' to be imported. ```python from pycatenary import MooringLine # define properties of cable line2 = MooringLine( fairlead=[17.69, 0.0], anchor=[0.0, 0.0], L=20.0, w=1.962, EA=None, floor=False, ) # compute solution for the catenary line2.compute_solution() # plot solution line2.plot() ``` -------------------------------- ### Compute MooringLine solution and simulate quasi-static stepping Source: https://context7.com/tridelat/pycatenary/llms.txt Call compute_solution() to solve the catenary equilibrium. This method must be called after any position changes. The example demonstrates simulating quasi-static stepping by moving the fairlead and re-solving. ```python from pycatenary import MooringLine import numpy as np line = MooringLine( fairlead=[5.3, 0.0, 2.65], anchor=[0.0, 0.0, 0.0], L=6.98, w=1.036, EA=560.0e3, floor=True, ) line.compute_solution() # Move fairlead and re-solve (quasi-static stepping) for x in np.linspace(5.3, 4.9, 5): line.set_fairlead_position([x, 0.0, 2.65]) line.compute_solution() print(f"x={x:.2f}m fairlead force={line.get_fairlead_force()}") # x=5.30m fairlead force=[123.45 0. 456.78] # x=5.20m fairlead force=[...] # ... ``` -------------------------------- ### Plot Mooring Line in 3D Source: https://github.com/tridelat/pycatenary/blob/main/docs/source/index.md Visualize the computed mooring line in a 3D plot. Requires matplotlib to be installed. ```python line1.plot() ``` -------------------------------- ### Plot Mooring Line in 2D Source: https://github.com/tridelat/pycatenary/blob/main/docs/source/index.md Visualize the computed mooring line in a 2D plot. Requires matplotlib to be installed. ```python line1.plot_2d() ``` -------------------------------- ### Retrieve Tension Along Line (from Fairlead) Source: https://github.com/tridelat/pycatenary/blob/main/docs/source/readme.md Get the tension at a specific distance along the mooring line, measured from the fairlead. The distance must be less than or equal to the line length. ```python # get tension at 5m along the line from fairlead line1.get_tension(5.0, from_fairlead=True) ``` -------------------------------- ### Retrieve Fairlead Force Source: https://github.com/tridelat/pycatenary/blob/main/docs/source/readme.md Get the force experienced at the fairlead of the mooring line. This function should be called after computing the solution. ```python # get force at the fairlead line1.get_fairlead_force() ``` -------------------------------- ### plot_3d Source: https://github.com/tridelat/pycatenary/blob/main/docs/source/modules.md Generates a 3D plot of the mooring line, with options to show tension and customize the colormap. Requires matplotlib to be installed. ```APIDOC ## plot_3d(npoints: int = 100, show_tension: bool = True, colormap: str = 'viridis') -> None ### Description Plots line from anchor to fairlead in 3D. ### Parameters * **npoints** (*int, optional*) – Number of points along the line, by default 100. * **show_tension** (*bool, optional*) – If True, color the line by tension magnitude, by default True. * **colormap** (*str, optional*) – Matplotlib colormap name, by default “viridis”. ### Raises: **ImportError** – If matplotlib is not installed. ``` -------------------------------- ### Retrieve Position Along Line (from Fairlead) Source: https://github.com/tridelat/pycatenary/blob/main/docs/source/readme.md Get the coordinates at a specific distance along the mooring line, measured from the fairlead. The distance must be less than or equal to the line length. ```python # get position at 5m along the line from fairlead line1.get_position(5.0, from_fairlead=True) ``` -------------------------------- ### plot_2d Source: https://github.com/tridelat/pycatenary/blob/main/docs/source/modules.md Generates a 2D plot of the mooring line, with options to show tension and customize the colormap. Requires matplotlib to be installed. ```APIDOC ## plot_2d(npoints: int = 100, show_tension: bool = True, colormap: str = 'viridis') -> None ### Description Plots line from anchor to fairlead in 2D. ### Parameters * **npoints** (*int, optional*) – Number of points along the line, by default 100. * **show_tension** (*bool, optional*) – If True, color the line by tension magnitude, by default True. * **colormap** (*str, optional*) – Matplotlib colormap name, by default “viridis”. ### Raises: **ImportError** – If matplotlib is not installed. ``` -------------------------------- ### Retrieve Tension Along Line (from Anchor) Source: https://github.com/tridelat/pycatenary/blob/main/docs/source/readme.md Get the tension at a specific distance along the mooring line, measured from the anchor. The distance must be less than or equal to the line length. ```python # get tension at 800m along the line from the anchor line1.get_tension(800.0) ``` -------------------------------- ### Retrieve Anchor Force Source: https://github.com/tridelat/pycatenary/blob/main/docs/source/readme.md Get the force experienced at the anchor of the mooring line. This function should be called after computing the solution. ```python # get force at the anchor line1.get_anchor_force() ``` -------------------------------- ### Get fairlead and anchor reaction forces Source: https://context7.com/tridelat/pycatenary/llms.txt Retrieve the 3D tension vector [N] at the fairlead or anchor connection points using get_fairlead_force() and get_anchor_force(). Horizontal components are positive magnitudes; vertical component has a sign. ```python from pycatenary import MooringLine line = MooringLine( fairlead=[-54.50, -19.84, -14.0], anchor=[-787.09, -286.48, -200.0], L=850.0, w=5844.1, EA=3.27e9, floor=True, ) line.compute_solution() fairlead_force = line.get_fairlead_force() # np.ndarray [Fx, Fy, Fz] N anchor_force = line.get_anchor_force() # np.ndarray [Fx, Fy, Fz] N print("Fairlead force [N]:", fairlead_force) # Fairlead force [N]: [1.23e+06 4.50e+05 -2.10e+05] print("Anchor force [N]:", anchor_force) # Anchor force [N]: [1.23e+06 4.50e+05 0.00e+00] (zero vertical if on floor) ``` -------------------------------- ### Retrieve Position Along Line (from Anchor) Source: https://github.com/tridelat/pycatenary/blob/main/docs/source/readme.md Get the coordinates at a specific distance along the mooring line, measured from the anchor. The distance must be less than or equal to the line length. ```python # get position at 800m along the line from the anchor line1.get_position(800.0) ``` -------------------------------- ### Get Position Along Mooring Line Source: https://context7.com/tridelat/pycatenary/llms.txt Calculates the 3D or 2D position of the cable at a given arc-length from the anchor or fairlead. Useful for generating the full cable geometry. ```python from pycatenary import MooringLine import numpy as np line = MooringLine( fairlead=[-54.50, -19.84, -14.0], anchor=[-787.09, -286.48, -200.0], L=850.0, w=5844.1, EA=3.27e9, floor=True, ) line.compute_solution() # Sample 20 points along the full line ss = np.linspace(0, 850.0, 20) positions = np.array([line.get_position(s) for s in ss]) print("Cable path (first 3 points):") print(positions[:3]) # [[-787.09 -286.48 -200. ] # [-743.21 -271.04 -198.3 ] # [-699.33 -255.6 -196.6 ]] # Position at 10 m from fairlead pos_near_fairlead = line.get_position(10.0, from_fairlead=True) print("Position 10m from fairlead [m]:", pos_near_fairlead) ``` -------------------------------- ### Get tension at arbitrary position along the line Source: https://context7.com/tridelat/pycatenary/llms.txt Calculate the tension vector [N] at a specific arc-length distance 's' [m] from the anchor (default) or fairlead using get_tension(). Horizontal components are returned as absolute values. ```python from pycatenary import MooringLine line = MooringLine( fairlead=[-54.50, -19.84, -14.0], anchor=[-787.09, -286.48, -200.0], L=850.0, w=5844.1, EA=3.27e9, floor=True, ) line.compute_solution() # Tension at 800 m from anchor T_anchor_side = line.get_tension(800.0) print("Tension at s=800m from anchor [N]:", T_anchor_side) # Tension at 5 m from fairlead T_fairlead_side = line.get_tension(5.0, from_fairlead=True) print("Tension at s=5m from fairlead [N]:", T_fairlead_side) # Tension at s=800m from anchor [N]: [1.20e+06 4.40e+05 1.50e+04] ``` -------------------------------- ### Visualize Mooring Line Shape Source: https://context7.com/tridelat/pycatenary/llms.txt Renders the cable shape using matplotlib, with optional tension coloring. `plot()` automatically dispatches to `plot_2d()` for 2D lines or `plot_3d()` for 3D lines. Requires `pip install pycatenary[plotting]`. ```python from pycatenary import MooringLine import numpy as np # 3D elastic line – renders a 3D matplotlib figure line3d = MooringLine( fairlead=[-54.50, -19.84, -14.0], anchor=[-787.09, -286.48, -200.0], L=850.0, w=5844.1, EA=3.27e9, floor=True, ) line3d.compute_solution() line3d.plot(npoints=200, show_tension=True, colormap="plasma") # or explicitly: line3d.plot_3d(npoints=200, show_tension=True, colormap="viridis") # 2D rigid hanging cable – renders a 2D matplotlib figure line2d = MooringLine( fairlead=[17.69, 0.0], anchor=[0.0, 0.0], L=20.0, w=1.962, EA=None, floor=False, ) line2d.compute_solution() line2d.plot_2d(show_tension=False) # Requires: pip install pycatenary[plotting] (installs matplotlib) ``` -------------------------------- ### MooringLine Class Initialization Source: https://context7.com/tridelat/pycatenary/llms.txt Demonstrates how to initialize the MooringLine class for different scenarios including 3D elastic, 2D rigid, and multisegmented cables. ```APIDOC ## MooringLine — High-level mooring line interface The primary user-facing class. Wraps `CatenaryElastic` or `CatenaryRigid` internally and handles 2D/3D coordinate transformations between the catenary's local 2D plane and world coordinates. ```python from pycatenary import MooringLine import numpy as np # --- 3D elastic mooring line with seabed contact --- line = MooringLine( fairlead=[-54.50, -19.84, -14.0], # [x, y, z] in metres anchor=[-787.09, -286.48, -200.0], # [x, y, z] in metres L=850.0, # unstretched length [m] w=5844.1, # submerged weight [N/m] EA=3.27e9, # axial stiffness [N]; set EA=None for rigid cable floor=True, # True = seabed at anchor elevation ) line.compute_solution() # --- 2D rigid cable hanging between two points at the same height --- line2d = MooringLine( fairlead=[17.69, 0.0], anchor=[0.0, 0.0], L=20.0, w=1.962, EA=None, # rigid (inextensible) floor=False, ) line2d.compute_solution() # --- Multisegmented 3D cable (lists ordered anchor → fairlead) --- line_multi = MooringLine( fairlead=[0.142, 0.0, 5.486], anchor=[7.083, 0.0, 0.0], L=[5.672, 0.126, 4.0, 0.259], # segment lengths [m] w=np.array([0.402, 1.558, 0.00425, 1.529]) * 9.81, # segment weights [N/m] EA=[2.050e3, 3.636e6, 10.873e3, 6.464e6], # segment stiffnesses [N] floor=True, ) line_multi.compute_solution() ``` ``` -------------------------------- ### Generate Documentation Source: https://github.com/tridelat/pycatenary/blob/main/docs/source/index.md Command to build the Sphinx documentation from the root directory of the project. The output will be in the build/html directory. ```bash cd docs sphinx-build -M html build ``` -------------------------------- ### Create and Compute a Partly Lifted Cable (2D) Source: https://github.com/tridelat/pycatenary/blob/main/docs/source/index.md Demonstrates a mooring line in a partly lifted configuration, including floor contact. Requires 'pycatenary' and 'numpy' to be imported. ```python from pycatenary import MooringLine import numpy as np # make mooring line in partly lifted line configuration line3 = MooringLine( fairlead=[-58.0, -14.0], anchor=[-836.7, -200.0], L=850.0, w=5844.1, EA=3.27e9, floor=True, ) line3.compute_solution() line3.plot() ``` -------------------------------- ### get_root_a Source: https://github.com/tridelat/pycatenary/blob/main/docs/source/modules.md Calculates the initial guess for the catenary parameter 'a' based on physical properties of the cable system. ```APIDOC ## pycatenary.root_finding.get_root_a(L: float, d: float, h: float, a0: float = 1.0, tol: float = 1e-06, maxit: int = 1000, int1: float = 0.01, int2: float = 10000000000.0) -> float ### Description Returns the initial guess for the catenary a parameter. ### Parameters #### Path Parameters - **L** (float) - Unstretched line length [m]. - **d** (float) - Horizontal distance between anchor and fairlead [m]. - **h** (float) - Vertical distance between anchor and fairlead [m]. - **a0** (float) - Initial guess for the catenary a parameter. - **tol** (float) - Tolerance for the root finding algorithm. - **maxit** (int) - Maximum number of iterations for the root finding algorithm. - **int1** (float) - Lower bound for the bisection algorithm. - **int2** (float) - Upper bound for the bisection algorithm. ### Returns **a** (float) - Initial guess for the catenary a parameter. ``` -------------------------------- ### Create and Compute a Mooring Line Source: https://github.com/tridelat/pycatenary/blob/main/docs/source/index.md Define properties of a mooring line and compute its catenary solution. Ensure the 'pycatenary' library is imported. ```python from pycatenary import MooringLine # define properties of cable line1 = MooringLine( fairlead=[-54.50, -19.84, -14.0], # fairlead position [m] anchor=[-787.09, -286.48, -200], # anchor position [m] L=850.0, # unstretched line length [m] w=5844.1, # submerged weight [N/m] EA=3.27e9, # axial stiffness [N] floor=True, # if True, floor at anchor level ) # compute solution for the catenary line1.compute_solution() ``` -------------------------------- ### Run pycatenary Tests Source: https://github.com/tridelat/pycatenary/blob/main/docs/source/index.md Execute the test suite for the pycatenary library from the root directory. ```bash pytest ``` -------------------------------- ### bisection Source: https://github.com/tridelat/pycatenary/blob/main/docs/source/modules.md Implements the bisection method for finding roots of transcendental equations. ```APIDOC ## pycatenary.root_finding.bisection(f: Callable[[float], float], int1: float, int2: float, tol: float = 1e-06, maxit: int = 1000, must_converge: bool = True) -> float ### Description Bisection root finding algorithm (for transcendental equations). ### Parameters #### Path Parameters - **f** (function) - Function to find the root of. - **int1** (float) - Lower bound for the bisection algorithm. - **int2** (float) - Upper bound for the bisection algorithm. - **tol** (float) - Tolerance for the root finding algorithm. - **maxit** (int) - Maximum number of iterations for the root finding algorithm. ### Returns **x** (float) - Root of the function. ### Return type float ``` -------------------------------- ### MooringLine Constructor Source: https://github.com/tridelat/pycatenary/blob/main/docs/source/modules.md Initializes a MooringLine object. This class represents a mooring line that can be elastic or rigid, and multisegmented or not. Properties for multisegmented lines should be provided as lists from anchor to fairlead. ```APIDOC ## class pycatenary.cable.MooringLine(fairlead: Sequence[float], anchor: Sequence[float], L: float | Sequence[float], w: float | Sequence[float], EA: float | Sequence[float] | None = None, floor: bool = True) ### Parameters * **fairlead** (*sequence of floats*) – Fairlead coordinates [x, y, z] (3D) or [x, y] (2D). * **anchor** (*sequence of floats*) – Anchor coordinates [x, y, z] (3D) or [x, y] (2D). * **L** (*float, or sequence of floats*) – Unstretched line length [m]. If a list is provided, it is assumed to be a multisegmented cable. * **w** (*float, or sequence of floats*) – Submerged weight [N/m]. If a list is provided, it must match the length of the L list. * **EA** (*float, or sequence of floats*) – Axial stiffness [N]. Must be provided if the cable is elastic. If EA is None, the cable is assumed to be rigid. If a list is provided, it must match the length of the L list. * **floor** (*bool*) – If True, the floor is assumed to be at the anchor level. If fairlead is below anchor, the floor will be at fairlead level. ``` -------------------------------- ### Create Inextensible Multisegmented Mooring Line Source: https://github.com/tridelat/pycatenary/blob/main/docs/source/index.md Initializes a multisegmented mooring line where the cable is made inextensible by setting the axial stiffness (EA) to None. The floor is enabled. ```python from pycatenary import MooringLine import numpy as np line4 = MooringLine( fairlead=[0.142, 0.0, 5.486], anchor=[7.083, 0.0, 0.0], L=[5.672, 0.126, 4.0, 0.259], w=np.array([0.402, 1.558, 0.00425, 1.529]) * 9.81, EA=None, floor=True ) line4.compute_solution() ``` -------------------------------- ### Construct MooringLine for 3D elastic cable with seabed contact Source: https://context7.com/tridelat/pycatenary/llms.txt Instantiate a MooringLine for a 3D elastic cable, specifying fairlead and anchor positions, cable properties (length, weight, stiffness), and enabling seabed contact. ```python from pycatenary import MooringLine import numpy as np # --- 3D elastic mooring line with seabed contact --- line = MooringLine( fairlead=[-54.50, -19.84, -14.0], # [x, y, z] in metres anchor=[-787.09, -286.48, -200.0], # [x, y, z] in metres L=850.0, # unstretched length [m] w=5844.1, # submerged weight [N/m] EA=3.27e9, # axial stiffness [N]; set EA=None for rigid cable floor=True, # True = seabed at anchor elevation ) line.compute_solution() ``` -------------------------------- ### Construct MooringLine for multisegmented 3D cable Source: https://context7.com/tridelat/pycatenary/llms.txt Instantiate a MooringLine for a multisegmented 3D cable. Provide lists for segment lengths, weights, and stiffnesses, ordered from anchor to fairlead. Seabed contact is enabled. ```python # --- Multisegmented 3D cable (lists ordered anchor → fairlead) --- line_multi = MooringLine( fairlead=[0.142, 0.0, 5.486], anchor=[7.083, 0.0, 0.0], L=[5.672, 0.126, 4.0, 0.259], # segment lengths [m] w=np.array([0.402, 1.558, 0.00425, 1.529]) * 9.81, # segment weights [N/m] EA=[2.050e3, 3.636e6, 10.873e3, 6.464e6], # segment stiffnesses [N] floor=True, ) line_multi.compute_solution() ``` -------------------------------- ### Move Fairlead Position Source: https://github.com/tridelat/pycatenary/blob/main/docs/source/index.md Demonstrates how to move the fairlead position of a mooring line and recompute the solution. This is useful for simulating different line states. ```python new_position = line3.get_fairlead_position() + np.array([50.0, 0.0]) line3.set_fairlead_position(new_position) line3.compute_solution() line3.plot() ``` ```python new_position = line3.get_fairlead_position() + np.array([100.0, 0.0]) line3.set_fairlead_position(new_position) line3.compute_solution() line3.plot() ``` ```python new_position = line3.get_fairlead_position() + np.array([-350.0, 0.0]) line3.set_fairlead_position(new_position) line3.compute_solution() line3.plot() ``` -------------------------------- ### MooringLine.compute_solution() Source: https://context7.com/tridelat/pycatenary/llms.txt Solves the catenary equilibrium equations for the mooring line. This method must be called after any changes to the line's geometry or positions before querying results. ```APIDOC ## `MooringLine.compute_solution()` — Solve catenary equilibrium Computes the catenary solution for the current anchor and fairlead positions. Must be called (or re-called) whenever positions change before querying any forces or geometry. ```python from pycatenary import MooringLine import numpy as np line = MooringLine( fairlead=[5.3, 0.0, 2.65], anchor=[0.0, 0.0, 0.0], L=6.98, w=1.036, EA=560.0e3, floor=True, ) line.compute_solution() # Move fairlead and re-solve (quasi-static stepping) for x in np.linspace(5.3, 4.9, 5): line.set_fairlead_position([x, 0.0, 2.65]) line.compute_solution() print(f"x={x:.2f}m fairlead force={line.get_fairlead_force()}") # x=5.30m fairlead force=[123.45 0. 456.78] # x=5.20m fairlead force=[...] # ... ``` ``` -------------------------------- ### Construct MooringLine for 2D rigid cable Source: https://context7.com/tridelat/pycatenary/llms.txt Instantiate a MooringLine for a 2D rigid cable, defining endpoints at the same height and specifying cable length and weight. Set EA=None for a rigid cable. ```python # --- 2D rigid cable hanging between two points at the same height --- line2d = MooringLine( fairlead=[17.69, 0.0], anchor=[0.0, 0.0], L=20.0, w=1.962, EA=None, # rigid (inextensible) floor=False, ) line2d.compute_solution() ``` -------------------------------- ### Solve Elastic Catenary with CatenaryElastic Source: https://context7.com/tridelat/pycatenary/llms.txt Instantiate and solve an elastic catenary problem using `CatenaryElastic`. This is useful for detailed analysis of stretchable cables where axial elongation is significant. Ensure NumPy is imported. ```python from pycatenary import CatenaryElastic import numpy as np cat = CatenaryElastic( L=[5.672, 0.126, 4.0, 0.259], # segment lengths [m] w=np.array([0.402, 1.558, 0.00425, 1.529]) * 9.81, # segment weights [N/m] EA=[2.050e3, 3.636e6, 10.873e3, 6.464e6], # axial stiffness [N] floor=True, ) cat.compute_solution(d=6.94, h=5.486) # elongation per segment after solution print("Elongations [m]:", cat.e) # Elongations [m]: [0.0012 0.0001 0.0008 0.0003] # shape parameter print("Catenary a:", cat.a) # lifted length per segment print("Lifted Ls [m]:", cat.Ls) # plot the catenary in local 2D coords cat.plot(npoints=100, show_tension=True) ``` -------------------------------- ### pycatenary.root_finding.fully_lifted_rigid Source: https://github.com/tridelat/pycatenary/blob/main/docs/source/modules.md Calculates the catenary solution for a fully lifted rigid cable. It returns the catenary shape parameter. ```APIDOC ## pycatenary.root_finding.fully_lifted_rigid ### Description Returns catenary solution for fully lifted rigid cable. ### Parameters #### Path Parameters - **d** (float) - Horizontal distance between anchor and fairlead [m]. - **h** (float) - Vertical distance between anchor and fairlead [m]. - **L** (Sequence[float]) - Unstretched line length [m]. #### Query Parameters - **tol** (float) - Tolerance for the root finding algorithm. - **maxit** (int) - Maximum number of iterations for the root finding algorithm. - **int1** (float) - Lower bound for the bisection algorithm. - **int2** (float) - Upper bound for the bisection algorithm. - **must_converge** (bool) - If True, an error will be raised if the algorithm does not converge. If False, a warning will be issued if the algorithm does not converge. ### Returns #### Success Response (200) **a** (float) - Catenary shape parameter. ``` -------------------------------- ### Low-Level Rigid Catenary Solver Source: https://context7.com/tridelat/pycatenary/llms.txt Directly solves the catenary equations for an inextensible (rigid) cable in 2D. Can be used standalone when 3D coordinate transformation is not needed. Computes solution for given horizontal and vertical spans. ```python from pycatenary import CatenaryRigid import numpy as np cat = CatenaryRigid( L=850.0, # total unstretched length [m] w=5844.1, # submerged weight [N/m] floor=True, ) cat.compute_solution(d=732.59, h=186.0) # horizontal and vertical span [m] # xy coords at arc-length s from anchor xy_mid = cat.s2xy(425.0) print("Midpoint (x, y):", xy_mid) # [366.3 -185.2] # tension vector at s T = cat.get_tension(425.0) print("Tension [N]:", T) # [Th, Tv] # forces at line ends print("Force at start (anchor side):", cat.get_force_beginning_of_line()) print("Force at end (fairlead side):", cat.get_force_end_of_line()) print("Lifted length:", np.sum(cat.Ls), "m") ``` -------------------------------- ### nofloor_rigid Source: https://github.com/tridelat/pycatenary/blob/main/docs/source/modules.md Calculates the catenary shape parameter 'a' for a rigid cable with no floor constraint. ```APIDOC ## pycatenary.root_finding.nofloor_rigid(d: float, h: float, L: Sequence[float], tol: float = 1e-06, maxit: int = 1000, int1: float = 0.01, int2: float = 10000000000.0, must_converge: bool = True) -> float ### Description Returns catenary shape for rigid cable with no floor. ### Parameters #### Path Parameters - **d** (float) - Horizontal distance between anchor and fairlead [m]. - **h** (float) - Vertical distance between anchor and fairlead [m]. - **L** (Sequence[float]) - Unstretched line length [m]. - **tol** (float) - Tolerance for the root finding algorithm. - **maxit** (int) - Maximum number of iterations for the root finding algorithm. - **int1** (float) - Lower bound for the bisection algorithm. - **int2** (float) - Upper bound for the bisection algorithm. - **must_converge** (bool) - If True, an error will be raised if the algorithm does not converge. If False, a warning will be issued if the algorithm does not converge. ### Returns **a** (float) - Catenary shape parameter. ### Return type float ``` -------------------------------- ### Retrieve Tension and Position Along Line Source: https://github.com/tridelat/pycatenary/blob/main/docs/source/index.md Calculate tension and position at a specified distance along the mooring line, measured from either the anchor or the fairlead. ```python # get tension at 800m along the line from the anchor line1.get_tension(800.0) # get position at 800m along the line from the anchor line1.get_position(800.0) # get tension at 5m along the line from fairlead line1.get_tension(5.0, from_fairlead=True) # get position at 5m along the line from fairlead line1.get_position(5.0, from_fairlead=True) ``` -------------------------------- ### compute_solution Source: https://github.com/tridelat/pycatenary/blob/main/docs/source/modules.md Computes the solution of the catenary based on the current anchor and fairlead positions. ```APIDOC ## compute_solution() -> None ### Description Computes solution of the catenary. It is computed according to current anchor and fairlead positions. ``` -------------------------------- ### CatenaryRigid Source: https://context7.com/tridelat/pycatenary/llms.txt Low-level rigid catenary solver. Directly solves the catenary equations for an inextensible (rigid) cable in 2D (horizontal distance `d`, vertical distance `h`). Can be used standalone without `MooringLine` when 3D coordinate transformation is not needed. ```APIDOC ## CatenaryRigid ### Description Low-level rigid catenary solver. Directly solves the catenary equations for an inextensible (rigid) cable in 2D (horizontal distance `d`, vertical distance `h`). Can be used standalone without `MooringLine` when 3D coordinate transformation is not needed. ### Method - `CatenaryRigid(L, w, floor=False)` - `compute_solution(d, h)` - `s2xy(s)` - `get_tension(s)` - `get_force_beginning_of_line()` - `get_force_end_of_line()` ### Parameters #### Initialization Parameters - **L** (float) - Required - Total unstretched length [m] - **w** (float) - Required - Submerged weight [N/m] - **floor** (bool) - Optional - If True, the cable rests on the seabed. Defaults to False. #### `compute_solution` Parameters - **d** (float) - Required - Horizontal span between endpoints [m] - **h** (float) - Required - Vertical span between endpoints [m] #### `s2xy` Parameters - **s** (float) - Required - Arc-length from anchor [m] #### `get_tension` Parameters - **s** (float) - Required - Arc-length from anchor [m] ### Request Example ```python from pycatenary import CatenaryRigid import numpy as np cat = CatenaryRigid( L=850.0, # total unstretched length [m] w=5844.1, # submerged weight [N/m] floor=True, ) cat.compute_solution(d=732.59, h=186.0) # horizontal and vertical span [m] # xy coords at arc-length s from anchor xy_mid = cat.s2xy(425.0) print("Midpoint (x, y):", xy_mid) # [366.3 -185.2] # tension vector at s T = cat.get_tension(425.0) print("Tension [N]:", T) # [Th, Tv] # forces at line ends print("Force at start (anchor side):", cat.get_force_beginning_of_line()) print("Force at end (fairlead side):", cat.get_force_end_of_line()) print("Lifted length:", np.sum(cat.Ls), "m") ``` ### Response #### Success Response (200) - **s2xy**: Returns a tuple `(x, y)` representing the coordinates at arc-length `s`. - **get_tension**: Returns a tuple `(Th, Tv)` representing the horizontal and vertical components of tension at arc-length `s`. - **get_force_beginning_of_line**: Returns a tuple `(Tx, Ty)` representing the forces at the start of the line. - **get_force_end_of_line**: Returns a tuple `(Tx, Ty)` representing the forces at the end of the line. - **Ls**: Returns the lengths of the segments of the catenary. ``` -------------------------------- ### Update Fairlead Position and Recompute Source: https://github.com/tridelat/pycatenary/blob/main/docs/source/index.md Modify the fairlead position of an existing mooring line and recompute the solution. This is useful for quasi-static analysis. ```python # change fairlead position line1.set_fairlead_position([-50.0, -19.84, -14.0]) # do not forget to recompute solution after updating positions line1.compute_solution() ``` -------------------------------- ### pycatenary.root_finding.fully_lifted_elastic Source: https://github.com/tridelat/pycatenary/blob/main/docs/source/modules.md Calculates the catenary solution for a fully lifted elastic cable. It returns the catenary shape parameter and the elongation of cable segments. ```APIDOC ## pycatenary.root_finding.fully_lifted_elastic ### Description Returns catenary solution for fully lifted elastic cable. ### Parameters #### Path Parameters - **d** (float) - Horizontal distance between anchor and fairlead [m]. - **h** (float) - Vertical distance between anchor and fairlead [m]. - **L** (Sequence[float]) - Unstretched line length [m]. - **w** (Sequence[float]) - Submerged weight [N/m]. - **EA** (Sequence[float]) - Axial stiffness [N]. #### Query Parameters - **tol** (float) - Tolerance for the root finding algorithm. - **maxit** (int) - Maximum number of iterations for the root finding algorithm. - **int1** (float) - Lower bound for the bisection algorithm. - **int2** (float) - Upper bound for the bisection algorithm. - **must_converge** (bool) - If True, an error will be raised if the algorithm does not converge. If False, a warning will be issued if the algorithm does not converge. ### Returns #### Success Response (200) - **a** (float) - Catenary shape parameter. - **e** (np.ndarray) - Elongation of the cable segments [m]. ``` -------------------------------- ### newton_raphson Source: https://github.com/tridelat/pycatenary/blob/main/docs/source/modules.md Implements the Newton-Raphson method for finding roots of transcendental equations. ```APIDOC ## pycatenary.root_finding.newton_raphson(f: Callable[[float], float], df: Callable[[float], float], x0: float, tol: float = 1e-06, maxit: int = 1000, must_converge: bool = True) -> float ### Description Newton-Raphson root finding algorithm (for transcendental equations). ### Parameters #### Path Parameters - **f** (function) - Function to find the root of. - **df** (function) - Derivative of the function f (df/dx). - **x0** (float) - Initial guess of x. - **tol** (float) - Tolerance for the root finding algorithm. - **maxit** (int) - Maximum number of iterations for the root finding algorithm. - **must_converge** (bool) - If True, an error will be raised if the algorithm does not converge. If False, a warning will be issued if the algorithm does not converge. ### Returns **x** (float) - Root of the function. ### Return type float ``` -------------------------------- ### pycatenary.catenary.CatenaryRigid Source: https://github.com/tridelat/pycatenary/blob/main/docs/source/modules.md A class for rigid catenary calculations. ```APIDOC ### *class* pycatenary.catenary.CatenaryRigid(L: float | Sequence[float], w: float | Sequence[float], floor: bool = True) Bases: [`CatenaryBase`](#pycatenary.catenary.CatenaryBase) A class for rigid catenary. ### Parameters * **L** (*Union[float, Sequence[float]]*) – Unstretched line length [m]. If a list is provided, it is assumed to be a multisegmented cable. * **w** (*Union[float, Sequence[float]]*) – Submerged weight [N/m]. If a list is provided, it must match the length of the L list. * **floor** (*bool*) – If True, the floor is assumed to be at the anchor level. #### compute_solution(d: float, h: float) -> None Calculates the solution for rigid catenary. ### Parameters * **d** (*float*) – Horizontal distance between anchor and fairlead [m]. * **h** (*float*) – Vertical distance between anchor and fairlead [m]. ``` -------------------------------- ### pycatenary.root_finding.nofloor_elastic Source: https://github.com/tridelat/pycatenary/blob/main/docs/source/modules.md Calculates the catenary solution for an elastic cable with no floor contact. It returns the catenary shape parameter and the elongation of cable segments. ```APIDOC ## pycatenary.root_finding.nofloor_elastic ### Description Returns catenary solution for elastic cable with no floor. ### Parameters #### Path Parameters - **d** (float) - Horizontal distance between anchor and fairlead [m]. - **h** (float) - Vertical distance between anchor and fairlead [m]. - **L** (Sequence[float]) - Unstretched line length [m]. - **w** (Sequence[float]) - Submerged weight [N/m]. - **EA** (Sequence[float]) - Axial stiffness [N]. #### Query Parameters - **tol** (float) - Tolerance for the root finding algorithm. - **maxit** (int) - Maximum number of iterations for the root finding algorithm. - **int1** (float) - Lower bound for the bisection algorithm. - **int2** (float) - Upper bound for the bisection algorithm. - **must_converge** (bool) - If True, an error will be raised if the algorithm does not converge. If False, a warning will be issued if the algorithm does not converge. ### Returns #### Success Response (200) - **a** (float) - Catenary shape parameter. - **e** (np.ndarray) - Elongation of the cable segments [m]. ``` -------------------------------- ### pycatenary.root_finding.partly_lifted_elastic Source: https://github.com/tridelat/pycatenary/blob/main/docs/source/modules.md Calculates the catenary solution for a partly lifted elastic cable. It returns the catenary shape parameter, the elongation of cable segments, and the lifted lengths of cable segments. ```APIDOC ## pycatenary.root_finding.partly_lifted_elastic ### Description Returns catenary solution for partly lifted elastic cable. ### Parameters #### Path Parameters - **d** (float) - Horizontal distance between anchor and fairlead [m]. - **h** (float) - Vertical distance between anchor and fairlead [m]. - **L** (Sequence[float]) - Unstretched line length [m]. - **w** (Sequence[float]) - Submerged weight [N/m]. - **EA** (Sequence[float]) - Axial stiffness [N]. #### Query Parameters - **tol** (float) - Tolerance for the root finding algorithm. - **maxit** (int) - Maximum number of iterations for the root finding algorithm. - **int1** (float) - Lower bound for the bisection algorithm. - **int2** (float) - Upper bound for the bisection algorithm. - **must_converge** (bool) - If True, an error will be raised if the algorithm does not converge. If False, a warning will be issued if the algorithm does not converge. ### Returns #### Success Response (200) - **a** (float) - Catenary shape parameter. - **e** (np.ndarray) - Elongation of the cable segments [m]. - **Lsu** (np.ndarray) - Lifted line lengths of the cable segments [m]. ``` -------------------------------- ### MooringLine.set_fairlead_position() / set_anchor_position() Source: https://context7.com/tridelat/pycatenary/llms.txt Updates the fairlead or anchor world coordinates and recalculates the internal direction/distance parameters. Always call `compute_solution()` afterward to update forces and geometry. ```APIDOC ## MooringLine.set_fairlead_position() / set_anchor_position() ### Description Updates the fairlead or anchor world coordinates and recalculates the internal direction/distance parameters. Always call `compute_solution()` afterward to update forces and geometry. ### Method - `set_fairlead_position(position)` - `set_anchor_position(position)` ### Parameters #### Path Parameters - **position** (list[float]) - Required - The new [x, y, z] or [x, y] world coordinates for the fairlead or anchor. ### Request Example ```python from pycatenary import MooringLine import numpy as np line = MooringLine( fairlead=[-58.0, -14.0], # 2D line anchor=[-836.7, -200.0], L=850.0, w=5844.1, EA=3.27e9, floor=True, ) line.compute_solution() print("Initial fairlead force:", line.get_fairlead_force()) # Step the fairlead along x for quasi-static analysis for delta_x in [50.0, 100.0, -350.0]: new_pos = line.get_fairlead_position() + np.array([delta_x, 0.0]) line.set_fairlead_position(new_pos) line.compute_solution() print(f"Fairlead @ {line.get_fairlead_position()} → force {line.get_fairlead_force()}") ``` ```