view example/Poisson.m @ 94:4f688918f76a

Used new available functions assemble and assemble-systems.
author gedeone-octave <marcovass89@hotmail.it>
date Wed, 07 Aug 2013 18:26:26 +0200
parents d06b423169fa
children 93a4ee13aa75
line wrap: on
line source

pkg load msh
pkg load fem-fenics

fem_init_env ();
problem = 'Poisson';
fem_create_all (problem);

x = y = linspace (0, 1, 32);
msho = msh2m_structured_mesh (x, y, 1, 1:4);
mshd = Mesh (msho);

V  = Poisson_FunctionSpace (mshd);

bc = DirichletBC (V, @(x,y) 0, [2, 4]);

f = Expression ('f', @(x,y) 10*exp(-((x - 0.5)^2 + (y - 0.5)^2) / 0.02));
g = Expression ('g', @(x,y) sin (5.0 * x));

a = Poisson_BilinearForm (V);
L = Poisson_LinearForm (V, f, g);

[A, b] = assemble_system (a, L, bc);

u = A \ b;

func = Function ('u', V, u);

fem_plot (func);