Thermal1#

Thermal simulation.

Thermal1
==================== 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 : 10.834 ms
Boundary Conditions : 8.821 µs
Matrix : 1.127 ms
Solver : 1.100 ms

13 from EasyFEA import Display, Models, ElemType, Simulations, PyVista
14 from EasyFEA.Geoms import Circle, Domain, Point
15
16 if __name__ == "__main__":
17     Display.Clear()
18
19     # ----------------------------------------------
20     # Configuration
21     # ----------------------------------------------
22     dim = 2  # Set the simulation dimension (2D or 3D)
23
24     # geom
25     a = 1
26
27     # ----------------------------------------------
28     # Mesh
29     # ----------------------------------------------
30     domain = Domain(Point(), Point(a, a), a / 4)
31     circle = Circle(Point(a / 2, a / 2), diam=a / 3, meshSize=a / 4)
32
33     if dim == 2:
34         mesh = domain.Mesh_2D([circle], ElemType.TRI6)
35     else:
36         mesh = domain.Mesh_Extrude([circle], [0, 0, -a], [4], ElemType.PRISM18)
37
38     nodesX0 = mesh.Nodes_Conditions(lambda x, y, z: x == 0)
39     nodesXa = mesh.Nodes_Conditions(lambda x, y, z: x == a)
40     nodesCircle = mesh.Nodes_Cylinder(circle, direction=[0, 0, -1])
41
42     if dim == 3:
43         print(f"Volume: {mesh.volume:.3}")
44
45     # ----------------------------------------------
46     # Simulation
47     # ----------------------------------------------
48     thermalModel = Models.Thermal(k=1, c=1, thickness=1)
49     simu = Simulations.Thermal(mesh, thermalModel)
50     simu.rho = 1
51
52     simu.add_dirichlet(nodesX0, [0], ["t"])
53     simu.add_dirichlet(nodesXa, [40], ["t"])
54
55     simu.Solve()
56
57     # ----------------------------------------------
58     # Results
59     # ----------------------------------------------
60     print(simu)
61
62     PyVista.Plot(simu, "thermal", plotMesh=True, nodeValues=True).show()

Total running time of the script: (0 minutes 0.183 seconds)

Gallery generated by Sphinx-Gallery