Poisson1#

Poisson equation with unit load.

Reference: https://scikit-fem.readthedocs.io/en/latest/listofexamples.html#example-1-poisson-equation-with-unit-load

$u$
14 from EasyFEA import Display, ElemType, Models, Simulations
15 from EasyFEA.fem import Field, BiLinearForm, LinearForm
16 from EasyFEA.Geoms import Domain
17
18 if __name__ == "__main__":
19     Display.Clear()
20
21     # ----------------------------------------------
22     # Mesh
23     # ----------------------------------------------
24
25     contour = Domain((0, 0), (1, 1), 1 / 2**6)
26
27     mesh = contour.Mesh_2D([], ElemType.TRI3, isOrganised=True)
28
29     nodes = mesh.Nodes_Tags(["L0", "L1", "L2", "L3"])
30
31     # ----------------------------------------------
32     # Formulations
33     # ----------------------------------------------
34
35     field = Field(mesh.groupElem, 1)
36
37     @BiLinearForm
38     def bilinear_form(u: Field, v: Field):
39         return u.grad.dot(v.grad)
40
41     @LinearForm
42     def linear_form(v: Field):
43         return 1.0 * v
44
45     weakForms = Models.WeakForms(field, computeK=bilinear_form, computeF=linear_form)
46
47     # ----------------------------------------------
48     # Simulation
49     # ----------------------------------------------
50
51     simu = Simulations.WeakFormSimu(mesh, weakForms)
52
53     simu.add_dirichlet(nodes, [0], ["u"])
54
55     simu.Solve()
56
57     # ----------------------------------------------
58     # Results
59     # ----------------------------------------------
60
61     Display.Plot_Result(simu, "u")
62
63     Display.plt.show()

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

Gallery generated by Sphinx-Gallery