{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Mooring Module Example\n", "\n", "In this example, we'll explore the functionalities of the Mooring module of the Marine and Hydrokinetic Toolkit (MHKiT). As of now, this module primarily supports output from MoorDyn, an innovative tool for simulating the complex dynamics of mooring lines used in marine applications.\n", "\n", "The objective will be to analyze the MoorDyn output data of a single mooring line. The steps are:\n", "1. **Import Data** - Import the MoorDyn output\n", "2. **Lay Length** - Calculate the lay length parameter\n", "3. **Visualize** - Create graphical animations" ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "import mhkit.mooring as mooring\n", "import os" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Importing Data with the IO Module\n", "\n", "The first step is to import the MoorDyn output file. This file contains the key data that we'll be analyzing throughout this notebook. If support for other types of output is desired, please raise an issue or reach out to the MHKiT team!\n", "\n", "The code below provides paths to two files:\n", "* fpath = MoorDyn output file of a single mooring line containing node positions and segment tensions\n", "* inputfile = Path to MoorDyn input file that corresponds to the output. This is an optional argument which parses the input parameters and writes them to the xarray object as attributes for reference. Note: the input file provided here does not match the output and is only meant for demonstration purposes.\n", "\n", "We use the `mooring.io.read_moordyn` function to import the data from these files into an xarray Dataset:" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
<xarray.Dataset>\n", "Dimensions: (Time: 3581)\n", "Coordinates:\n", " * Time (Time) float64 0.0 0.025 0.05 0.075 0.1 ... 89.42 89.45 89.47 89.5\n", "Data variables: (12/43)\n", " Node0px (Time) float64 -300.0 -300.0 -300.0 ... -300.0 -300.0 -300.0\n", " Node0py (Time) float64 0.0 0.0 0.0 0.0 0.0 0.0 ... 0.0 0.0 0.0 0.0 0.0 0.0\n", " Node0pz (Time) float64 -56.0 -56.0 -56.0 -56.0 ... -56.0 -56.0 -56.0 -56.0\n", " Node1px (Time) float64 -295.0 -295.0 -295.0 ... -295.0 -295.0 -295.0\n", " Node1py (Time) float64 0.0 0.0 0.0 0.0 0.0 0.0 ... 0.0 0.0 0.0 0.0 0.0 0.0\n", " Node1pz (Time) float64 -56.02 -56.02 -56.02 ... -56.02 -56.02 -56.02\n", " ... ...\n", " Seg5Ten (Time) float64 5.266e+04 5.237e+04 ... 3.502e+04 3.502e+04\n", " Seg6Ten (Time) float64 5.266e+04 5.238e+04 ... 3.502e+04 3.502e+04\n", " Seg7Ten (Time) float64 5.267e+04 5.24e+04 ... 3.502e+04 3.502e+04\n", " Seg8Ten (Time) float64 5.268e+04 5.242e+04 ... 3.502e+04 3.502e+04\n", " Seg9Ten (Time) float64 5.27e+04 5.244e+04 ... 3.502e+04 3.502e+04\n", " Seg10Ten (Time) float64 5.6e+04 5.573e+04 5.555e+04 ... 3.714e+04 3.713e+04\n", "Attributes:\n", " LINE_TYPES: {'main': {'Diam': '0.0766', 'MassDen': '113.35', 'EA': '7.53...\n", " POINTS: {'1': {'Attachment': 'Fixed', 'X': '418.8', 'Y': '725.383', ...\n", " LINES: {'1': {'LineType': 'main', 'AttachA': '1', 'AttachB': '4', '...\n", " OPTIONS: {'dtM': '0.001', 'kbot': '3.0e6', 'cbot': '3.0e5', 'dtIC': '...
<xarray.DataArray (Time: 3581)> Size: 29kB\n", "array([45.001, 45.001, 45.001, ..., 45.001, 45.001, 45.001])\n", "Coordinates:\n", " * Time (Time) float64 29kB 0.0 0.025 0.05 0.075 ... 89.42 89.45 89.47 89.5