comparison example/Biharmonic.m @ 157:08dc5547f4d6

Update the examples to the new naming conventions.
author gedeone-octave <marcovass89@hotmail.it>
date Thu, 12 Sep 2013 14:58:34 +0200
parents 4f688918f76a
children
comparison
equal deleted inserted replaced
156:9681bf18bb95 157:08dc5547f4d6
1 pkg load msh 1 pkg load fem-fenics msh
2 pkg load fem-fenics
3 2
4 fem_init_env ();
5 problem = 'Biharmonic'; 3 problem = 'Biharmonic';
6 fem_create_all (problem); 4 import_ufl_Problem (problem);
7 5
8 x = y = linspace (0, 1, 32); 6 # Create mesh and define function space
9 msho = msh2m_structured_mesh (x, y, 1, 1:4); 7 x = y = linspace (0, 1, 33);
10 mshd = Mesh (msho); 8 mesh = Mesh(msh2m_structured_mesh (x, y, 1, 1:4));
11 9
12 V = Biharmonic_FunctionSpace (mshd); 10 V = FunctionSpace(problem, mesh);
13 11
14 bc = DirichletBC (V, @(x,y) 0, 1:4); 12 bc = DirichletBC (V, @(x,y) 0, 1:4);
15
16 13
17 f = Expression ('f', @(x,y) 4.0*pi^4.*sin(pi.*x).*sin(pi.*y)); 14 f = Expression ('f', @(x,y) 4.0*pi^4.*sin(pi.*x).*sin(pi.*y));
18
19 g = Expression ('alpha', @(x,y) 8); 15 g = Expression ('alpha', @(x,y) 8);
20 16
21 a = Biharmonic_BilinearForm (V, g); 17 a = BilinearForm (problem, V, g);
22 L = Biharmonic_LinearForm (V, f); 18 L = LinearForm (problem, V, f);
23 19
24 [A, b] = assemble_system (a, L, bc); 20 [A, b] = assemble_system (a, L, bc);
25
26 u = A \ b; 21 u = A \ b;
27 22
28
29 func = Function ('u', V, u); 23 func = Function ('u', V, u);
30 fem_plot (func); 24 plot (func);