{ "cells": [ { "cell_type": "raw", "metadata": { "raw_mimetype": "text/restructuredtext" }, "source": [ "Finite element model from surfaces with per tissue mesh size\n", "============================================================\n", "\n", "A last possibility is to specify a value of characteristic length for each tissue. The process is once again the same." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "from shamo import FEM\n", "\n", "model = FEM(\"fem_from_surfaces_lc-tissue\", \"../../derivatives\")" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "from pathlib import Path\n", "\n", "data_path = Path(\"../../rawdata/surfaces\")\n", "tissues = {\n", " f\"tissue_{i}\": data_path / f\"surfaces_tissue{i}.stl\" for i in range(1, 8)\n", "}" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "structure = [\n", " \"tissue_1\", [\n", " [\"tissue_2\",\n", " [\"tissue_3\"]\n", " ],\n", " [\"tissue_4\", [\n", " [\"tissue_5\"],\n", " [\"tissue_6\",\n", " [\"tissue_7\"]\n", " ]\n", " ]]\n", " ]\n", "]" ] }, { "cell_type": "raw", "metadata": { "raw_mimetype": "text/restructuredtext" }, "source": [ "We simply have to define a dictionary containing the values for the characteristic length. If all the tissues do not have a special value, the `defaut` key must be included." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "lc = {\n", " \"default\": 0.5,\n", " \"tissue_2\": 0.01,\n", " \"tissue_4\": 0.01,\n", "}" ] }, { "cell_type": "raw", "metadata": { "raw_mimetype": "text/restructuredtext" }, "source": [ "Finally we pass this dictionary to the :py:func:`~shamo.FEM.mesh_from_surfaces` method." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "model.mesh_from_surfaces(tissues, structure, lc)" ] } ], "metadata": { "kernelspec": { "display_name": "shamo", "language": "python", "name": "shamo" }, "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.5" } }, "nbformat": 4, "nbformat_minor": 4 }