{ "cells": [ { "cell_type": "markdown", "id": "55ef513f-0595-491d-bc6f-980d9a2ddd04", "metadata": { "editable": true, "slideshow": { "slide_type": "" }, "tags": [] }, "source": [ "# Verbosity levels\n", "When calling OOMMF different numbers of information can be shown. We demonstrate the different options for the example macrospin defined in `micromagneticmodel`" ] }, { "cell_type": "code", "execution_count": 1, "id": "e8bd551b-6434-43f3-b89d-23ccc8e4fc9d", "metadata": {}, "outputs": [], "source": [ "import micromagneticmodel as mm\n", "\n", "import oommfc as oc" ] }, { "cell_type": "code", "execution_count": 2, "id": "dc9e2f66-3e53-426c-ac51-420fb7ac103c", "metadata": {}, "outputs": [], "source": [ "system = mm.examples.macrospin()" ] }, { "cell_type": "code", "execution_count": 3, "id": "c665678f-32f8-475c-a7f6-703b5150dcce", "metadata": {}, "outputs": [], "source": [ "md = oc.MinDriver()\n", "td = oc.TimeDriver()" ] }, { "cell_type": "markdown", "id": "12742489-5c39-403b-b402-53f72c701ca1", "metadata": {}, "source": [ "## One summary line (default)\n", "\n", "The default value `verbose=1` prints one summary line to the screen." ] }, { "cell_type": "code", "execution_count": 4, "id": "1126700f-b003-40dc-a1c9-6fb0cf1b647a", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Running OOMMF (ExeOOMMFRunner)[2023/10/18 12:41]... (0.4 s)\n" ] } ], "source": [ "md.drive(system)" ] }, { "cell_type": "code", "execution_count": 5, "id": "3cd84358-e514-40b8-8b00-1484cf7ce48d", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Running OOMMF (ExeOOMMFRunner)[2023/10/18 12:41]... (0.3 s)\n" ] } ], "source": [ "td.drive(system, t=1e-9, n=10)" ] }, { "cell_type": "markdown", "id": "39a3580d-a9e7-466f-ae04-5ae55fb92c20", "metadata": {}, "source": [ "## Silent run\n", "\n", "By setting `verbose=0` the calls to OOMMF do not produce any output." ] }, { "cell_type": "code", "execution_count": 6, "id": "eb02f3d2-b9cd-4178-a46a-1f37f34d975c", "metadata": {}, "outputs": [], "source": [ "md.drive(system, verbose=0)" ] }, { "cell_type": "code", "execution_count": 7, "id": "a7beaa0d-fd66-4b3c-9caf-5795511f85e0", "metadata": {}, "outputs": [], "source": [ "td.drive(system, t=1e-9, n=10, verbose=0)" ] }, { "cell_type": "markdown", "id": "6db497a5-19ef-4ec0-8db2-e86ecde63146", "metadata": { "editable": true, "slideshow": { "slide_type": "" }, "tags": [] }, "source": [ "## Progress bar (`TimeDriver` only)\n", "\n", "By passing `verbose=2` we can get a status bar showing the progress of a running simulations. This feature is only available for the `TimeDriver` and solely relies on the total number of steps `n` and the number of files already written to disk. Therefore, the information only gives a rough indication of the progress. The progress bar is not persistent accross notebook sessions. Therefore, an additional summary line is printed at the end of the simulation." ] }, { "cell_type": "code", "execution_count": 8, "id": "c3fbab56-fa48-4ead-aad9-b60e654b6c47", "metadata": { "editable": true, "slideshow": { "slide_type": "" }, "tags": [] }, "outputs": [ { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "241d64826c65412ba529fd5c131fe89f", "version_major": 2, "version_minor": 0 }, "text/plain": [ "Running OOMMF (ExeOOMMFRunner): 0%| | 0/50 files written [00:00]" ] }, "metadata": {}, "output_type": "display_data" }, { "name": "stdout", "output_type": "stream", "text": [ "Running OOMMF (ExeOOMMFRunner)[2023/10/18 12:41] took 4.1 s\n" ] } ], "source": [ "td.drive(system, t=100e-9, n=50, verbose=2)" ] }, { "cell_type": "markdown", "id": "4d20d3b8-92ec-415c-9e8b-2bc193dcddbb", "metadata": { "editable": true, "slideshow": { "slide_type": "" }, "tags": [] }, "source": [ "When used with the `MinDriver` the standard one-line summary is shown instead." ] }, { "cell_type": "code", "execution_count": 9, "id": "ec9c844a-eebb-4f7d-bf00-2dea8819b79a", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Running OOMMF (ExeOOMMFRunner)[2023/10/18 12:42]... (0.2 s)\n" ] } ], "source": [ "md.drive(system, verbose=2)" ] }, { "cell_type": "code", "execution_count": 10, "id": "cf930308-8d84-47dd-b4c7-15511decc92a", "metadata": { "editable": true, "slideshow": { "slide_type": "" }, "tags": [] }, "outputs": [], "source": [ "# cleanup\n", "oc.delete(system)" ] } ], "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.10.12" }, "widgets": { "application/vnd.jupyter.widget-state+json": { "state": { "193f335a383847bb979cb4866c5ec746": { "model_module": "@jupyter-widgets/controls", "model_module_version": "1.5.0", "model_name": "HTMLModel", "state": { "layout": "IPY_MODEL_658ca277c5334d01a975f5184098b4e7", "style": "IPY_MODEL_3439dd1a46e2410a98f0ccba1aec6bf7", "value": "Running OOMMF (ExeOOMMFRunner): 100%" } }, "3439dd1a46e2410a98f0ccba1aec6bf7": { "model_module": "@jupyter-widgets/controls", "model_module_version": "1.5.0", "model_name": "DescriptionStyleModel", "state": { "description_width": "" } }, "4c00ea7ba11642199f2db444f55f51c2": { "model_module": "@jupyter-widgets/controls", "model_module_version": "1.5.0", "model_name": "ProgressStyleModel", "state": { "description_width": "" } }, "4d27fb973df84b8dafeddd66250399c9": { "model_module": "@jupyter-widgets/controls", "model_module_version": "1.5.0", "model_name": "HBoxModel", "state": { "children": [ "IPY_MODEL_193f335a383847bb979cb4866c5ec746", "IPY_MODEL_810cb733ce324e848fe9f219a1092505", "IPY_MODEL_ed9af13401e54043be5524a03b3761e3" ], "layout": "IPY_MODEL_62155f95265c45a49933c04ec1f86594" } }, "62155f95265c45a49933c04ec1f86594": { "model_module": "@jupyter-widgets/base", "model_module_version": "1.2.0", "model_name": "LayoutModel", "state": {} }, "658ca277c5334d01a975f5184098b4e7": { "model_module": "@jupyter-widgets/base", "model_module_version": "1.2.0", "model_name": "LayoutModel", "state": {} }, "757b3759386a4f0492ea42259cfd8aae": { "model_module": "@jupyter-widgets/base", "model_module_version": "1.2.0", "model_name": "LayoutModel", "state": {} }, "810cb733ce324e848fe9f219a1092505": { "model_module": "@jupyter-widgets/controls", "model_module_version": "1.5.0", "model_name": "FloatProgressModel", "state": { "bar_style": "success", "layout": "IPY_MODEL_f4167dac128645b496b32fc4c8efd6f4", "max": 50, "style": "IPY_MODEL_4c00ea7ba11642199f2db444f55f51c2", "value": 50 } }, "bbd5d471bca74cd59aae5a9cea1d03bb": { "model_module": "@jupyter-widgets/controls", "model_module_version": "1.5.0", "model_name": "DescriptionStyleModel", "state": { "description_width": "" } }, "ed9af13401e54043be5524a03b3761e3": { "model_module": "@jupyter-widgets/controls", "model_module_version": "1.5.0", "model_name": "HTMLModel", "state": { "layout": "IPY_MODEL_757b3759386a4f0492ea42259cfd8aae", "style": "IPY_MODEL_bbd5d471bca74cd59aae5a9cea1d03bb", "value": " 50/50 files written [00:03]" } }, "f4167dac128645b496b32fc4c8efd6f4": { "model_module": "@jupyter-widgets/base", "model_module_version": "1.2.0", "model_name": "LayoutModel", "state": {} } }, "version_major": 2, "version_minor": 0 } } }, "nbformat": 4, "nbformat_minor": 5 }