Note
Go to the end to download the full example code.
Elas3#
Hydraulic dam subjected to water pressure and its own weight.
err area = 0.000e+00
==================== Mesh ====================
Element type: TRI6
Ne = 133, Nn = 302
==================== Model ====================
Isotropic:
E = 1.50e+10, v = 0.25
planeStress = False
thickness = 3.60e+02
solver : scipy
============= Boundary Conditions =============
Unspecified.
=================== Results ===================
W def = 620258634.76
Svm max = 2788891.49
Evm max = 0.02 %
Ux max = 2.06e-02
Ux min = 0.00e+00
Uy max = 4.64e-04
Uy min = -9.77e-03
=================== TicTac ===================
Mesh : 14.662 ms
Boundary Conditions : 32.187 µs
Matrix : 6.193 ms
Solver : 5.694 ms
PostProcessing : 659.227 µs
12 import matplotlib.pyplot as plt
13 import numpy as np
14
15 from EasyFEA import Display, Models, ElemType, Simulations
16 from EasyFEA.Geoms import Points
17
18 if __name__ == "__main__":
19 Display.Clear()
20
21 # ----------------------------------------------
22 # Configuration
23 # ----------------------------------------------
24
25 # geom
26 dim = 2
27 h = 180 # m (thickness)
28 thickness = 2 * h
29
30 # model
31 coef = 1e6
32 E = 15000 * coef # Pa (Young's modulus)
33 v = 0.25 # Poisson's ratio
34
35 # load
36 g = 9.81 # m/s^2 (acceleration due to gravity)
37 ro = 2400 # kg/m^3 (density)
38 w = 1000 # kg/m^3 (density)
39
40 # ----------------------------------------------
41 # Mesh
42 # ----------------------------------------------
43
44 contour = Points([(0, 0), (h, 0), (0, h)], h / 10)
45
46 if dim == 2:
47 mesh = contour.Mesh_2D([], ElemType.TRI6)
48 print(f"err area = {np.abs(mesh.area - h**2 / 2) / mesh.area:.3e}")
49 elif dim == 3:
50 mesh = contour.Mesh_Extrude([], [0, 0, -thickness], [3], ElemType.PRISM15)
51 print(
52 f"error volume = {np.abs(mesh.volume - h**2 / 2 * thickness) / mesh.volume:.3e}"
53 )
54
55 nodes_x0 = mesh.Nodes_Conditions(lambda x, y, z: x == 0)
56 nodes_y0 = mesh.Nodes_Conditions(lambda x, y, z: y == 0)
57
58 # ----------------------------------------------
59 # Simulation
60 # ----------------------------------------------
61
62 material = Models.Elastic.Isotropic(
63 dim, E, v, planeStress=False, thickness=thickness
64 )
65 simu = Simulations.Elastic(mesh, material)
66
67 simu.add_dirichlet(nodes_y0, [0] * dim, simu.Get_unknowns())
68 simu.add_surfLoad(
69 nodes_x0, [lambda x, y, z: w * g * (h - y)], ["x"], description="[w*g*(h-y)]"
70 )
71 simu.add_volumeLoad(mesh.nodes, [-ro * g], ["y"], description="[-ro*g]")
72
73 sol = simu.Solve()
74 simu.Save_Iter()
75
76 # ----------------------------------------------
77 # Results
78 # ----------------------------------------------
79 print(simu)
80
81 Display.Plot_Mesh(simu, h / 10 / np.abs(sol.max()))
82 Display.Plot_BoundaryConditions(simu)
83 Display.Plot_Result(simu, "Svm", nodeValues=True, coef=1 / coef, ncolors=20)
84
85 plt.show()
Total running time of the script: (0 minutes 0.394 seconds)


