.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples/pores_example.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_pores_example.py: Pore Creation Demo ================== PySaleSetup can be used to create meshes containing material with pores populating them. This is a short demo to show how. .. GENERATED FROM PYTHON SOURCE LINES 8-24 .. rst-class:: sphx-glr-horizontal * .. image-sg:: /auto_examples/images/sphx_glr_pores_example_001.png :alt: Materials :srcset: /auto_examples/images/sphx_glr_pores_example_001.png :class: sphx-glr-multi-img * .. image-sg:: /auto_examples/images/sphx_glr_pores_example_002.png :alt: pores example :srcset: /auto_examples/images/sphx_glr_pores_example_002.png :class: sphx-glr-multi-img .. rst-class:: sphx-glr-script-out .. code-block:: none /home/runner/work/PySALESetup/PySALESetup/PySALESetup/creation.py:554: UserWarning: Max insertion attempts reached (100). Object can not be placed. warnings.warn(f'Max insertion attempts ' | .. code-block:: Python from PySALESetup import PySALEObject, PySALEDomain, PySALEMesh import matplotlib.pyplot as plt main = PySALEObject.generate_ellipse([5., 5.], 5., 5., 0.) main.set_material(1) domain = PySALEDomain(main) circle = PySALEObject.generate_ellipse([0., 0.], .5, .5, 0.) circle.set_as_void() domain.fill_with_random_grains_to_threshold(circle, 40) mesh = PySALEMesh(100, 100, cell_size=.1) for child in main.children: child.set_as_void() mesh.project_polygons_onto_mesh([main]) mesh.plot_materials() main.plot() plt.show() .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.769 seconds) .. _sphx_glr_download_auto_examples_pores_example.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: pores_example.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: pores_example.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: pores_example.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_