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 : 11.255 ms
Boundary Conditions : 9.060 µs
Matrix : 1.284 ms
Solver : 1.170 ms

13 from EasyFEA import Display, Models, Mesher, 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, isHollow=True, meshSize=a / 4)
32
33     if dim == 2:
34         mesh = Mesher().Mesh_2D(domain, [circle], ElemType.TRI6)
35     else:
36         mesh = Mesher().Mesh_Extrude(
37             domain, [circle], [0, 0, -a], [4], ElemType.PRISM18
38         )
39
40     nodesX0 = mesh.Nodes_Conditions(lambda x, y, z: x == 0)
41     nodesXa = mesh.Nodes_Conditions(lambda x, y, z: x == a)
42     nodesCircle = mesh.Nodes_Cylinder(circle, direction=[0, 0, -1])
43
44     if dim == 3:
45         print(f"Volume: {mesh.volume:.3}")
46
47     # ----------------------------------------------
48     # Simulation
49     # ----------------------------------------------
50     thermalModel = Models.Thermal(k=1, c=1, thickness=1)
51     simu = Simulations.Thermal(mesh, thermalModel, False)
52     simu.rho = 1
53
54     simu.add_dirichlet(nodesX0, [0], ["t"])
55     simu.add_dirichlet(nodesXa, [40], ["t"])
56
57     simu.Solve()
58
59     # ----------------------------------------------
60     # Results
61     # ----------------------------------------------
62     print(simu)
63
64     PyVista.Plot(simu, "thermal", plotMesh=True, nodeValues=True).show()

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

Gallery generated by Sphinx-Gallery