.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples/plot_4_sampledfield.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_4_sampledfield.py: output field of files without header (sampling) =============================================== This example doesn't do much, it just reads and makes a simple plot of OpenFoam field in case of files without header (as for example the output of sampling library) .. GENERATED FROM PYTHON SOURCE LINES 11-15 Read a scalar sampled field and the associated mesh --------------------------------------------------- .. note:: It reads a scalar sampled field and the associated mesh .. GENERATED FROM PYTHON SOURCE LINES 15-23 .. code-block:: Python # import readscalar, readvector function from fluidfoam package from fluidfoam import readscalar, readvector sol = '../output_samples/ascii/wohead' X, Y, Z = readvector(sol, 'faceCentres') pressure = readscalar(sol, 'p') .. rst-class:: sphx-glr-script-out .. code-block:: none Reading file ../output_samples/ascii/wohead/faceCentres Reading file ../output_samples/ascii/wohead/p .. GENERATED FROM PYTHON SOURCE LINES 24-28 Now plot this scalar field -------------------------- In this example it is the pressure coefficient around an airfoil. It can be useful to sort the data in order to plot a line and not stars .. GENERATED FROM PYTHON SOURCE LINES 28-34 .. code-block:: Python import matplotlib.pyplot as plt plt.figure() plt.plot(X, pressure, '*') plt.grid() plt.show() .. image-sg:: /auto_examples/images/sphx_glr_plot_4_sampledfield_001.png :alt: plot 4 sampledfield :srcset: /auto_examples/images/sphx_glr_plot_4_sampledfield_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.053 seconds) .. _sphx_glr_download_auto_examples_plot_4_sampledfield.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_4_sampledfield.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_4_sampledfield.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_4_sampledfield.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_