{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Assignment 1(a): Roll added-inertia of a submerged body\n",
    "\n",
    "In this assignment you will extend the functions from the panel method notebook to predict the flow and forces induced by **roll motion**.\n",
    "\n",
    "1. _Sketch_ a body subject to roll motion $\\Omega_z=U_6$ around the point $(x_m,y_m)$. _Determine_ the equation for the normal body velocity $U_n$ at any point $(x,y)$ on the body surface. Using this, _define_ the RHS of the body boundary condition $ \\frac{\\partial\\phi_6}{\\partial n} = b_6$. _Define_ the equation for the roll added-inertia $m_{66}$ in terms of these variables.\n",
    "\n",
    "1. _Implement_ a function `roll` which takes in the coordinate arrays `x,y` defining a shape and the roll center `xm,ym` and returns the source strength vector `q6` and added-inertia `m66`. Make sure you _explain_ the linear algebra equations you have implemented for `q6,m66`.  _Validate_ the `roll` function by comparing to a known $m_{66}$ for a fully submerged shape (cite your reference) and _discuss_ the convergence behaviour. _Plot_ the induced flow and _discuss_ it's physical characteristics.\n",
    "\n",
    "## Due 23:59, 24 Feb 2022\n",
    "\n",
    "* Write-up your solution for both Q1 & 2 and submit as a `PDF` or `HTML`. *Note:* If you make a `PDF`, you need to include images of important functions and the results plots. Exporting a notebook as `HTML` will contain everything automatically.\n",
    "* Submit the working python code needed to reproduce those plots as a `PY` or `IPYNB`. *Note:* Explain your method/results in the write-up, not in the code. Any time you are tempted to write \"see code for ____\", put the important information in the write-up instead."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "# Import functions\n",
    "import requests\n",
    "url = 'https://raw.githubusercontent.com/weymouth/MarineHydro/master/src/PanelMethod.py'\n",
    "exec(requests.get(url).content)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "# Complete function\n",
    "# def roll(x,y,xm=0,ym=0,G=source,args=()):\n",
    "#     return q6,m66\n",
    "\n",
    "# Create validation geometry, validate m66, and plot flow"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.12"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}