.. 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 ======== Transient thermal simulation. .. GENERATED FROM PYTHON SOURCE LINES 11-98 .. image-sg:: /examples/Thermal/images/sphx_glr_Thermal1_001.gif :alt: Thermal1 :srcset: /examples/Thermal/images/sphx_glr_Thermal1_001.gif :class: sphx-glr-single-img .. image-sg:: /examples/Thermal/images/sphx_glr_Thermal1_002.png :alt: $T$ :srcset: /examples/Thermal/images/sphx_glr_Thermal1_002.png :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, dof = 4536 ==================== Model ==================== Thermal : thermal conductivity (k) : 1 thermal mass capacity (c) : 1 solver : pypardiso ============= Boundary Conditions ============= Unspecified. =================== Results =================== Unspecified. =================== TicTac =================== Mesh : 39.059 ms Boundary Conditions : 10.014 µs Matrix : 4.329 ms Solver : 131.111 ms Movie_func 0/50 Movie_func 1/50 (2.00 %) 6.18 s Movie_func 2/50 (4.00 %) 6.03 s Movie_func 3/50 (6.00 %) 5.90 s Movie_func 4/50 (8.00 %) 5.63 s Movie_func 5/50 (10.00 %) 5.55 s Movie_func 6/50 (12.00 %) 5.41 s Movie_func 7/50 (14.00 %) 5.36 s Movie_func 8/50 (16.00 %) 5.40 s Movie_func 9/50 (18.00 %) 5.21 s Movie_func 10/50 (20.00 %) 4.95 s Movie_func 11/50 (22.00 %) 4.86 s Movie_func 12/50 (24.00 %) 4.72 s Movie_func 13/50 (26.00 %) 4.55 s Movie_func 14/50 (28.00 %) 4.43 s Movie_func 15/50 (30.00 %) 4.31 s Movie_func 16/50 (32.00 %) 4.21 s Movie_func 17/50 (34.00 %) 4.14 s Movie_func 18/50 (36.00 %) 4.02 s Movie_func 19/50 (38.00 %) 3.87 s Movie_func 20/50 (40.00 %) 3.73 s Movie_func 21/50 (42.00 %) 3.61 s Movie_func 22/50 (44.00 %) 3.45 s Movie_func 23/50 (46.00 %) 3.36 s Movie_func 24/50 (48.00 %) 3.27 s Movie_func 25/50 (50.00 %) 3.15 s Movie_func 26/50 (52.00 %) 3.06 s Movie_func 27/50 (54.00 %) 2.90 s Movie_func 28/50 (56.00 %) 2.73 s Movie_func 29/50 (58.00 %) 2.60 s Movie_func 30/50 (60.00 %) 2.47 s Movie_func 31/50 (62.00 %) 2.34 s Movie_func 32/50 (64.00 %) 2.21 s Movie_func 33/50 (66.00 %) 2.15 s Movie_func 34/50 (68.00 %) 2.01 s Movie_func 35/50 (70.00 %) 1.88 s Movie_func 36/50 (72.00 %) 1.74 s Movie_func 37/50 (74.00 %) 1.65 s Movie_func 38/50 (76.00 %) 1.50 s Movie_func 39/50 (78.00 %) 1.38 s Movie_func 40/50 (80.00 %) 1.27 s Movie_func 41/50 (82.00 %) 1.15 s Movie_func 42/50 (84.00 %) 999.69 ms Movie_func 43/50 (86.00 %) 883.26 ms Movie_func 44/50 (88.00 %) 747.04 ms Movie_func 45/50 (90.00 %) 620.13 ms Movie_func 46/50 (92.00 %) 499.14 ms Movie_func 47/50 (94.00 %) 374.66 ms Movie_func 48/50 (96.00 %) 249.39 ms Movie_func 49/50 (98.00 %) 127.30 ms Movie_func 50/50 (100.00 %) 0.00 µs | .. code-block:: Python :lineno-start: 12 from EasyFEA import ( Display, Folder, Models, plt, 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", "Thermal1") 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) Display.Plot_Result(simu, result, plotMesh=True, nodeValues=True, folder=folder) if makeMovie: PyVista.Movie_simu(simu, result, folder, f"{result}.gif", plotMesh=True) plt.show() .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 10.992 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 `_