Note
Go to the end to download the full example code.
Thermal1#
Thermal simulation.

==================== Mesh ====================
Element type: TRI6
Ne = 72, Nn = 168
==================== Model ====================
Thermal :
thermal conductivity (k) : 1
thermal mass capacity (c) : 1
solver : pypardiso
============= Boundary Conditions =============
Unspecified.
=================== Results ===================
Unspecified.
=================== TicTac ===================
Mesh : 12.112 ms
Boundary Conditions : 9.298 µs
Matrix : 1.226 ms
Solver : 16.797 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 # load
27 Tmax = 0.5
28 N = 50
29 dt = Tmax / N
30
31 # ----------------------------------------------
32 # Mesh
33 # ----------------------------------------------
34 domain = Domain(Point(), Point(a, a), a / 4)
35 circle = Circle(Point(a / 2, a / 2), diam=a / 3, isHollow=True, meshSize=a / 4)
36
37 if dim == 2:
38 mesh = Mesher().Mesh_2D(domain, [circle], ElemType.TRI6)
39 else:
40 mesh = Mesher().Mesh_Extrude(
41 domain, [circle], [0, 0, -a], [4], ElemType.PRISM18
42 )
43
44 nodesX0 = mesh.Nodes_Conditions(lambda x, y, z: x == 0)
45 nodesXa = mesh.Nodes_Conditions(lambda x, y, z: x == a)
46 nodesCircle = mesh.Nodes_Cylinder(circle, [0, 0, -1])
47
48 if dim == 3:
49 print(f"Volume: {mesh.volume:.3}")
50
51 # ----------------------------------------------
52 # Simulation
53 # ----------------------------------------------
54 thermalModel = Models.Thermal(k=1, c=1, thickness=1)
55 simu = Simulations.ThermalSimu(mesh, thermalModel, False)
56 simu.rho = 1
57
58 simu.add_dirichlet(nodesX0, [0], ["t"])
59 simu.add_dirichlet(nodesXa, [40], ["t"])
60
61 simu.Solve()
62
63 # ----------------------------------------------
64 # Results
65 # ----------------------------------------------
66 print(simu)
67
68 PyVista.Plot(simu, "thermal", plotMesh=True, nodeValues=True).show()
Total running time of the script: (0 minutes 0.326 seconds)