getfem-users
[Top][All Lists]

[Getfem-users] Unable to use gf_asm for non-homogeneous Dirichlet condit

 From: Arvind Ajoy Subject: [Getfem-users] Unable to use gf_asm for non-homogeneous Dirichlet conditions Date: Fri, 3 Jul 2009 03:38:57 +0530

Dear users,

1 . I am trying to understand the null-space method for imposing constraints HU=R
on a system KU=F. I find that the convention used in the documentation is
different under the section for [H,R] = gf_asm('dirichlet',bnum,mim,mf_u,mf_d,Hd,Rd)
the matrix N and N' seem to be interchanged.

Could someone please direct me to a reference where I can understand the theory behind
the null-space technique?

===================================================================

2. In order to figure out more, I tried a simple problem to solve \frac{d^2 u}{dx^2} = 1 on [0,1]
with boundary conditions u(0) = u(1) =2. However, the solution I obtain is wrong. The dirichlet conditions
are not imposed correctly. The code is as under

clear all;
gf_workspace('clear');

M = gf_mesh('cartesian',[0:0.025:1]);
MFU = gf_mesh_fem(M,1);
gf_mesh_fem_set(MFU,'fem',gf_fem('FEM_PK(1,1)'));
MIM = gf_mesh_im(M,gf_integ('IM_NC(1,1)'));

nbd = gf_mesh_fem_get(MFU,'nbdof');

A = gf_mesh_fem_get(MFU, 'eval', {-1}) ;
K = gf_asm('laplacian',MIM,MFU,MFU,A) ;
F = gf_asm('volumic source', MIM, MFU, MFU, -A) ;

border = gf_mesh_get(M,'outer faces');
gf_mesh_set(M,'boundary',100,border);
[H,R] = gf_asm('dirichlet',100,MIM,MFU,MFU,ones(1,nbd),2*ones(1,nbd));
[N,U0]=gf_spmat_get(H,'dirichlet_nullspace',R)

KK = N'*K*N;
FF = N'*F;

UU = KK \ FF;
U = (N * UU)' + U0;

x = linspace(0,1,100);
plot(x,0.5*x.^2 - 0.5*x + 2,'b');

hold on;
plot([0:0.025:1],U,'r+');

================================================================

Thanks for any help!

Regards
Arvind

PhD Student, Indian Institute of Technology Madras