{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Aperiodic monotile" ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "import lostinmsh as lsm\n", "import matplotlib.pyplot as plt\n", "import numpy as np\n", "\n", "%matplotlib inline\n", "plt.rcParams.update({\"font.size\": 15})" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Define the polygon" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "vertices = [\n", " [0, 0],\n", " [0, np.sqrt(3)],\n", " [1, np.sqrt(3)],\n", " [3 / 2, 3 * np.sqrt(3) / 2],\n", " [3, np.sqrt(3)],\n", " [3, 0],\n", " [4, 0],\n", " [9 / 2, -np.sqrt(3) / 2],\n", " [3, -np.sqrt(3)],\n", " [3 / 2, -np.sqrt(3) / 2],\n", " [1, -np.sqrt(3)],\n", " [-1, -np.sqrt(3)],\n", " [-3 / 2, -np.sqrt(3) / 2],\n", "]\n", "polygon = lsm.Polygon.from_vertices(vertices, \"Cavity\")\n", "\n", "fig, ax = plt.subplots(figsize=[5, 5], layout=\"constrained\")\n", "lsm.plot_polygon(polygon, ax=ax)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Define the geometry" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [], "source": [ "geometry = lsm.Geometry.from_polygon(polygon, lsm.AutoCircular(border_factor=0.25))\n", "\n", "fig, ax = plt.subplots(figsize=[5, 5], layout=\"constrained\")\n", "lsm.plot_geometry(geometry, ax=ax)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Mesh the geometry" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Info : Increasing process stack size (8192 kB < 16 MB)\n" ] } ], "source": [ "lsm.mesh_unstructured(geometry, 0.2, lsm.GmshOptions(gui=True))" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Locally structured mesh the geometry" ] }, { "cell_type": "code", "execution_count": 5, "metadata": { "tags": [] }, "outputs": [], "source": [ "lsm.mesh_loc_struct(geometry, 0.2, lsm.GmshOptions(gui=True))" ] } ], "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.11.0rc1" }, "vscode": { "interpreter": { "hash": "31f2aee4e71d21fbe5cf8b01ff0e069b9275f58929596ceb00d14d90e3e16cd6" } } }, "nbformat": 4, "nbformat_minor": 4 }