{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "## Examples from the gridgen-c library\n", "\n", "These are some examples from the original `gridgen-c` library." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "%matplotlib inline\n", "\n", "import warnings\n", "warnings.simplefilter('ignore')\n", "\n", "import numpy\n", "from matplotlib import pyplot\n", "import pandas\n", "import seaborn\n", "clear_bkgd = {'axes.facecolor':'none', 'figure.facecolor':'none'}\n", "seaborn.set(style='ticks', context='notebook', rc=clear_bkgd, color_codes=True)\n", "\n", "import pygridgen\n", "\n", "from dochelpers import read_boundary, plot_grid" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Sensitivity to $\\beta$\n", "This examples shows how a subtle change in the placement of the negative turning points changes how many nodes are \"captured\" into the side channel and alters the layout of the whole grid." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "fig, axes = pyplot.subplots(figsize=(10, 8), ncols=2, nrows=2,\n", " sharex=True, sharey=True)\n", "\n", "for n, (axrow, leg_loc) in enumerate(zip(axes, ('upper left', None)), 1):\n", " x, y, beta, ul_idx = read_boundary(n)\n", " grid = pygridgen.Gridgen(x, y, beta, ul_idx=ul_idx, shape=(40, 20))\n", " plot_grid(grid, data_ax=axrow[0], cell_ax=axrow[1], leg_loc=leg_loc)\n", " \n", "fig.tight_layout()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Basic Estuary" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "x, y, beta, ul_idx = read_boundary(0)\n", "grid = pygridgen.Gridgen(x, y, beta, ul_idx=ul_idx, shape=(90, 120))\n", "\n", "fig, (data_ax, cell_ax) = pyplot.subplots(figsize=(14, 7), ncols=2, sharey=True)\n", "plot_grid(grid, data_ax=data_ax, cell_ax=cell_ax, leg_loc='upper left')\n", "fig.tight_layout()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### These are just weird" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "fig, (data_ax, cell_ax) = pyplot.subplots(figsize=(10, 10), ncols=2, sharey=True)\n", "x, y, beta, ul_idx = read_boundary(3)\n", "grid = pygridgen.Gridgen(x, y, beta, ul_idx=ul_idx, shape=(40, 125))\n", "plot_grid(grid, data_ax=data_ax, cell_ax=cell_ax, leg_loc=(1.0, 0.5))\n", "fig.tight_layout()" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "fig, (data_ax, cell_ax) = pyplot.subplots(figsize=(15, 7), ncols=2, sharey=True)\n", "x, y, beta, ul_idx = read_boundary(4)\n", "grid = pygridgen.Gridgen(x, y, beta, ul_idx=ul_idx, shape=(40, 80))\n", "plot_grid(grid, data_ax=data_ax, cell_ax=cell_ax, leg_loc='upper right')\n", "fig.tight_layout()" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "x, y, beta, ul_idx = read_boundary(5)\n", "grid = pygridgen.Gridgen(x, y, beta, ul_idx=ul_idx, shape=(31, 31))\n", "\n", "fig, (data_ax, cell_ax) = pyplot.subplots(figsize=(17, 8), ncols=2, sharey=True)\n", "plot_grid(grid, data_ax=data_ax, cell_ax=cell_ax, leg_loc='right')\n", "fig.tight_layout()" ] } ], "metadata": { "kernelspec": { "display_name": "Python [default]", "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.6.5" } }, "nbformat": 4, "nbformat_minor": 1 }