.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "examples/Thermal/Thermal2.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_Thermal2.py: Thermal2 ======== Transient thermal simulation. .. GENERATED FROM PYTHON SOURCE LINES 11-87 .. tab-set:: .. tab-item:: Static Scene .. image-sg:: /examples/Thermal/images/sphx_glr_Thermal2_001.png :alt: Thermal2 :srcset: /examples/Thermal/images/sphx_glr_Thermal2_001.png :class: sphx-glr-single-img .. tab-item:: Interactive Scene .. offlineviewer:: /home/docs/checkouts/readthedocs.org/user_builds/easyfea/checkouts/v1.6.0/docs/examples/Thermal/images/sphx_glr_Thermal2_001.vtksz .. image-sg:: /examples/Thermal/images/sphx_glr_Thermal2_002.gif :alt: Thermal2 :srcset: /examples/Thermal/images/sphx_glr_Thermal2_002.gif :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none Volume: 0.913 0.000 s 0.010 s 0.020 s 0.030 s 0.040 s 0.050 s 0.060 s 0.070 s 0.080 s 0.090 s 0.100 s 0.110 s 0.120 s 0.130 s 0.140 s 0.150 s 0.160 s 0.170 s 0.180 s 0.190 s 0.200 s 0.210 s 0.220 s 0.230 s 0.240 s 0.250 s 0.260 s 0.270 s 0.280 s 0.290 s 0.300 s 0.310 s 0.320 s 0.330 s 0.340 s 0.350 s 0.360 s 0.370 s 0.380 s 0.390 s 0.400 s 0.410 s 0.420 s 0.430 s 0.440 s 0.450 s 0.460 s 0.470 s 0.480 s 0.490 s 0.500 s ==================== Mesh ==================== Element type: PRISM18 Ne = 288, Nn = 1512 ==================== Model ==================== Thermal : thermal conductivity (k) : 1 thermal mass capacity (c) : 1 solver : pypardiso ============= Boundary Conditions ============= Unspecified. =================== Results =================== Unspecified. =================== TicTac =================== Mesh : 51.234 ms Boundary Conditions : 18.597 µs Matrix : 18.098 ms Solver : 842.542 ms PyVista_Interface : 41.356 ms Generate movie 0/50 Generate movie 1/50 (2.00 %) 7.52 s Generate movie 2/50 (4.00 %) 7.37 s Generate movie 3/50 (6.00 %) 7.24 s Generate movie 4/50 (8.00 %) 7.05 s Generate movie 5/50 (10.00 %) 6.99 s Generate movie 6/50 (12.00 %) 6.76 s Generate movie 7/50 (14.00 %) 6.59 s Generate movie 8/50 (16.00 %) 6.44 s Generate movie 9/50 (18.00 %) 6.30 s Generate movie 10/50 (20.00 %) 6.13 s Generate movie 11/50 (22.00 %) 6.04 s Generate movie 12/50 (24.00 %) 5.82 s Generate movie 13/50 (26.00 %) 5.58 s Generate movie 14/50 (28.00 %) 5.53 s Generate movie 15/50 (30.00 %) 5.40 s Generate movie 16/50 (32.00 %) 5.25 s Generate movie 17/50 (34.00 %) 5.09 s Generate movie 18/50 (36.00 %) 5.02 s Generate movie 19/50 (38.00 %) 4.91 s Generate movie 20/50 (40.00 %) 4.61 s Generate movie 21/50 (42.00 %) 4.46 s Generate movie 22/50 (44.00 %) 4.31 s Generate movie 23/50 (46.00 %) 4.14 s Generate movie 24/50 (48.00 %) 3.97 s Generate movie 25/50 (50.00 %) 3.84 s Generate movie 26/50 (52.00 %) 3.56 s Generate movie 27/50 (54.00 %) 3.52 s Generate movie 28/50 (56.00 %) 3.37 s Generate movie 29/50 (58.00 %) 3.24 s Generate movie 30/50 (60.00 %) 3.09 s Generate movie 31/50 (62.00 %) 2.93 s Generate movie 32/50 (64.00 %) 2.77 s Generate movie 33/50 (66.00 %) 2.63 s Generate movie 34/50 (68.00 %) 2.50 s Generate movie 35/50 (70.00 %) 2.34 s Generate movie 36/50 (72.00 %) 2.17 s Generate movie 37/50 (74.00 %) 2.02 s Generate movie 38/50 (76.00 %) 1.86 s Generate movie 39/50 (78.00 %) 1.69 s Generate movie 40/50 (80.00 %) 1.55 s Generate movie 41/50 (82.00 %) 1.40 s Generate movie 42/50 (84.00 %) 1.25 s Generate movie 43/50 (86.00 %) 1.09 s Generate movie 44/50 (88.00 %) 935.49 ms Generate movie 45/50 (90.00 %) 777.54 ms Generate movie 46/50 (92.00 %) 622.42 ms Generate movie 47/50 (94.00 %) 465.47 ms Generate movie 48/50 (96.00 %) 313.87 ms Generate movie 49/50 (98.00 %) 155.41 ms Generate movie 50/50 (100.00 %) 0.00 µs | .. code-block:: Python :lineno-start: 12 from EasyFEA import Display, Folder, Models, Mesher, ElemType, Simulations, PyVista from EasyFEA.Geoms import Circle, Domain, Point if __name__ == "__main__": Display.Clear() # ---------------------------------------------- # Configuration # ---------------------------------------------- dim = 3 # Set the simulation dimension (2D or 3D) # outputs folder = Folder.Join(Folder.RESULTS_DIR, "Thermal", "Thermal2") makeMovie = True result = "thermal" # geom a = 1 # load Tmax = 0.5 N = 50 dt = Tmax / N # ---------------------------------------------- # 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, [0, 0, -1]) if dim == 3: print(f"Volume: {mesh.volume:.3}") # ---------------------------------------------- # Simulation # ---------------------------------------------- thermalModel = Models.Thermal(k=1, c=1, thickness=1) simu = Simulations.ThermalSimu(mesh, thermalModel, False) simu.rho = 1 simu.add_dirichlet(nodesX0, [0], ["t"]) simu.add_dirichlet(nodesXa, [40], ["t"]) # Set the parabolic algorithm for the solver simu.Solver_Set_Parabolic_Algorithm(alpha=0.5, dt=dt) t = -dt # init time while t < Tmax: t += dt simu.Solve() simu.Save_Iter() print(f"{t:.3f} s", end="\r") # ---------------------------------------------- # Results # ---------------------------------------------- print(simu) PyVista.Plot(simu, result, plotMesh=True, nodeValues=True).show() if makeMovie: PyVista.Movie_simu(simu, result, folder, f"{result}.gif", plotMesh=True) .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 13.383 seconds) .. _sphx_glr_download_examples_Thermal_Thermal2.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: Thermal2.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: Thermal2.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: Thermal2.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_