.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "examples/Thermal/Thermal1.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_Thermal_Thermal1.py: Thermal1 ======== Thermal simulation. .. GENERATED FROM PYTHON SOURCE LINES 11-64 .. tab-set:: .. tab-item:: Static Scene .. image-sg:: /examples/Thermal/images/sphx_glr_Thermal1_001.png :alt: Thermal1 :srcset: /examples/Thermal/images/sphx_glr_Thermal1_001.png :class: sphx-glr-single-img .. tab-item:: Interactive Scene .. offlineviewer:: /home/docs/checkouts/readthedocs.org/user_builds/easyfea/checkouts/v1.7.1/docs/examples/Thermal/images/sphx_glr_Thermal1_001.vtksz .. rst-class:: sphx-glr-script-out .. code-block:: none ==================== Mesh ==================== Element type: TRI6 Ne = 72, Nn = 168 ==================== Model ==================== Thermal : thermal conductivity (k) : 1 thermal mass capacity (c) : 1 solver : scipy ============= Boundary Conditions ============= Unspecified. =================== Results =================== Unspecified. =================== TicTac =================== Mesh : 20.212 ms Boundary Conditions : 15.974 µs Matrix : 2.225 ms Solver : 2.244 ms | .. code-block:: Python :lineno-start: 12 from EasyFEA import Display, Models, Mesher, ElemType, Simulations, PyVista from EasyFEA.Geoms import Circle, Domain, Point if __name__ == "__main__": Display.Clear() # ---------------------------------------------- # Configuration # ---------------------------------------------- dim = 2 # Set the simulation dimension (2D or 3D) # geom a = 1 # ---------------------------------------------- # Mesh # ---------------------------------------------- domain = Domain(Point(), Point(a, a), a / 4) circle = Circle(Point(a / 2, a / 2), diam=a / 3, isHollow=True, meshSize=a / 4) if dim == 2: mesh = Mesher().Mesh_2D(domain, [circle], ElemType.TRI6) else: mesh = Mesher().Mesh_Extrude( domain, [circle], [0, 0, -a], [4], ElemType.PRISM18 ) nodesX0 = mesh.Nodes_Conditions(lambda x, y, z: x == 0) nodesXa = mesh.Nodes_Conditions(lambda x, y, z: x == a) nodesCircle = mesh.Nodes_Cylinder(circle, direction=[0, 0, -1]) if dim == 3: print(f"Volume: {mesh.volume:.3}") # ---------------------------------------------- # Simulation # ---------------------------------------------- thermalModel = Models.Thermal(k=1, c=1, thickness=1) simu = Simulations.Thermal(mesh, thermalModel, False) simu.rho = 1 simu.add_dirichlet(nodesX0, [0], ["t"]) simu.add_dirichlet(nodesXa, [40], ["t"]) simu.Solve() # ---------------------------------------------- # Results # ---------------------------------------------- print(simu) PyVista.Plot(simu, "thermal", plotMesh=True, nodeValues=True).show() .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.482 seconds) .. _sphx_glr_download_examples_Thermal_Thermal1.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: Thermal1.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: Thermal1.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: Thermal1.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_