From aa9e00e8152f0cecf4c3959ec683aa5300590d77 Mon Sep 17 00:00:00 2001 From: fschuch Date: Wed, 6 Oct 2021 16:05:30 -0300 Subject: [PATCH] fix broken links for binder --- README.md | 4 +- docs/tutorial/parameters.ipynb | 943 +++++++++------------------------ 2 files changed, 245 insertions(+), 702 deletions(-) diff --git a/README.md b/README.md index 4ef91f2..e0b1eaa 100644 --- a/README.md +++ b/README.md @@ -71,8 +71,8 @@ Now, any change you make at the source code will be available at your local inst ## Try it Online -[![badge](https://img.shields.io/badge/launch-Tutorial-579ACA.svg?logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFkAAABZCAMAAABi1XidAAAB8lBMVEX///9XmsrmZYH1olJXmsr1olJXmsrmZYH1olJXmsr1olJXmsrmZYH1olL1olJXmsr1olJXmsrmZYH1olL1olJXmsrmZYH1olJXmsr1olL1olJXmsrmZYH1olL1olJXmsrmZYH1olL1olL0nFf1olJXmsrmZYH1olJXmsq8dZb1olJXmsrmZYH1olJXmspXmspXmsr1olL1olJXmsrmZYH1olJXmsr1olL1olJXmsrmZYH1olL1olLeaIVXmsrmZYH1olL1olL1olJXmsrmZYH1olLna31Xmsr1olJXmsr1olJXmsrmZYH1olLqoVr1olJXmsr1olJXmsrmZYH1olL1olKkfaPobXvviGabgadXmsqThKuofKHmZ4Dobnr1olJXmsr1olJXmspXmsr1olJXmsrfZ4TuhWn1olL1olJXmsqBi7X1olJXmspZmslbmMhbmsdemsVfl8ZgmsNim8Jpk8F0m7R4m7F5nLB6jbh7jbiDirOEibOGnKaMhq+PnaCVg6qWg6qegKaff6WhnpKofKGtnomxeZy3noG6dZi+n3vCcpPDcpPGn3bLb4/Mb47UbIrVa4rYoGjdaIbeaIXhoWHmZYHobXvpcHjqdHXreHLroVrsfG/uhGnuh2bwj2Hxk17yl1vzmljzm1j0nlX1olL3AJXWAAAAbXRSTlMAEBAQHx8gICAuLjAwMDw9PUBAQEpQUFBXV1hgYGBkcHBwcXl8gICAgoiIkJCQl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l57gm0Z8kanKMAQg0qSyuZfn7zItsbGyO9QlnxY0eCuD1XL2ys/MsrQhltE7Ug0uFOzufJFE2PxBo/YAx8XPPdDwWN0MrDRYIZF0mSMKCNHgaIVFoBbNoLJ7tEQDKxGF0kcLQimojCZopv0OkNOyWCCg9XMVAi7ARJzQdM2QUh0gmBozjc3Skg6dSBRqDGYSUOu66Zg+I2fNZs/M3/f/Grl/XnyF1Gw3VKCez0PN5IUfFLqvgUN4C0qNqYs5YhPL+aVZYDE4IpUk57oSFnJm4FyCqqOE0jhY2SMyLFoo56zyo6becOS5UVDdj7Vih0zp+tcMhwRpBeLyqtIjlJKAIZSbI8SGSF3k0pA3mR5tHuwPFoa7N7reoq2bqCsAk1HqCu5uvI1n6JuRXI+S1Mco54YmYTwcn6Aeic+kssXi8XpXC4V3t7/ADuTNKaQJdScAAAAAElFTkSuQmCC)](https://mybinder.org/v2/gh/fschuch/xcompact3d_toolbox/master?urlpath=lab/tree/docs/tutorial) -[![badge](https://img.shields.io/badge/launch-Sandbox%20examples-579ACA.svg?logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFkAAABZCAMAAABi1XidAAAB8lBMVEX///9XmsrmZYH1olJXmsr1olJXmsrmZYH1olJXmsr1olJXmsrmZYH1olL1olJXmsr1olJXmsrmZYH1olL1olJXmsrmZYH1olJXmsr1olL1olJXmsrmZYH1olL1olJXmsrmZYH1olL1olL0nFf1olJXmsrmZYH1olJXmsq8dZb1olJXmsrmZYH1olJXmspXmspXmsr1olL1olJXmsrmZYH1olJXmsr1olL1olJXmsrmZYH1olL1olLeaIVXmsrmZYH1olL1olL1olJXmsrmZYH1olLna31Xmsr1olJXmsr1olJXmsrmZYH1olLqoVr1olJXmsr1olJXmsrmZYH1olL1olKkfaPobXvviGabgadXmsqThKuofKHmZ4Dobnr1olJXmsr1olJXmspXmsr1olJXmsrfZ4TuhWn1olL1olJXmsqBi7X1olJXmspZmslbmMhbmsdemsVfl8ZgmsNim8Jpk8F0m7R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jlrfr2Ggsyx0eoy9uPzN5SPd86aXggOsEKW2Prz7du3VID3/tzs/sSRs2w7ovVHKtjrX2pd7ZMlTxAYfBAL9jiDwfLkq55Tm7ifhMlTGPyCAs7RFRhn47JnlcB9RM5T97ASuZXIcVNuUDIndpDbdsfrqsOppeXl5Y+XVKdjFCTh+zGaVuj0d9zy05PPK3QzBamxdwtTCrzyg/2Rvf2EstUjordGwa/kx9mSJLr8mLLtCW8HHGJc2R5hS219IiF6PnTusOqcMl57gm0Z8kanKMAQg0qSyuZfn7zItsbGyO9QlnxY0eCuD1XL2ys/MsrQhltE7Ug0uFOzufJFE2PxBo/YAx8XPPdDwWN0MrDRYIZF0mSMKCNHgaIVFoBbNoLJ7tEQDKxGF0kcLQimojCZopv0OkNOyWCCg9XMVAi7ARJzQdM2QUh0gmBozjc3Skg6dSBRqDGYSUOu66Zg+I2fNZs/M3/f/Grl/XnyF1Gw3VKCez0PN5IUfFLqvgUN4C0qNqYs5YhPL+aVZYDE4IpUk57oSFnJm4FyCqqOE0jhY2SMyLFoo56zyo6becOS5UVDdj7Vih0zp+tcMhwRpBeLyqtIjlJKAIZSbI8SGSF3k0pA3mR5tHuwPFoa7N7reoq2bqCsAk1HqCu5uvI1n6JuRXI+S1Mco54YmYTwcn6Aeic+kssXi8XpXC4V3t7/ADuTNKaQJdScAAAAAElFTkSuQmCC)](https://mybinder.org/v2/gh/fschuch/xcompact3d_toolbox/master?urlpath=lab/tree/docs/examples) +[![badge](https://img.shields.io/badge/launch-Tutorial-579ACA.svg?logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFkAAABZCAMAAABi1XidAAAB8lBMVEX///9XmsrmZYH1olJXmsr1olJXmsrmZYH1olJXmsr1olJXmsrmZYH1olL1olJXmsr1olJXmsrmZYH1olL1olJXmsrmZYH1olJXmsr1olL1olJXmsrmZYH1olL1olJXmsrmZYH1olL1olL0nFf1olJXmsrmZYH1olJXmsq8dZb1olJXmsrmZYH1olJXmspXmspXmsr1ol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/badge/launch-Sandbox%20examples-579ACA.svg?logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFkAAABZCAMAAABi1XidAAAB8lBMVEX///9XmsrmZYH1olJXmsr1olJXmsrmZYH1olJXmsr1olJXmsrmZYH1olL1olJXmsr1olJXmsrmZYH1olL1olJXmsrmZYH1olJXmsr1olL1olJXmsrmZYH1olL1olJXmsrmZYH1olL1olL0nFf1olJXmsrmZYH1olJXmsq8dZb1olJXmsrmZYH1olJXmspXmspXmsr1olL1olJXmsrmZYH1olJXmsr1olL1olJXmsrmZYH1olL1olLeaIVXmsrmZYH1olL1olL1olJXmsrmZYH1olLna31Xmsr1olJXmsr1olJXmsrmZYH1olLqoVr1olJXmsr1olJXmsrmZYH1olL1olKkfaPobXvviGabgadXmsqThKuofKHmZ4Dobnr1olJXmsr1olJXmspXmsr1olJXmsrfZ4TuhWn1olL1olJXmsqBi7X1olJXmspZmslbmMhbmsdemsVfl8ZgmsNim8Jpk8F0m7R4m7F5nLB6jbh7jbiDirOEibOGnKaMhq+PnaCVg6qWg6qegKaff6WhnpKofKGtnomxeZy3noG6dZi+n3vCcpPDcpPGn3bLb4/Mb47UbIrVa4rYoGjdaIbeaIXhoWHmZYHobXvpcHjqdHXreHLroVrsfG/uhGnuh2bwj2Hxk17yl1vzmljzm1j0nlX1olL3AJXWAAAAbXRSTlMAEBAQHx8gICAuLjAwMDw9PUBAQEpQUFBXV1hgYGBkcHBwcXl8gICAgoiIkJCQlJicnJ2goKCmqK+wsLC4usDAwMjP0NDQ1NbW3Nzg4ODi5+3v8PDw8/T09PX29vb39/f5+fr7+/z8/Pz9/v7+zczCxgAABC5JREFUeAHN1ul3k0UUBvCb1CTVpmpaitAGSLSpSuKCLWpbTKNJFGlcSMAFF63iUmRccNG6gLbuxkXU66JAUef/9LSpmXnyLr3T5AO/rzl5zj137p136BISy44fKJXuGN/d19PUfYeO67Znqtf2KH33Id1psXoFdW30sPZ1sMvs2D060AHqws4FHeJojLZqnw53cmf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FnJm4FyCqqOE0jhY2SMyLFoo56zyo6becOS5UVDdj7Vih0zp+tcMhwRpBeLyqtIjlJKAIZSbI8SGSF3k0pA3mR5tHuwPFoa7N7reoq2bqCsAk1HqCu5uvI1n6JuRXI+S1Mco54YmYTwcn6Aeic+kssXi8XpXC4V3t7/ADuTNKaQJdScAAAAAElFTkSuQmCC)](https://mybinder.org/v2/gh/fschuch/xcompact3d_toolbox/main?labpath=lab%2Ftree%2Fdocs%2Fexamples) Click on any link above to launch [Binder](https://mybinder.org/) and interact with our notebooks in a live environment! diff --git a/docs/tutorial/parameters.ipynb b/docs/tutorial/parameters.ipynb index 8f28f64..12a839c 100644 --- a/docs/tutorial/parameters.ipynb +++ b/docs/tutorial/parameters.ipynb @@ -2,7 +2,6 @@ "cells": [ { "cell_type": "markdown", - "metadata": {}, "source": [ "# Parameters\n", "\n", @@ -12,201 +11,91 @@ "* Default values, restrictions and conections between related parameters are applied where necessary;\n", "* 'On change' callbacks for validation and observation;\n", "* Two-way linking with [ipywidgets](https://ipywidgets.readthedocs.io/en/latest/)." - ] + ], + "metadata": {} }, { "cell_type": "code", - "execution_count": 1, - "metadata": {}, - "outputs": [], + "execution_count": null, "source": [ - "import numpy as np\n", - "\n", + "import numpy as np\r\n", "import xcompact3d_toolbox as x3d" - ] + ], + "outputs": [], + "metadata": {} }, { "cell_type": "markdown", - "metadata": {}, "source": [ "The first step is to establish numerical precision. Use `np.float64` if Xcompact3d was compiled with the flag `-DDOUBLE_PREC` (check the Makefile), use `np.float32` otherwise:" - ] + ], + "metadata": {} }, { "cell_type": "code", - "execution_count": 2, - "metadata": {}, - "outputs": [], + "execution_count": null, "source": [ "x3d.param[\"mytype\"] = np.float32" - ] + ], + "outputs": [], + "metadata": {} }, { "cell_type": "markdown", - "metadata": {}, "source": [ "## Initialization" - ] + ], + "metadata": {} }, { "cell_type": "markdown", - "metadata": {}, "source": [ "There are a few ways to initialize the class. First, calling it with no arguments initializes all variables with default value:" - ] + ], + "metadata": {} }, { "cell_type": "code", - "execution_count": 3, - "metadata": {}, - "outputs": [], + "execution_count": null, "source": [ "prm = x3d.Parameters()" - ] + ], + "outputs": [], + "metadata": {} }, { "cell_type": "markdown", - "metadata": {}, "source": [ "You can access a list with all the available variables at the [Api reference](https://xcompact3d-toolbox.readthedocs.io/en/latest/Docstrings.html)." - ] + ], + "metadata": {} }, { "cell_type": "markdown", - "metadata": {}, "source": [ "Let's see how it looks like:" - ] + ], + "metadata": {} }, { "cell_type": "code", - "execution_count": 4, - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "! -*- mode: f90 -*-\n", - "\n", - "!===================\n", - "&BasicParam\n", - "!===================\n", - "\n", - " C_filter = 0.49 ! \n", - " beta = 1.0 ! Refinement parameter\n", - " dt = 0.001 ! Time step\n", - " gravx = 0.0 ! Gravity unitary vector in x-direction\n", - " gravy = 0.0 ! Gravity unitary vector in y-direction\n", - " gravz = 0.0 ! Gravity unitary vector in z-direction\n", - " ifilter = 0 ! \n", - " ifirst = 0 ! The number for the first iteration\n", - " iibm = 0 ! Flag for immersed boundary method (0: No, 1: Yes)\n", - " iin = 0 ! Defines perturbation at initial condition\n", - " ilast = 0 ! The number for the last iteration\n", - " ilesmod = 0 ! Enables Large-Eddy methodologies (0: No, 1: Yes)\n", - " ilmn = .false. ! \n", - " inflow_noise = 0.0 ! Turbulence intensity (1=100%) !! Inflow condition\n", - " init_noise = 0.0 ! Turbulence intensity (1=100%) !! Initial condition\n", - " ipost = 0 ! Enables online postprocessing at a frequency iprocessing (0: No, 1: Yes)\n", - " iscalar = 0 ! \n", - " istret = 0 ! y mesh refinement (0:no, 1:center, 2:both sides, 3:bottom)\n", - " iturbine = 0 ! \n", - " itype = 12 ! Flow configuration (1:Lock-exchange, 2:TGV, 3:Channel, and others)\n", - " ivisu = 1 ! Enable store snapshots at a frequency ioutput (0: No, 1: Yes)\n", - " nclx1 = 2 ! Velocity boundary condition where x=0\n", - " nclxn = 2 ! Velocity boundary condition where x=xlx\n", - " ncly1 = 2 ! Velocity boundary condition where y=0\n", - " nclyn = 2 ! Velocity boundary condition where y=yly\n", - " nclz1 = 2 ! Velocity boundary condition where z=0\n", - " nclzn = 2 ! Velocity boundary condition where z=zlz\n", - " numscalar = 0 ! Number of scalar fractions\n", - " nx = 17 ! X-direction nodes\n", - " ny = 17 ! Y-direction nodes\n", - " nz = 17 ! Z-direction nodes\n", - " p_col = 0 ! Column partition for domain decomposition and parallel computation\n", - " p_row = 0 ! Row partition for domain decomposition and parallel computation\n", - " re = 1000.0 ! Reynolds number\n", - " u1 = 2.0 ! \n", - " u2 = 1.0 ! \n", - " xlx = 1.0 ! Size of the box in x-direction\n", - " yly = 1.0 ! Size of the box in y-direction\n", - " zlz = 1.0 ! Size of the box in z-direction\n", - "\n", - "/End\n", - "\n", - "!===================\n", - "&NumOptions\n", - "!===================\n", - "\n", - " cnu = 0.44 ! Ratio between hyperviscosity at km=2/3π and kc=π (dissipation factor range)\n", - " ifirstder = 4 ! \n", - " iimplicit = 0 ! \n", - " isecondder = 4 ! Scheme for first order derivative\n", - " itimescheme = 3 ! Time integration scheme (1: Euler, 2: AB2, 3: AB3, 5: RK3)\n", - " nu0nu = 4.0 ! Ratio between hyperviscosity/viscosity at nu (dissipation factor intensity)\n", - "\n", - "/End\n", - "\n", - "!===================\n", - "&InOutParam\n", - "!===================\n", - "\n", - " icheckpoint = 1000 ! Frequency for writing backup file\n", - " ioutflow = 0 ! \n", - " ioutput = 1000 ! Frequency for visualization file\n", - " iprocessing = 1000 ! Frequency for online postprocessing\n", - " irestart = 0 ! Read initial flow field (0: No, 1: Yes)\n", - " ninflows = 1 ! \n", - " nprobes = 0 ! \n", - " ntimesteps = 1 ! \n", - " nvisu = 1 ! Size for visualization collection\n", - " output2D = 0 ! \n", - "\n", - "/End\n", - "\n", - "!===================\n", - "&Statistics\n", - "!===================\n", - "\n", - "\n", - "/End\n", - "\n", - "!===================\n", - "&CASE\n", - "!===================\n", - "\n", - "\n", - "/End\n", - "\n" - ] - } - ], + "execution_count": null, "source": [ "print(prm)" - ] + ], + "outputs": [], + "metadata": {} }, { "cell_type": "markdown", - "metadata": {}, "source": [ "It is possible to access and/or set values afterwards:" - ] + ], + "metadata": {} }, { "cell_type": "code", - "execution_count": 5, - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "1000.0\n", - "1000000.0\n" - ] - } - ], + "execution_count": null, "source": [ "# Reynolds Number\n", "print(prm.re)\n", @@ -214,20 +103,20 @@ "# attribute new value\n", "prm.re = 1e6\n", "print(prm.re)" - ] + ], + "outputs": [], + "metadata": {} }, { "cell_type": "markdown", - "metadata": {}, "source": [ "Second, we can specify some values, and let the missing ones be initialized with default value:" - ] + ], + "metadata": {} }, { "cell_type": "code", - "execution_count": 6, - "metadata": {}, - "outputs": [], + "execution_count": null, "source": [ "prm = x3d.Parameters(\n", " filename=\"example.i3d\",\n", @@ -257,71 +146,72 @@ " ioutput=200,\n", " iprocessing=50,\n", ")" - ] + ], + "outputs": [], + "metadata": {} }, { "cell_type": "markdown", - "metadata": {}, "source": [ "It is easy to write `example.i3d` to disc, just type:" - ] + ], + "metadata": {} }, { "cell_type": "code", - "execution_count": 7, - "metadata": {}, - "outputs": [], + "execution_count": null, "source": [ "prm.write()" - ] + ], + "outputs": [], + "metadata": {} }, { "cell_type": "markdown", - "metadata": {}, "source": [ "And finally, it is possible to read the parameters from the disc:" - ] + ], + "metadata": {} }, { "cell_type": "code", - "execution_count": 8, - "metadata": {}, - "outputs": [], + "execution_count": null, "source": [ "prm = x3d.Parameters(filename=\"example.i3d\")\n", "prm.load()" - ] + ], + "outputs": [], + "metadata": {} }, { "cell_type": "markdown", - "metadata": {}, "source": [ "The same result is obtained in a more concise way:" - ] + ], + "metadata": {} }, { "cell_type": "code", - "execution_count": 9, - "metadata": {}, - "outputs": [], + "execution_count": null, "source": [ "prm = x3d.Parameters(loadfile=\"example.i3d\")" - ] + ], + "outputs": [], + "metadata": {} }, { "cell_type": "markdown", - "metadata": {}, "source": [ "The class can also read the previous parameters format ([se more information here](https://github.com/fschuch/xcompact3d_toolbox/issues/7)):\n", "\n", "``` python\n", "prm = x3d.Parameters(loadfile=\"incompact3d.prm\")\n", "```" - ] + ], + "metadata": {} }, { "cell_type": "markdown", - "metadata": {}, "source": [ "There are extra objects read and write the raw binary files from XCompact3d on-demand.\n", "\n", @@ -350,82 +240,27 @@ " ```\n", "\n", "* Compute the coordinates, including support for mesh refinement in y:" - ] + ], + "metadata": {} }, { "cell_type": "code", - "execution_count": 10, - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "{'x': array([ 0. , 0.1171875, 0.234375 , 0.3515625, 0.46875 ,\n", - " 0.5859375, 0.703125 , 0.8203125, 0.9375 , 1.0546875,\n", - " 1.171875 , 1.2890625, 1.40625 , 1.5234375, 1.640625 ,\n", - " 1.7578125, 1.875 , 1.9921875, 2.109375 , 2.2265625,\n", - " 2.34375 , 2.4609375, 2.578125 , 2.6953125, 2.8125 ,\n", - " 2.9296875, 3.046875 , 3.1640625, 3.28125 , 3.3984375,\n", - " 3.515625 , 3.6328125, 3.75 , 3.8671875, 3.984375 ,\n", - " 4.1015625, 4.21875 , 4.3359375, 4.453125 , 4.5703125,\n", - " 4.6875 , 4.8046875, 4.921875 , 5.0390625, 5.15625 ,\n", - " 5.2734375, 5.390625 , 5.5078125, 5.625 , 5.7421875,\n", - " 5.859375 , 5.9765625, 6.09375 , 6.2109375, 6.328125 ,\n", - " 6.4453125, 6.5625 , 6.6796875, 6.796875 , 6.9140625,\n", - " 7.03125 , 7.1484375, 7.265625 , 7.3828125, 7.5 ,\n", - " 7.6171875, 7.734375 , 7.8515625, 7.96875 , 8.0859375,\n", - " 8.203125 , 8.3203125, 8.4375 , 8.5546875, 8.671875 ,\n", - " 8.7890625, 8.90625 , 9.0234375, 9.140625 , 9.2578125,\n", - " 9.375 , 9.4921875, 9.609375 , 9.7265625, 9.84375 ,\n", - " 9.9609375, 10.078125 , 10.1953125, 10.3125 , 10.4296875,\n", - " 10.546875 , 10.6640625, 10.78125 , 10.8984375, 11.015625 ,\n", - " 11.1328125, 11.25 , 11.3671875, 11.484375 , 11.6015625,\n", - " 11.71875 , 11.8359375, 11.953125 , 12.0703125, 12.1875 ,\n", - " 12.3046875, 12.421875 , 12.5390625, 12.65625 , 12.7734375,\n", - " 12.890625 , 13.0078125, 13.125 , 13.2421875, 13.359375 ,\n", - " 13.4765625, 13.59375 , 13.7109375, 13.828125 , 13.9453125,\n", - " 14.0625 , 14.1796875, 14.296875 , 14.4140625, 14.53125 ,\n", - " 14.6484375, 14.765625 , 14.8828125, 15. ], dtype=float32),\n", - " 'y': array([ 0. , 0.04504663, 0.09029302, 0.13594234, 0.18220465,\n", - " 0.2293007 , 0.27746594, 0.3269554 , 0.37804887, 0.43105724,\n", - " 0.4863303 , 0.5442656 , 0.60532016, 0.670024 , 0.7389978 ,\n", - " 0.81297535, 0.8928308 , 0.9796148 , 1.0746001 , 1.1793398 ,\n", - " 1.2957417 , 1.4261622 , 1.5735214 , 1.7414377 , 1.9343702 ,\n", - " 2.1577313 , 2.4178853 , 2.72186 , 3.0764673 , 3.4864438 ,\n", - " 3.9514096 , 4.462363 , 5. , 5.537637 , 6.0485907 ,\n", - " 6.5135565 , 6.923533 , 7.27814 , 7.5821147 , 7.842269 ,\n", - " 8.06563 , 8.258562 , 8.426478 , 8.573838 , 8.704258 ,\n", - " 8.820661 , 8.9254 , 9.020385 , 9.107169 , 9.187025 ,\n", - " 9.261003 , 9.329976 , 9.39468 , 9.455734 , 9.51367 ,\n", - " 9.568943 , 9.621951 , 9.673044 , 9.722534 , 9.7706995 ,\n", - " 9.817796 , 9.864058 , 9.909707 , 9.954953 , 10. ],\n", - " dtype=float32),\n", - " 'z': array([0. , 0.09375, 0.1875 , 0.28125, 0.375 , 0.46875, 0.5625 ,\n", - " 0.65625, 0.75 , 0.84375, 0.9375 , 1.03125, 1.125 , 1.21875,\n", - " 1.3125 , 1.40625, 1.5 , 1.59375, 1.6875 , 1.78125, 1.875 ,\n", - " 1.96875, 2.0625 , 2.15625, 2.25 , 2.34375, 2.4375 , 2.53125,\n", - " 2.625 , 2.71875, 2.8125 , 2.90625], dtype=float32)}" - ] - }, - "execution_count": 10, - "metadata": {}, - "output_type": "execute_result" - } - ], + "execution_count": null, "source": [ "prm.get_mesh()" - ] + ], + "outputs": [], + "metadata": {} }, { "cell_type": "markdown", - "metadata": {}, "source": [ "More details about I/O and array manipulations with [xarray](http://xarray.pydata.org/en/stable/index.html) will be included in a new tutorial." - ] + ], + "metadata": {} }, { "cell_type": "markdown", - "metadata": {}, "source": [ "## Traitlets\n", "\n", @@ -440,25 +275,25 @@ "prm.itype = 'sandbox'\n", "\n", "```\n" - ] + ], + "metadata": {} }, { "cell_type": "code", "execution_count": null, - "metadata": {}, + "source": [], "outputs": [], - "source": [] + "metadata": {} }, { "cell_type": "markdown", - "metadata": {}, "source": [ "### Validation" - ] + ], + "metadata": {} }, { "cell_type": "markdown", - "metadata": {}, "source": [ "Some parameters, like mesh points (`nx`, `ny` and `nz`), trigger a validation operation when a new value is attributed to them.\n", "Due to restrictions at the FFT library, they must be equal to:\n", @@ -483,161 +318,113 @@ "prm.nx = 60\n", "prm.nx = 61\n", "```" - ] + ], + "metadata": {} }, { "cell_type": "code", "execution_count": null, - "metadata": {}, + "source": [], "outputs": [], - "source": [] + "metadata": {} }, { "cell_type": "markdown", - "metadata": {}, "source": [ "### Observation" - ] + ], + "metadata": {} }, { "cell_type": "markdown", - "metadata": {}, "source": [ "Other parameters, like mesh resolution (`dx`, `dy` and `dz`), are automaticaly updated when any new atribution occurs to mesh points and/or domain size. Let's create a quick print functions to play with:" - ] + ], + "metadata": {} }, { "cell_type": "code", - "execution_count": 11, - "metadata": {}, - "outputs": [], + "execution_count": null, "source": [ "def show_param():\n", " for var in \"nclx1 nclxn nx xlx dx\".split():\n", " print(f\"{var:>5} = {getattr(prm, var)}\")" - ] + ], + "outputs": [], + "metadata": {} }, { "cell_type": "markdown", - "metadata": {}, "source": [ "We are starting with:" - ] + ], + "metadata": {} }, { "cell_type": "code", - "execution_count": 12, - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "nclx1 = 2\n", - "nclxn = 2\n", - " nx = 129\n", - " xlx = 15.0\n", - " dx = 0.1171875\n" - ] - } - ], + "execution_count": null, "source": [ "show_param()" - ] + ], + "outputs": [], + "metadata": {} }, { "cell_type": "markdown", - "metadata": {}, "source": [ "Let's change just the domain's length:" - ] + ], + "metadata": {} }, { "cell_type": "code", - "execution_count": 13, - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "nclx1 = 2\n", - "nclxn = 2\n", - " nx = 129\n", - " xlx = 50.0\n", - " dx = 0.390625\n" - ] - } - ], + "execution_count": null, "source": [ "prm.xlx = 50.0\n", "\n", "show_param()" - ] + ], + "outputs": [], + "metadata": {} }, { "cell_type": "markdown", - "metadata": {}, "source": [ "The resolution was updated as well. Now the number of mesh points:" - ] + ], + "metadata": {} }, { "cell_type": "code", - "execution_count": 14, - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "nclx1 = 2\n", - "nclxn = 2\n", - " nx = 121\n", - " xlx = 50.0\n", - " dx = 0.4166666666666667\n" - ] - } - ], + "execution_count": null, "source": [ "prm.nx = 121\n", "\n", "show_param()" - ] + ], + "outputs": [], + "metadata": {} }, { "cell_type": "markdown", - "metadata": {}, "source": [ "Again, the resolution was updated. Now we set a new mesh resolution, this time, `xlx` will be updated in order to satisfy the new resolution:" - ] + ], + "metadata": {} }, { "cell_type": "code", - "execution_count": 15, - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "nclx1 = 2\n", - "nclxn = 2\n", - " nx = 121\n", - " xlx = 1.2\n", - " dx = 0.01\n" - ] - } - ], + "execution_count": null, "source": [ "prm.dx = 1e-2\n", "\n", "show_param()" - ] + ], + "outputs": [], + "metadata": {} }, { "cell_type": "markdown", - "metadata": {}, "source": [ "Boundary conditions are observed as well. Xcompact3d allows three different BC for velocity:\n", "\n", @@ -654,586 +441,342 @@ "It leads to 5 possibilities (`00`, `11`, `12`, `21` and `22`), because both boundary must be periodic, or not, so `0` cannot be combined.\n", "\n", "Let's check it out, we are starting with:" - ] + ], + "metadata": {} }, { "cell_type": "code", - "execution_count": 16, - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "nclx1 = 2\n", - "nclxn = 2\n", - " nx = 121\n", - " xlx = 1.2\n", - " dx = 0.01\n" - ] - } - ], + "execution_count": null, "source": [ "show_param()" - ] + ], + "outputs": [], + "metadata": {} }, { "cell_type": "markdown", - "metadata": {}, "source": [ "We will change just one side to periodic (`nclx1 = 0`), for consistence, the other side should be periodic too. Let's see:" - ] + ], + "metadata": {} }, { "cell_type": "code", - "execution_count": 17, - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "nclx1 = 0\n", - "nclxn = 0\n", - " nx = 120\n", - " xlx = 1.2\n", - " dx = 0.01\n" - ] - } - ], + "execution_count": null, "source": [ "prm.nclx1 = 0\n", "\n", "show_param()" - ] + ], + "outputs": [], + "metadata": {} }, { "cell_type": "markdown", - "metadata": {}, "source": [ "Now free-slip in one side (`nclx1 = 1`), and the other should be non-periodic:" - ] + ], + "metadata": {} }, { "cell_type": "code", - "execution_count": 18, - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "nclx1 = 1\n", - "nclxn = 1\n", - " nx = 121\n", - " xlx = 1.2\n", - " dx = 0.01\n" - ] - } - ], + "execution_count": null, "source": [ "prm.nclx1 = 1\n", "\n", "show_param()" - ] + ], + "outputs": [], + "metadata": {} }, { "cell_type": "markdown", - "metadata": {}, "source": [ "Setting the other boundary to periodic:" - ] + ], + "metadata": {} }, { "cell_type": "code", - "execution_count": 19, - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "nclx1 = 0\n", - "nclxn = 0\n", - " nx = 120\n", - " xlx = 1.2\n", - " dx = 0.01\n" - ] - } - ], + "execution_count": null, "source": [ "prm.nclxn = 0\n", "\n", "show_param()" - ] + ], + "outputs": [], + "metadata": {} }, { "cell_type": "markdown", - "metadata": {}, "source": [ "and now back to Dirichlet:" - ] + ], + "metadata": {} }, { "cell_type": "code", - "execution_count": 20, - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "nclx1 = 2\n", - "nclxn = 2\n", - " nx = 121\n", - " xlx = 1.2\n", - " dx = 0.01\n" - ] - } - ], + "execution_count": null, "source": [ "prm.nclxn = 2\n", "\n", "show_param()" - ] + ], + "outputs": [], + "metadata": {} }, { "cell_type": "markdown", - "metadata": {}, "source": [ "This time, free-slip:" - ] + ], + "metadata": {} }, { "cell_type": "code", - "execution_count": 21, - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "nclx1 = 2\n", - "nclxn = 1\n", - " nx = 121\n", - " xlx = 1.2\n", - " dx = 0.01\n" - ] - } - ], + "execution_count": null, "source": [ "prm.nclxn = 1\n", "\n", "show_param()" - ] + ], + "outputs": [], + "metadata": {} }, { "cell_type": "markdown", - "metadata": {}, "source": [ "There was no need to update `nclx1`, because `1` and `2` can be freely combined. Notice that `nx` was modified properly from 121 to 120 and then back, according to the possible values, `dx` and `xlx` stayed untouched." - ] + ], + "metadata": {} }, { "cell_type": "markdown", - "metadata": {}, "source": [ "### Metadata" - ] + ], + "metadata": {} }, { "cell_type": "markdown", - "metadata": {}, "source": [ "Traitlets types constructors have a `tag` method to store metadata in a dictionary. In the case of Xcompact3d-toolbox, two are especially useful:\n", "\n", "* `group` defines to what namespace a given parameter belongs when the class is written to `.i3d` file (`.write()` method) or read from `.i3d` or `.prm` files (`.load()` method), parameters without a group are ignored for both methods;\n", "* `desc` contains a brief description of each parameter that is shown on screen as we saw above, and also printed with the `.write()` method." - ] + ], + "metadata": {} }, { "cell_type": "markdown", - "metadata": {}, "source": [ "### Declaring new parameters" - ] + ], + "metadata": {} }, { "cell_type": "markdown", - "metadata": {}, "source": [ "You probably would like to add more parameters for your own flow configuration, or because some of them were not implemented yet (it is a work in progress).\n", "\n", "To do so, any auxiliar varible can be included after initialization, like:" - ] + ], + "metadata": {} }, { "cell_type": "code", - "execution_count": 22, - "metadata": {}, - "outputs": [], + "execution_count": null, "source": [ "prm.my_variable = 0 # or any other datatype" - ] + ], + "outputs": [], + "metadata": {} }, { "cell_type": "markdown", - "metadata": {}, "source": [ "It was called auxiliar variable because, in this way, it will be available only for the Python aplication.\n", "\n", "In order to include it at the `.i3d` file and make it available for XCompact3d, we can create a subclass that inherits all the functionality from `xcompact3d_toolbox.Parameters`:" - ] + ], + "metadata": {} }, { "cell_type": "code", - "execution_count": 23, - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "20\n", - "! -*- mode: f90 -*-\n", - "\n", - "!===================\n", - "&BasicParam\n", - "!===================\n", - "\n", - " C_filter = 0.49 ! \n", - " a_my_variable = 10 ! An example at the Tutorial <------\n", - " beta = 1.0 ! Refinement parameter\n", - " dt = 0.001 ! Time step\n", - " gravx = 0.0 ! Gravity unitary vector in x-direction\n", - " gravy = 0.0 ! Gravity unitary vector in y-direction\n", - " gravz = 0.0 ! Gravity unitary vector in z-direction\n", - " ifilter = 0 ! \n", - " ifirst = 0 ! The number for the first iteration\n", - " iibm = 0 ! Flag for immersed boundary method (0: No, 1: Yes)\n", - " iin = 0 ! Defines perturbation at initial condition\n", - " ilast = 0 ! The number for the last iteration\n", - " ilesmod = 0 ! Enables Large-Eddy methodologies (0: No, 1: Yes)\n", - " ilmn = .false. ! \n", - " inflow_noise = 0.0 ! Turbulence intensity (1=100%) !! Inflow condition\n", - " init_noise = 0.0 ! Turbulence intensity (1=100%) !! Initial condition\n", - " ipost = 0 ! Enables online postprocessing at a frequency iprocessing (0: No, 1: Yes)\n", - " iscalar = 0 ! \n", - " istret = 0 ! y mesh refinement (0:no, 1:center, 2:both sides, 3:bottom)\n", - " iturbine = 0 ! \n", - " itype = 12 ! Flow configuration (1:Lock-exchange, 2:TGV, 3:Channel, and others)\n", - " ivisu = 1 ! Enable store snapshots at a frequency ioutput (0: No, 1: Yes)\n", - " nclx1 = 2 ! Velocity boundary condition where x=0\n", - " nclxn = 2 ! Velocity boundary condition where x=xlx\n", - " ncly1 = 2 ! Velocity boundary condition where y=0\n", - " nclyn = 2 ! Velocity boundary condition where y=yly\n", - " nclz1 = 2 ! Velocity boundary condition where z=0\n", - " nclzn = 2 ! Velocity boundary condition where z=zlz\n", - " numscalar = 0 ! Number of scalar fractions\n", - " nx = 257 ! X-direction nodes\n", - " ny = 129 ! Y-direction nodes\n", - " nz = 31 ! Z-direction nodes\n", - " p_col = 0 ! Column partition for domain decomposition and parallel computation\n", - " p_row = 0 ! Row partition for domain decomposition and parallel computation\n", - " re = 1000.0 ! Reynolds number\n", - " u1 = 2.0 ! \n", - " u2 = 1.0 ! \n", - " xlx = 1.0 ! Size of the box in x-direction\n", - " yly = 1.0 ! Size of the box in y-direction\n", - " zlz = 1.0 ! Size of the box in z-direction\n", - "\n", - "/End\n", - "\n", - "!===================\n", - "&NumOptions\n", - "!===================\n", - "\n", - " cnu = 0.44 ! Ratio between hyperviscosity at km=2/3π and kc=π (dissipation factor range)\n", - " ifirstder = 4 ! \n", - " iimplicit = 0 ! \n", - " isecondder = 4 ! Scheme for first order derivative\n", - " itimescheme = 3 ! Time integration scheme (1: Euler, 2: AB2, 3: AB3, 5: RK3)\n", - " nu0nu = 4.0 ! Ratio between hyperviscosity/viscosity at nu (dissipation factor intensity)\n", - "\n", - "/End\n", - "\n", - "!===================\n", - "&InOutParam\n", - "!===================\n", - "\n", - " icheckpoint = 1000 ! Frequency for writing backup file\n", - " ioutflow = 0 ! \n", - " ioutput = 1000 ! Frequency for visualization file\n", - " iprocessing = 1000 ! Frequency for online postprocessing\n", - " irestart = 0 ! Read initial flow field (0: No, 1: Yes)\n", - " ninflows = 1 ! \n", - " nprobes = 0 ! \n", - " ntimesteps = 1 ! \n", - " nvisu = 1 ! Size for visualization collection\n", - " output2D = 0 ! \n", - "\n", - "/End\n", - "\n", - "!===================\n", - "&Statistics\n", - "!===================\n", - "\n", - "\n", - "/End\n", - "\n", - "!===================\n", - "&CASE\n", - "!===================\n", - "\n", - "\n", - "/End\n", - "\n" - ] - } - ], + "execution_count": null, "source": [ - "import traitlets\n", - "\n", - "\n", - "# Create a class named my_Parameters, which inherits the properties all properties and methods\n", - "class my_Parameters(x3d.Parameters):\n", - " # .tag with group and description guarantees that the new variable will\n", - " # be compatible with all functionalities (like .write() and .load())\n", - " a_my_variable = traitlets.Int(default_value=0, min=0).tag(\n", - " group=\"BasicParam\", desc=\"An example at the Tutorial <------\"\n", - " )\n", - "\n", - " # And a custom method, for instance\n", - " def my_method(self):\n", - " return self.a_my_variable * 2\n", - "\n", - "\n", - "prm = my_Parameters(nx=257, ny=129, nz=31, a_my_variable=10) # and here we go\n", - "\n", - "# Testing the method\n", - "print(prm.my_method())\n", - "\n", - "# Show all parameters on screen\n", + "import traitlets\r\n", + "\r\n", + "\r\n", + "# Create a class named my_Parameters, which inherits the properties all properties and methods\r\n", + "class my_Parameters(x3d.Parameters):\r\n", + " # .tag with group and description guarantees that the new variable will\r\n", + " # be compatible with all functionalities (like .write() and .load())\r\n", + " a_my_variable = traitlets.Int(default_value=0, min=0).tag(\r\n", + " group=\"BasicParam\", desc=\"An example at the Tutorial <------\"\r\n", + " )\r\n", + "\r\n", + " # And a custom method, for instance\r\n", + " def my_method(self):\r\n", + " return self.a_my_variable * 2\r\n", + "\r\n", + "\r\n", + "prm = my_Parameters(nx=257, ny=129, nz=31, a_my_variable=10) # and here we go\r\n", + "\r\n", + "# Testing the method\r\n", + "print(prm.my_method())\r\n", + "\r\n", + "# Show all parameters on screen\r\n", "print(prm)" - ] + ], + "outputs": [], + "metadata": {} }, { "cell_type": "markdown", - "metadata": {}, "source": [ "Take a look at the source code of [parameters.py](https://github.com/fschuch/xcompact3d_toolbox/blob/master/xcompact3d_toolbox/param.py) if you need more examples for different datatypes." - ] + ], + "metadata": {} }, { "cell_type": "markdown", - "metadata": {}, "source": [ "## Graphical User Interface" - ] + ], + "metadata": {} }, { "cell_type": "markdown", - "metadata": {}, "source": [ - "
\n", - "\n", - "For an interactive experience [launch this tutorial on Binder](https://mybinder.org/v2/gh/fschuch/xcompact3d_toolbox/master?urlpath=lab/tree/docs/tutorial), the widgets are not so responsive when disconnected from a Python application.\n", - "\n", + "
\r\n", + "\r\n", + "For an interactive experience [launch this tutorial on Binder](https://mybinder.org/v2/gh/fschuch/xcompact3d_toolbox/main?labpath=lab%2Ftree%2Fdocs%2Ftutorial), the widgets are not so responsive when disconnected from a Python application.\r\n", + "\r\n", "
" - ] + ], + "metadata": {} }, { "cell_type": "markdown", - "metadata": {}, "source": [ "To conclude this part of the tutorial, let's see another option to handle the parameters. The class `ParametersGui` is a subclass of `Parameters`, and includes all the features described above. In addition, `ParametersGui` offers an user interface with [IPywidgets](https://ipywidgets.readthedocs.io/en/stable/index.html).\n", "\n", "It is still under development, more parameters and features are going to be included soon, as well as more widgets.\n", "\n", "Just like before, we start with:" - ] + ], + "metadata": {} }, { "cell_type": "code", - "execution_count": 24, - "metadata": {}, - "outputs": [], + "execution_count": null, "source": [ "prm = x3d.ParametersGui()" - ] + ], + "outputs": [], + "metadata": {} }, { "cell_type": "markdown", - "metadata": {}, "source": [ "Widgets are returned on demand when any instance of `class ParametersGui` is called, let’s see:" - ] + ], + "metadata": {} }, { "cell_type": "code", - "execution_count": 25, - "metadata": {}, - "outputs": [ - { - "data": { - "application/vnd.jupyter.widget-view+json": { - "model_id": "216db63584b34a95b118a7fb8da29176", - "version_major": 2, - "version_minor": 0 - }, - "text/plain": [ - "VBox(children=(Dropdown(description='nx', description_tooltip='X-direction nodes', index=3, options=(9, 11, 13…" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], + "execution_count": null, "source": [ "prm(\"nx\", \"xlx\", \"dx\", \"nclx1\", \"nclxn\")" - ] + ], + "outputs": [], + "metadata": {} }, { "cell_type": "markdown", - "metadata": {}, "source": [ "You can play around with the widgets above and see the effect of the observations made previously.\n", "\n", "Notice that the [Traitlets](https://traitlets.readthedocs.io/en/stable/index.html) parameters are related to the value at their widgets in a **two-way link**, in this way, a print will show the actual value on the widgets:" - ] + ], + "metadata": {} }, { "cell_type": "code", - "execution_count": 26, - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "nclx1 = 2\n", - "nclxn = 2\n", - " nx = 17\n", - " xlx = 1.0\n", - " dx = 0.0625\n" - ] - } - ], + "execution_count": null, "source": [ "show_param()" - ] + ], + "outputs": [], + "metadata": {} }, { "cell_type": "markdown", - "metadata": {}, "source": [ "Give it a try, modify the values at the widgets and print them again.\n", "\n", "It also works on the other way, set a new value to a parameters will change its widget, try it:" - ] + ], + "metadata": {} }, { "cell_type": "code", - "execution_count": 27, - "metadata": {}, - "outputs": [], + "execution_count": null, "source": [ "#prm.nclx1 = 0" - ] + ], + "outputs": [], + "metadata": {} }, { "cell_type": "markdown", - "metadata": {}, "source": [ "And of course, different widgets for the same parameter are always synchronized, change the widget below and see what happens with the widget above:" - ] + ], + "metadata": {} }, { "cell_type": "code", - "execution_count": 28, - "metadata": {}, - "outputs": [ - { - "data": { - "application/vnd.jupyter.widget-view+json": { - "model_id": "82b7d4c07a014a3f9aae16e4d045395f", - "version_major": 2, - "version_minor": 0 - }, - "text/plain": [ - "VBox(children=(Dropdown(description='nx', description_tooltip='X-direction nodes', index=3, options=(9, 11, 13…" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], + "execution_count": null, "source": [ "prm('nx')" - ] + ], + "outputs": [], + "metadata": {} }, { "cell_type": "markdown", - "metadata": {}, "source": [ "A last example is about the domain decomposition for parallel computation, Xcompact3d uses [2DECOMP&FFT](http://www.2decomp.org/).\n", "The available options for `p_row` and `p_col` are presented as functions of the number of computational cores `ncores`, notice that `p_row * p_col = ncores` should be respected and `p_row * p_col = 0` activates the auto-tunning mode. The widgets are prepared to respect these restrictions:" - ] + ], + "metadata": {} }, { "cell_type": "code", - "execution_count": 29, - "metadata": {}, - "outputs": [ - { - "data": { - "application/vnd.jupyter.widget-view+json": { - "model_id": "1873aff1c3c34f209f6569dc7f4e01a7", - "version_major": 2, - "version_minor": 0 - }, - "text/plain": [ - "VBox(children=(BoundedIntText(value=4, description='ncores', max=1000000000), Dropdown(description='p_row', de…" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], + "execution_count": null, "source": [ "prm('ncores', 'p_row', 'p_col')" - ] + ], + "outputs": [], + "metadata": {} }, { "cell_type": "markdown", - "metadata": {}, "source": [ "To conclude this part of the tutorial, let’s see what happens when `class ParametersGui` is presented on screen, hover the mouse over some variable to see its description:" - ] + ], + "metadata": {} }, { "cell_type": "code", - "execution_count": 30, - "metadata": {}, - "outputs": [ - { - "data": { - "application/vnd.jupyter.widget-view+json": { - "model_id": "60b752c55de44843b4f88120ac8ee348", - "version_major": 2, - "version_minor": 0 - }, - "text/plain": [ - "VBox(children=(HTML(value='

Xcompact3d Parameters

'), HBox(children=(Text(value='input.i3d', descriptio…" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], + "execution_count": null, "source": [ "prm" - ] + ], + "outputs": [], + "metadata": {} } ], "metadata": { @@ -1799,7 +1342,7 @@ "description_tooltip": "Time step", "layout": "IPY_MODEL_ff3fe5a18e4f495eb9024431c194f889", "max": 1000000000, - "min": 1e-09, + "min": 1e-9, "step": null, "style": "IPY_MODEL_a9eb19e1ac2c4cf3ad8c7a2e5f7757e1", "value": 0.001 @@ -4159,4 +3702,4 @@ }, "nbformat": 4, "nbformat_minor": 4 -} +} \ No newline at end of file