.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "examples/02-constraints/pressurized_pipe.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_examples_02-constraints_pressurized_pipe.py: Pressure constraint ~~~~~~~~~~~~~~~~~~~ This example illustrate the use the pressure constraint for the simulation of a pipe under internal pressure and external pressure. The problem is treated in 2D with plane strain assumption. .. GENERATED FROM PYTHON SOURCE LINES 9-26 .. code-block:: Python import fedoo as fd # Pressure in MPa external_pressure = 0.1 internal_pressure = 2 radius = 200 thickness = 20 fd.ModelingSpace("2D") # plane strain assumption mesh = fd.mesh.hollow_disk_mesh(radius, thickness, nr=5, nt=41) material = fd.constitutivelaw.ElasticIsotrop(200e3, 0.3) wf = fd.weakform.StressEquilibrium(material) solid_assembly = fd.Assembly.create(wf, mesh) .. GENERATED FROM PYTHON SOURCE LINES 27-30 To find the nodes belonging to the boundary of the pipe, the :py:meth:`fedoo.Mesh.find_nodes` method is used with the "Distance" criterion from the center of pipe whose coordinates is [0, 0]. .. GENERATED FROM PYTHON SOURCE LINES 30-34 .. code-block:: Python ext_nodes = mesh.find_nodes("Distance", ([0, 0], radius)) int_nodes = mesh.find_nodes("Distance", ([0, 0], radius - thickness)) .. GENERATED FROM PYTHON SOURCE LINES 35-51 The pressure requires to build a weaform over a surface Mesh. To automatically build the required surface mesh from a set of nodes, with use the :py:meth:`fedoo.contraint.Pressure.from_nodes` constructor. Alternatively, we can use the :py:meth:`fedoo.contraint.Pressure.from_elements` constructor from a set of element to extract the external surface. .. note:: The from_nodes and from_elements constructor can't be used to apply a pressure over a shell structure because, as the shell mesh is a surface mesh, these constructors will extract linear mesh of the boundaries. To apply the mesh over a shell geometry, the :py:class:`fedoo.contraint.Pressure` constructor needs to be called. See the example :ref:`sphx_glr_examples_01_simple_spherical_shell_compression.py` .. GENERATED FROM PYTHON SOURCE LINES 51-56 .. code-block:: Python ext_pressure = fd.constraint.Pressure.from_nodes(mesh, ext_nodes, external_pressure) int_pressure = fd.constraint.Pressure.from_nodes(mesh, int_nodes, internal_pressure) .. GENERATED FROM PYTHON SOURCE LINES 57-59 Define a problem from the solid and pressure assemblies The 3 assemblies are sumed. .. GENERATED FROM PYTHON SOURCE LINES 59-64 .. code-block:: Python pb = fd.problem.Linear(solid_assembly + ext_pressure + int_pressure) pb.solve() pb.get_results(solid_assembly, "Stress").plot("Stress", "pressure", "Node") .. image-sg:: /examples/02-constraints/images/sphx_glr_pressurized_pipe_001.png :alt: pressurized pipe :srcset: /examples/02-constraints/images/sphx_glr_pressurized_pipe_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.278 seconds) .. _sphx_glr_download_examples_02-constraints_pressurized_pipe.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: pressurized_pipe.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: pressurized_pipe.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: pressurized_pipe.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_