.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "gen/examples/output_parsing/plot_2d_forces.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_gen_examples_output_parsing_plot_2d_forces.py: 2D Forces plots =================== Use the output of a harmonic coil and show the Field quality Download Input files * :download:`dipole_2d.data <../../../../../examples/input_files/dipole_2d.data>` * :download:`dipole_2d.post.xml <../../../../../examples/input_files/dipole_2d.post.xml>` .. GENERATED FROM PYTHON SOURCE LINES 14-18 Setting up ---------- Standard Loading of input, Parsing and Initializing RoxiePlotOutputs object .. GENERATED FROM PYTHON SOURCE LINES 18-24 .. code-block:: Python from roxieapi.output.plots import RoxiePlotOutputs plots = RoxiePlotOutputs( "../input_files/dipole_2d.post.xml", "../input_files/dipole_2d.data" ) .. GENERATED FROM PYTHON SOURCE LINES 25-29 Plotting the Roxie standard Forces plot ----------------------------------- Show all forces as Graph, with y=Force, and x=Conductor number .. GENERATED FROM PYTHON SOURCE LINES 29-35 .. code-block:: Python parser = plots.output forces = parser.get_conductor_forces() if forces is not None: fig = plots.graphs.plot_forces(forces) fig .. GENERATED FROM PYTHON SOURCE LINES 36-39 Plotting as 2D crossection plot ------------------------------- Same information, but for each force plot a separate crosssection plot .. GENERATED FROM PYTHON SOURCE LINES 39-41 .. code-block:: Python plots.plots2d.plot_conductor_forces() .. image-sg:: /gen/examples/output_parsing/images/sphx_glr_plot_2d_forces_001.png :alt: Lorenz forces in conductors, X component, Perpendicular, Radial, Y component, Parallel, Azimuthal :srcset: /gen/examples/output_parsing/images/sphx_glr_plot_2d_forces_001.png, /gen/examples/output_parsing/images/sphx_glr_plot_2d_forces_001_2_00x.png 2.00x :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none
.. GENERATED FROM PYTHON SOURCE LINES 42-45 Show as table ------------- Most output data is stored in Pandas Dataframes, so they can be used for tabular output (to display or files) .. GENERATED FROM PYTHON SOURCE LINES 45-46 .. code-block:: Python forces .. raw:: html
cond fx fy ftr fpa fra faz
0 1 -15999.283 -1145.3686 -1020.3099 -16007.745 -16018.317 -838.13061
1 2 -15839.633 -4551.7958 -4179.2469 -15941.979 -16058.183 -3707.77230
2 3 -15436.232 -7940.0025 -7330.9707 -15734.604 -16065.342 -6574.62320
3 4 -14783.503 -11329.2430 -10504.0300 -15380.802 -16037.026 -9471.93290
4 5 -13883.643 -14732.9170 -13720.8680 -14884.628 -15981.269 -12426.32000
... ... ... ... ... ... ... ...
155 156 -78154.596 -14997.0900 78541.0080 12820.440 10462.645 78889.71200
156 157 -71466.124 14505.0560 -71836.3880 12543.403 13136.504 -71730.29900
157 158 -78154.596 14997.0900 -78541.0080 12820.440 10462.645 -78889.71200
158 159 71466.124 14505.0560 71836.3880 12543.403 13136.504 71730.29900
159 160 78154.596 14997.0900 78541.0080 12820.440 10462.645 78889.71200

160 rows × 7 columns



.. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.687 seconds) .. _sphx_glr_download_gen_examples_output_parsing_plot_2d_forces.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_2d_forces.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_2d_forces.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_2d_forces.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_