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 : 20.212 ms
Boundary Conditions : 15.974 µs
Matrix : 2.225 ms
Solver : 2.244 ms

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

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

Gallery generated by Sphinx-Gallery