.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples/plot_0_field.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code. .. rst-class:: sphx-glr-example-title .. _sphx_glr_auto_examples_plot_0_field.py: First example ============= This example doesn't do much, it just reads and makes a simple plot of OpenFoam field .. GENERATED FROM PYTHON SOURCE LINES 10-14 First read a scalar field ------------------------- .. note:: It just reads a scalar field and store it in alpha variable .. GENERATED FROM PYTHON SOURCE LINES 14-23 .. code-block:: Python # import readscalar function from fluidfoam package from fluidfoam import readscalar sol = '../output_samples/bin/' timename = '0' alpha = readscalar(sol, timename, 'alpha') .. rst-class:: sphx-glr-script-out .. code-block:: none Reading file ../output_samples/bin/0/alpha .. GENERATED FROM PYTHON SOURCE LINES 24-29 Now plot this scalar field -------------------------- In this example, we haven't read the mesh, and can be structured or unstructured .. GENERATED FROM PYTHON SOURCE LINES 29-34 .. code-block:: Python import matplotlib.pyplot as plt plt.figure() plt.plot(alpha) .. image-sg:: /auto_examples/images/sphx_glr_plot_0_field_001.png :alt: plot 0 field :srcset: /auto_examples/images/sphx_glr_plot_0_field_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none [] .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.067 seconds) .. _sphx_glr_download_auto_examples_plot_0_field.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_0_field.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_0_field.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_0_field.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_