Help save net neutrality! Learn more.
Close

[d03d99]: / inst / example / Biharmonic / Biharmonic.m  Maximize  Restore  History

Download this file

25 lines (16 with data), 532 Bytes

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
pkg load fem-fenics msh
problem = 'Biharmonic';
import_ufl_Problem (problem);
# Create mesh and define function space
x = y = linspace (0, 1, 33);
mesh = Mesh(msh2m_structured_mesh (x, y, 1, 1:4));
V = FunctionSpace(problem, mesh);
bc = DirichletBC (V, @(x,y) 0, 1:4);
f = Expression ('f', @(x,y) 4.0*pi^4.*sin(pi.*x).*sin(pi.*y));
g = Expression ('alpha', @(x,y) 8);
a = BilinearForm (problem, V, g);
L = LinearForm (problem, V, f);
[A, b] = assemble_system (a, L, bc);
u = A \ b;
func = Function ('u', V, u);
plot (func);