.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples/3_point_bending.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_3_point_bending.py: Three point bending experiment with a linear elastic constitutive model ======================================================================= This example demonstrates how to set up a three-point bending beam and access the displacement data of a specific point using a linear elastic constitutive model. .. GENERATED FROM PYTHON SOURCE LINES 9-10 To run this example, the following functions need to be imported: .. GENERATED FROM PYTHON SOURCE LINES 10-16 .. code-block:: Python from fenicsxconcrete.experimental_setup.simple_beam import SimpleBeam from fenicsxconcrete.finite_element_problem.linear_elasticity import LinearElasticity from fenicsxconcrete.sensor_definition.displacement_sensor import DisplacementSensor from fenicsxconcrete.util import ureg .. GENERATED FROM PYTHON SOURCE LINES 17-22 Setting up the Beam ------------------- First, initialize the setup for the simply supported beam with a distributed load. Define the geometry, the mesh, and the load. Not defined parameters are set to default values (from class function default_parameters). Note, all parameters must be pint objects: .. GENERATED FROM PYTHON SOURCE LINES 22-35 .. code-block:: Python parameters = {} parameters["length"] = 10 * ureg("m") parameters["height"] = 0.5 * ureg("m") parameters["width"] = 0.3 * ureg("m") parameters["dim"] = 3 * ureg("") parameters["num_elements_length"] = 10 * ureg("") parameters["num_elements_height"] = 3 * ureg("") parameters["num_elements_width"] = 3 * ureg("") parameters["load"] = 200 * ureg("kN/m^2") beam_setup = SimpleBeam(parameters) .. GENERATED FROM PYTHON SOURCE LINES 36-40 Initializing the Linear Elasticity Problem ------------------------------------------ Second, initialize the linear elastic problem using the setup object and further material parameters: Again not defined parameters are set to default values (from class function default_parameters). .. GENERATED FROM PYTHON SOURCE LINES 40-47 .. code-block:: Python parameters["rho"] = 7750 * ureg("kg/m^3") parameters["E"] = 210e9 * ureg("N/m^2") parameters["nu"] = 0.28 * ureg("") problem = LinearElasticity(beam_setup, parameters) .. GENERATED FROM PYTHON SOURCE LINES 48-51 Setting Up the Sensor --------------------- Third, set up a sensor and add it to the problem to access results of the FEM simulation: .. GENERATED FROM PYTHON SOURCE LINES 51-57 .. code-block:: Python sensor_location = [parameters["length"].magnitude / 2, parameters["width"].magnitude / 2, 0.0] sensor = DisplacementSensor(sensor_location) problem.add_sensor(sensor) .. GENERATED FROM PYTHON SOURCE LINES 58-61 Solving the Problem and Accessing the Results --------------------------------------------- Finally, solve the problem and access the sensor data: .. GENERATED FROM PYTHON SOURCE LINES 61-66 .. code-block:: Python problem.solve() displacement_data = problem.sensors["DisplacementSensor"].data[0] print(f"The displacement at the center of the beam in loading direction is {displacement_data[2]:.2f} {sensor.units}.") .. rst-class:: sphx-glr-script-out .. code-block:: none The displacement at the center of the beam in loading direction is -0.01 meter. .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.953 seconds) .. _sphx_glr_download_auto_examples_3_point_bending.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: 3_point_bending.ipynb <3_point_bending.ipynb>` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: 3_point_bending.py <3_point_bending.py>` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: 3_point_bending.zip <3_point_bending.zip>`