{ "cells": [ { "cell_type": "markdown", "metadata": { "editable": true, "slideshow": { "slide_type": "" }, "tags": [] }, "source": [ "# User Guide\n" ] }, { "cell_type": "markdown", "metadata": { "vscode": { "languageId": "plaintext" } }, "source": [ "This part of the documentation teaches you how to use the tools provided by the library through simple examples, with some background information.\n" ] }, { "cell_type": "raw", "metadata": { "editable": true, "raw_mimetype": "text/restructuredtext", "slideshow": { "slide_type": "" }, "tags": [] }, "source": [ "The typical workflow in any simulation in the field of computational solid mechanics consists of the following steps:\n", "\n", "1. Setting up the solid domains and defining material properties.\n", " \n", " The tools in the library are limited to simply supported beams and plates. \n", "\n", "2. Defining boundary conditions (loads and supports).\n", "\n", " You only have to set up loads here, since the essential boundary conditions (displacement supports) are automatically satisfied by the approximation model. \n", "\n", "3. Performing some calculations.\n", "\n", " Currently, the library supports linear elastic calculations.\n", "\n", "4. Visualization of the results.\n", " \n", " Check out the :ref:`examples gallery `.\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Setting up the domains\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Euler-Bernoulli and Timoshenko beams\n" ] }, { "cell_type": "raw", "metadata": { "editable": true, "raw_mimetype": "text/restructuredtext", "slideshow": { "slide_type": "" }, "tags": [] }, "source": [ "The library provides solutions for both Euler-Bernoully and Timoshenko beams, and setting up any of the two is quite similar. If you provide shear stiffness, the beam is a Timoshenko one, otherwise it is Euler-Bernoulli. The following code snippet illustrates the steps using the :class:`~sigmaepsilon.solid.fourier.beam.NavierBeam` class." ] }, { "cell_type": "code", "execution_count": 1, "metadata": { "editable": true, "slideshow": { "slide_type": "" }, "tags": [] }, "outputs": [], "source": [ "from sigmaepsilon.solid.fourier import NavierBeam\n", "\n", "# geometry\n", "beam_length = 1000.0\n", "width, height = 20.0, 80.0 # rectangular cross-section\n", "\n", "# material properties\n", "young_modulus, poisson_ratio = 210000.0, 0.25 # material\n", "\n", "# stiffness properties\n", "inertia = width * height**3 / 12\n", "bending_stiffness = young_modulus * inertia\n", "\n", "# solution parameters\n", "number_of_modes = 100\n", "\n", "bernoulli_beam = NavierBeam(beam_length, number_of_modes, EI=bending_stiffness)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "If your beam is of the Timoshenko type, you also have to provide the shear stiffness of the cross section.\n" ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "editable": true, "slideshow": { "slide_type": "" }, "tags": [] }, "outputs": [], "source": [ "# calculate shear stiffness\n", "area = width * height\n", "shear_modulus = young_modulus / (2 * (1 + poisson_ratio))\n", "shear_correction_factor = 5 / 6\n", "shear_stiffness = shear_modulus * area * shear_correction_factor\n", "\n", "timoshenko_beam = NavierBeam(\n", " beam_length, number_of_modes, EI=bending_stiffness, GA=shear_stiffness\n", ")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "In both cases, you also had to specify the number of harmonic terms involved in the solution at creating the instances for your beams.\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Kirchoff-Love and Uflyand-Mindlin plates\n" ] }, { "cell_type": "raw", "metadata": { "editable": true, "raw_mimetype": "text/restructuredtext", "slideshow": { "slide_type": "" }, "tags": [], "vscode": { "languageId": "raw" } }, "source": [ "You can define Kirchhoff-Love or Uflyand-Mindlin plates using the \n", ":class:`~sigmaepsilon.solid.fourier.plate.NavierPlate` class. Things are a bit more complicated, \n", "as there are more stiffness parameters to calculate and both the bending and shear stiffness terms \n", "have to be provided with matrices, depending on the type of plate you want. If you know how to, you \n", "can calculate these stiffness matrices on your own, or you can use tools from other solutions from \n", "the SigmaEpsilon ecosystem. We definitively suggest you to utilize all that SigmaEpsilon has to offer." ] }, { "cell_type": "markdown", "metadata": { "editable": true, "slideshow": { "slide_type": "" }, "tags": [] }, "source": [ "First we create a Kirchhoff-Love plate. For this, you have to specify the material stiffness matrix for the plate, which, for a linearly isotropic material takes the form of\n", "\n", "$$\n", "D = \\frac{E h^3}{12 (1 - \\nu^2)}\n", "\\begin{bmatrix}\n", "1 & \\nu & 0 \\\\\n", "\\nu & 1 & 0 \\\\\n", "0 & 0 & \\frac{1 - \\nu}{2}\n", "\\end{bmatrix}\n", "$$\n", "\n", "where $E$ is the Young's modulus, $\\nu$ is the Poisson's ratio and $h$ is the thickness. Of course, this easy to do manually.\n" ] }, { "cell_type": "code", "execution_count": 3, "metadata": { "editable": true, "slideshow": { "slide_type": "" }, "tags": [] }, "outputs": [], "source": [ "import numpy as np\n", "from sigmaepsilon.solid.fourier import NavierPlate\n", "\n", "# geometry\n", "length_X, length_Y = (600.0, 800.0)\n", "thickness = 25.0\n", "\n", "# material properties\n", "young_modulus = 2890.0\n", "poisson_ratio = 0.2\n", "\n", "# solution parameters\n", "number_of_modes_X = 20\n", "number_of_modes_Y = 20\n", "\n", "# stiffness\n", "D_factor = young_modulus * thickness**3 / (12 * (1 - poisson_ratio**2))\n", "bending_stiffness = D_factor * np.array(\n", " [[1, poisson_ratio, 0], [poisson_ratio, 1, 0], [0, 0, (1 - poisson_ratio) / 2]]\n", ")\n", "\n", "kirchhoff_plate = NavierPlate(\n", " (length_X, length_Y),\n", " (number_of_modes_X, number_of_modes_Y),\n", " D=bending_stiffness,\n", ")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "If you want more power, you can use the tools from other libraries in the SigmaEpsilon ecosystem.\n" ] }, { "cell_type": "code", "execution_count": 4, "metadata": { "editable": true, "slideshow": { "slide_type": "" }, "tags": [] }, "outputs": [], "source": [ "from sigmaepsilon.math.linalg import ReferenceFrame\n", "\n", "from sigmaepsilon.solid.material import (\n", " KirchhoffPlateSection,\n", " ElasticityTensor,\n", " LinearElasticMaterial,\n", " HuberMisesHenckyFailureCriterion_SP,\n", ")\n", "from sigmaepsilon.solid.material.utils import elastic_stiffness_matrix\n", "\n", "from sigmaepsilon.solid.fourier import NavierPlate\n", "\n", "# GEOMETRY\n", "length_X, length_Y = (600.0, 800.0)\n", "thickness = 25.0\n", "\n", "# MATERIAL PROPERTIES\n", "young_modulus = 2890.0\n", "poisson_ratio = 0.2\n", "yield_strength = 2.0\n", "\n", "# SOLUTION PARAMETERS\n", "number_of_modes_X = 20\n", "number_of_modes_Y = 20\n", "\n", "# SETTING UP HOOKE'S LAW\n", "hooke = elastic_stiffness_matrix(E=young_modulus, NU=poisson_ratio)\n", "frame = ReferenceFrame(dim=3)\n", "stiffness = ElasticityTensor(hooke, frame=frame, tensorial=False)\n", "failure_model = HuberMisesHenckyFailureCriterion_SP(yield_strength=yield_strength)\n", "material = LinearElasticMaterial(stiffness=stiffness, failure_model=failure_model)\n", "\n", "# CALCULATING SECTION STIFFNESS\n", "kirchhoff_section = KirchhoffPlateSection(\n", " layers=[\n", " KirchhoffPlateSection.Layer(material=material, thickness=thickness),\n", " ]\n", ")\n", "bending_stiffness = kirchhoff_section.elastic_stiffness_matrix()\n", "\n", "kirchhoff_plate = NavierPlate(\n", " (length_X, length_Y),\n", " (number_of_modes_X, number_of_modes_Y),\n", " D=bending_stiffness,\n", ")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Similarly to beams, if you want to set up an Uflyand-Mindlin plate, the only difference is that you also have to provide the shear stiffness terms at instantiation. These are described by the matrix\n", "\n", "$$\n", "G = \\kappa \\frac{E h}{2 (1 + \\nu)}\n", "\\begin{bmatrix}\n", "1 & 0 \\\\\n", "0 & 1\n", "\\end{bmatrix}\n", "$$\n", "\n", "where $\\kappa$ is the shear correction factor.\n" ] }, { "cell_type": "code", "execution_count": 5, "metadata": { "editable": true, "slideshow": { "slide_type": "" }, "tags": [] }, "outputs": [], "source": [ "D_factor = young_modulus * thickness**3 / (12 * (1 - poisson_ratio**2))\n", "bending_stiffness = D_factor * np.array(\n", " [[1, poisson_ratio, 0], [poisson_ratio, 1, 0], [0, 0, (1 - poisson_ratio) / 2]]\n", ")\n", "G_factor = (5 / 6) * young_modulus * thickness / (2 * (1 + poisson_ratio))\n", "shear_stiffness = G_factor * np.array([[1, 0], [0, 1]])\n", "\n", "mindlin_plate = NavierPlate(\n", " (length_X, length_Y),\n", " (number_of_modes_X, number_of_modes_Y),\n", " D=bending_stiffness,\n", " S=shear_stiffness,\n", ")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Again, you can insted use the tools from the SigmaEpsilon ecosystem.\n" ] }, { "cell_type": "code", "execution_count": 6, "metadata": { "editable": true, "slideshow": { "slide_type": "" }, "tags": [] }, "outputs": [], "source": [ "from sigmaepsilon.solid.material import MindlinPlateSection\n", "from numpy import ascontiguousarray as ascont\n", "\n", "mindlin_section = MindlinPlateSection(\n", " layers=[\n", " MindlinPlateSection.Layer(material=material, thickness=thickness),\n", " ]\n", ")\n", "ABDS_matrix = mindlin_section.elastic_stiffness_matrix()\n", "bending_stiffness, shear_stiffness = (\n", " ascont(ABDS_matrix[:3, :3]),\n", " ascont(ABDS_matrix[3:, 3:]),\n", ")\n", "\n", "mindlin_plate = NavierPlate(\n", " (length_X, length_Y),\n", " (number_of_modes_X, number_of_modes_Y),\n", " D=bending_stiffness,\n", " S=shear_stiffness,\n", ")" ] }, { "cell_type": "raw", "metadata": { "editable": true, "raw_mimetype": "text/restructuredtext", "slideshow": { "slide_type": "" }, "tags": [], "vscode": { "languageId": "raw" } }, "source": [ ".. note:\n", " This was a very basic setup for a plate. In more complex cases, it is recommended to\n", " use the tools in [sigmaepsilon.solid.material](https://sigmaepsilonsolidmaterial.readthedocs.io/en/latest/?badge=latest) \n", " which, besides other things, calculates shear correction factors for anisotropic multi-layered plates as well." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Specifying boundary conditions\n" ] }, { "cell_type": "markdown", "metadata": { "editable": true, "slideshow": { "slide_type": "" }, "tags": [] }, "source": [ "As mentioned before, you only have to care about defining the natural boundary conditions (aka. loads) of the problem. Regardless of the type of domain you have, defining the loads is quite similar, but there are some subtle differences. In both cases you need to organize your loads into groups.\n" ] }, { "cell_type": "markdown", "metadata": { "editable": true, "slideshow": { "slide_type": "" }, "tags": [] }, "source": [ "### Loads for beams\n" ] }, { "cell_type": "raw", "metadata": { "editable": true, "raw_mimetype": "text/restructuredtext", "slideshow": { "slide_type": "" }, "tags": [] }, "source": [ "For beams, you can define concentrated, or linear loads using the classes :class:`~sigmaepsilon.solid.fourier.loads.PointLoad` and :class:`~sigmaepsilon.solid.fourier.loads.LineLoad` classes. In both cases, you have to provide values for the vertical load $F_y$ and the bending moment $M_z$." ] }, { "cell_type": "code", "execution_count": 7, "metadata": { "editable": true, "slideshow": { "slide_type": "" }, "tags": [] }, "outputs": [], "source": [ "from sigmaepsilon.solid.fourier import LoadGroup, PointLoad, LineLoad\n", "\n", "beam_loads = LoadGroup(\n", " concentrated=LoadGroup(\n", " LC1=PointLoad(beam_length / 2, [1.0, 0.0]),\n", " LC2=PointLoad(beam_length / 2, [0.0, 1.0]),\n", " ),\n", " distributed=LoadGroup(\n", " LC3=LineLoad([0, beam_length], [1.0, 0.0]),\n", " LC4=LineLoad([beam_length / 2, beam_length], [0.0, 1.0]),\n", " ),\n", ")" ] }, { "cell_type": "raw", "metadata": { "editable": true, "raw_mimetype": "text/restructuredtext", "slideshow": { "slide_type": "" }, "tags": [] }, "source": [ "With the :class:`~sigmaepsilon.solid.fourier.loads.LineLoad` class, you can also define arbitrary functions by passing strings for the load values. For instance, to define a sinusoidal vertical load on the right side of the beam:" ] }, { "cell_type": "code", "execution_count": 8, "metadata": { "editable": true, "slideshow": { "slide_type": "" }, "tags": [] }, "outputs": [], "source": [ "load_case = LineLoad([beam_length / 2, beam_length], [\"sin(x)\", 0.0])" ] }, { "cell_type": "markdown", "metadata": { "editable": true, "slideshow": { "slide_type": "" }, "tags": [] }, "source": [ "In these cases, the load coefficients are calculated using a Monte-Carlo simulation.\n" ] }, { "cell_type": "markdown", "metadata": { "editable": true, "slideshow": { "slide_type": "" }, "tags": [] }, "source": [ "### Loads for plates\n" ] }, { "cell_type": "raw", "metadata": { "editable": true, "raw_mimetype": "text/restructuredtext", "slideshow": { "slide_type": "" }, "tags": [] }, "source": [ "For plates, you can define concentrated, or distributed loads over a rectangle using the classes :class:`~sigmaepsilon.solid.fourier.loads.PointLoad` and :class:`~sigmaepsilon.solid.fourier.loads.RectangleLoad` classes. In these cases, you must provide values for the vertical load $F_z$ and the two moments $M_y$ and $M_z$." ] }, { "cell_type": "code", "execution_count": 9, "metadata": { "editable": true, "slideshow": { "slide_type": "" }, "tags": [] }, "outputs": [], "source": [ "from sigmaepsilon.solid.fourier import RectangleLoad\n", "\n", "plate_loads = LoadGroup(\n", " LC1=PointLoad([length_X / 2, length_Y / 2], [-1.0, 0.0, 0.0]),\n", " LC2=RectangleLoad([[0, 0], [length_X, length_Y]], [-0.1, 0, 0]),\n", ")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Linear Static Analysis\n" ] }, { "cell_type": "markdown", "metadata": { "editable": true, "raw_mimetype": "text/restructuredtext", "slideshow": { "slide_type": "" }, "tags": [] }, "source": [ "Besides the loads, you also have to provide the points of evaluation where you want the results to be calculated.\n", "To perform a linear static analysis, call the ``linear_static_analysis`` instance method." ] }, { "cell_type": "code", "execution_count": 10, "metadata": { "editable": true, "slideshow": { "slide_type": "" }, "tags": [] }, "outputs": [], "source": [ "import numpy as np\n", "\n", "# the locations of the points where the solution is calculated\n", "beam_points = np.linspace(0, beam_length, 500)\n", "\n", "bernoulli_solution = bernoulli_beam.linear_static_analysis(beam_points, beam_loads)\n", "timoshenko_solution = timoshenko_beam.linear_static_analysis(beam_points, beam_loads)" ] }, { "cell_type": "markdown", "metadata": { "editable": true, "slideshow": { "slide_type": "" }, "tags": [] }, "source": [ "For plates, we can calculate the locations of the points of evaluation using `numpy.meshgrid`.\n" ] }, { "cell_type": "code", "execution_count": 11, "metadata": { "editable": true, "slideshow": { "slide_type": "" }, "tags": [] }, "outputs": [], "source": [ "x = np.linspace(0, length_X, 30)\n", "y = np.linspace(0, length_Y, 40)\n", "xv, yv = np.meshgrid(x, y)\n", "plate_points = np.stack((xv.flatten(), yv.flatten()), axis=1)\n", "\n", "kirchhoff_results = kirchhoff_plate.linear_static_analysis(plate_points, plate_loads)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Understanding the results\n" ] }, { "cell_type": "raw", "metadata": { "editable": true, "raw_mimetype": "text/restructuredtext", "slideshow": { "slide_type": "" }, "tags": [], "vscode": { "languageId": "raw" } }, "source": [ "The ``linear_static_analysis`` method in both cases returns a dictionary with an identical layout as the loads. So for \n", "instance, if a load case was accessible as ``beam_loads[\"concentrated\", \"LC1\"]``, then the corresponding \n", "results are accessible as in ``bernoulli_solution[\"concentrated\", \"LC1\"]``. \n", "Each of these entries is an instance of :class:`~sigmaepsilon.solid.fourier.result.BeamLoadCaseResultLinStat`." ] }, { "cell_type": "code", "execution_count": 12, "metadata": { "editable": true, "slideshow": { "slide_type": "" }, "tags": [] }, "outputs": [ { "data": { "text/plain": [ "sigmaepsilon.deepdict.deepdict.DeepDict" ] }, "execution_count": 12, "metadata": {}, "output_type": "execute_result" } ], "source": [ "type(bernoulli_solution)" ] }, { "cell_type": "code", "execution_count": 13, "metadata": { "editable": true, "slideshow": { "slide_type": "" }, "tags": [] }, "outputs": [ { "data": { "text/plain": [ "sigmaepsilon.solid.fourier.result.BeamLoadCaseResultLinStat" ] }, "execution_count": 13, "metadata": {}, "output_type": "execute_result" } ], "source": [ "type(bernoulli_solution[\"concentrated\", \"LC1\"])" ] }, { "cell_type": "markdown", "metadata": { "editable": true, "slideshow": { "slide_type": "" }, "tags": [] }, "source": [ "#### The results as a ``numpy.ndarray``" ] }, { "cell_type": "raw", "metadata": { "editable": true, "raw_mimetype": "text/restructuredtext", "slideshow": { "slide_type": "" }, "tags": [] }, "source": [ "The out-of-the-box way of representing data is via NumPy arrays. This means a 2d NumPy array for each load case, where the first axis goes along the points of evaluation and the second along the components (strains, internal forces, etc.). This array is accessible through the :attr:`~sigmaepsilon.solid.fourier.result.LoadCaseResultLinStat.data` and :attr:`~sigmaepsilon.solid.fourier.result.LoadCaseResultLinStat.values` properties." ] }, { "cell_type": "code", "execution_count": 14, "metadata": { "editable": true, "slideshow": { "slide_type": "" }, "tags": [] }, "outputs": [ { "data": { "text/plain": [ "(500, 6)" ] }, "execution_count": 14, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# 6 results components for 500 points\n", "bernoulli_solution[\"concentrated\", \"LC1\"].data.shape" ] }, { "cell_type": "markdown", "metadata": { "editable": true, "slideshow": { "slide_type": "" }, "tags": [] }, "source": [ "It is not very convenient to memorize the indices of the components. If you want a reminder, you can use the `components` property." ] }, { "cell_type": "code", "execution_count": 15, "metadata": { "editable": true, "slideshow": { "slide_type": "" }, "tags": [] }, "outputs": [ { "data": { "text/plain": [ "['UY', 'ROTZ', 'CZ', 'EXY', 'MZ', 'SY']" ] }, "execution_count": 15, "metadata": {}, "output_type": "execute_result" } ], "source": [ "bernoulli_solution[\"concentrated\", \"LC1\"].components" ] }, { "cell_type": "raw", "metadata": { "editable": true, "raw_mimetype": "text/restructuredtext", "slideshow": { "slide_type": "" }, "tags": [] }, "source": [ "For more details, see the documentation of the classes :class:`~sigmaepsilon.solid.fourier.result.BeamLoadCaseResultLinStat` and :class:`~sigmaepsilon.solid.fourier.result.PlateLoadCaseResultLinStat`." ] }, { "cell_type": "markdown", "metadata": { "editable": true, "slideshow": { "slide_type": "" }, "tags": [] }, "source": [ "#### The results as an ``xarray.DataArray``" ] }, { "cell_type": "raw", "metadata": { "editable": true, "raw_mimetype": "text/restructuredtext", "slideshow": { "slide_type": "" }, "tags": [] }, "source": [ "You can turn the results into an instance of :class:`xarray.DataArray` by calling the ``to_xarray`` method of the instance (this requires `xarray` to be installed):" ] }, { "cell_type": "code", "execution_count": 16, "metadata": { "editable": true, "slideshow": { "slide_type": "" }, "tags": [] }, "outputs": [], "source": [ "xarr = bernoulli_solution[\"concentrated\", \"LC1\"].to_xarray()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "If you are familiar with `xarray`, you know that it is basically the same as a `NumPy` array, except that the values are also accessible using labels, besides the usual index-based nature of `NumPy`. The `indexes` attribute tells you about the available options.\n" ] }, { "cell_type": "code", "execution_count": 17, "metadata": { "editable": true, "slideshow": { "slide_type": "" }, "tags": [] }, "outputs": [ { "data": { "text/plain": [ "Indexes:\n", " index Index([ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,\n", " ...\n", " 490, 491, 492, 493, 494, 495, 496, 497, 498, 499],\n", " dtype='int32', name='index', length=500)\n", " component Index(['UY', 'ROTZ', 'CZ', 'EXY', 'MZ', 'SY'], dtype='object', name='component')" ] }, "execution_count": 17, "metadata": {}, "output_type": "execute_result" } ], "source": [ "xarr.indexes" ] }, { "cell_type": "markdown", "metadata": { "editable": true, "slideshow": { "slide_type": "" }, "tags": [] }, "source": [ "You can see that the array is two dimensional and the two axes are called 'index' and 'component'. Here 'index' refers to the integer index of the point of evaluation, while 'component' refers to result component associated with a beam." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Of course, for Euler-Bernoulli beams, the shear strains and shear forces are zero. To access the vertical displacement of the 10th evaluation point, use the `loc` method of the DataArray like this:\n" ] }, { "cell_type": "code", "execution_count": 18, "metadata": { "editable": true, "slideshow": { "slide_type": "" }, "tags": [] }, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "
<xarray.DataArray 'values' ()> Size: 8B\n",
       "array(6.28775469e-06)\n",
       "Coordinates:\n",
       "    index      int32 4B 9\n",
       "    component  <U4 16B 'UY'
" ], "text/plain": [ " Size: 8B\n", "array(6.28775469e-06)\n", "Coordinates:\n", " index int32 4B 9\n", " component \n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "
<xarray.DataArray 'values' ()> Size: 8B\n",
       "array(6.28775469e-06)\n",
       "Coordinates:\n",
       "    index      int32 4B 9\n",
       "    component  <U4 16B 'UY'
" ], "text/plain": [ " Size: 8B\n", "array(6.28775469e-06)\n", "Coordinates:\n", " index int32 4B 9\n", " component \n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "
<xarray.DataArray 'values' (index: 10)> Size: 80B\n",
       "array([0.00000000e+00, 6.98938448e-07, 1.39785457e-06, 2.09672599e-06,\n",
       "       2.79553025e-06, 3.49424481e-06, 4.19284710e-06, 4.89131451e-06,\n",
       "       5.58962453e-06, 6.28775469e-06])\n",
       "Coordinates:\n",
       "  * index      (index) int32 40B 0 1 2 3 4 5 6 7 8 9\n",
       "    component  <U4 16B 'UY'
" ], "text/plain": [ " Size: 80B\n", "array([0.00000000e+00, 6.98938448e-07, 1.39785457e-06, 2.09672599e-06,\n", " 2.79553025e-06, 3.49424481e-06, 4.19284710e-06, 4.89131451e-06,\n", " 5.58962453e-06, 6.28775469e-06])\n", "Coordinates:\n", " * index (index) int32 40B 0 1 2 3 4 5 6 7 8 9\n", " component \n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "
<xarray.DataArray 'values' (index: 10)> Size: 80B\n",
       "array([0.00000000e+00, 6.98938448e-07, 1.39785457e-06, 2.09672599e-06,\n",
       "       2.79553025e-06, 3.49424481e-06, 4.19284710e-06, 4.89131451e-06,\n",
       "       5.58962453e-06, 6.28775469e-06])\n",
       "Coordinates:\n",
       "  * index      (index) int32 40B 0 1 2 3 4 5 6 7 8 9\n",
       "    component  <U4 16B 'UY'
" ], "text/plain": [ " Size: 80B\n", "array([0.00000000e+00, 6.98938448e-07, 1.39785457e-06, 2.09672599e-06,\n", " 2.79553025e-06, 3.49424481e-06, 4.19284710e-06, 4.89131451e-06,\n", " 5.58962453e-06, 6.28775469e-06])\n", "Coordinates:\n", " * index (index) int32 40B 0 1 2 3 4 5 6 7 8 9\n", " component \n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
UYROTZCZEXYMZSY
index
00.000000e+003.487721e-070.000000e+000.00.000000e+000.496817
16.989384e-073.487666e-07-5.558252e-120.0-9.960388e-010.497428
21.397855e-063.487499e-07-1.112927e-110.0-1.994365e+000.499024
32.096726e-063.487220e-07-1.672093e-110.0-2.996390e+000.500996
42.795530e-063.486828e-07-2.233318e-110.0-4.002106e+000.502586
.....................
4952.795530e-06-3.486828e-07-2.233318e-110.0-4.002106e+00-0.502586
4962.096726e-06-3.487220e-07-1.672093e-110.0-2.996390e+00-0.500996
4971.397855e-06-3.487499e-07-1.112927e-110.0-1.994365e+00-0.499024
4986.989384e-07-3.487666e-07-5.558252e-120.0-9.960388e-01-0.497428
4991.320568e-20-3.487721e-078.853895e-260.01.586618e-14-0.496817
\n", "

500 rows × 6 columns

\n", "" ], "text/plain": [ " UY ROTZ CZ EXY MZ SY\n", "index \n", "0 0.000000e+00 3.487721e-07 0.000000e+00 0.0 0.000000e+00 0.496817\n", "1 6.989384e-07 3.487666e-07 -5.558252e-12 0.0 -9.960388e-01 0.497428\n", "2 1.397855e-06 3.487499e-07 -1.112927e-11 0.0 -1.994365e+00 0.499024\n", "3 2.096726e-06 3.487220e-07 -1.672093e-11 0.0 -2.996390e+00 0.500996\n", "4 2.795530e-06 3.486828e-07 -2.233318e-11 0.0 -4.002106e+00 0.502586\n", "... ... ... ... ... ... ...\n", "495 2.795530e-06 -3.486828e-07 -2.233318e-11 0.0 -4.002106e+00 -0.502586\n", "496 2.096726e-06 -3.487220e-07 -1.672093e-11 0.0 -2.996390e+00 -0.500996\n", "497 1.397855e-06 -3.487499e-07 -1.112927e-11 0.0 -1.994365e+00 -0.499024\n", "498 6.989384e-07 -3.487666e-07 -5.558252e-12 0.0 -9.960388e-01 -0.497428\n", "499 1.320568e-20 -3.487721e-07 8.853895e-26 0.0 1.586618e-14 -0.496817\n", "\n", "[500 rows x 6 columns]" ] }, "execution_count": 22, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df = bernoulli_solution[\"concentrated\", \"LC1\"].to_pandas()\n", "df" ] }, { "cell_type": "markdown", "metadata": { "editable": true, "slideshow": { "slide_type": "" }, "tags": [] }, "source": [ "Then you can query the object quite similarly to a ``DataArray``." ] }, { "cell_type": "code", "execution_count": 23, "metadata": { "editable": true, "slideshow": { "slide_type": "" }, "tags": [] }, "outputs": [ { "data": { "text/plain": [ "6.2877546906128156e-06" ] }, "execution_count": 23, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df.loc[9, 'UY']" ] }, { "cell_type": "code", "execution_count": 24, "metadata": { "editable": true, "slideshow": { "slide_type": "" }, "tags": [] }, "outputs": [ { "data": { "text/plain": [ "index\n", "0 0.000000e+00\n", "1 6.989384e-07\n", "2 1.397855e-06\n", "3 2.096726e-06\n", "4 2.795530e-06\n", "5 3.494245e-06\n", "6 4.192847e-06\n", "7 4.891315e-06\n", "8 5.589625e-06\n", "9 6.287755e-06\n", "Name: UY, dtype: float64" ] }, "execution_count": 24, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df.loc[:9, 'UY']" ] } ], "metadata": { "kernelspec": { "display_name": "sigmaepsilon-solid-fourier-9DWMC9cw-py3.10", "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.10.11" } }, "nbformat": 4, "nbformat_minor": 4 }