Hi everybody,
I search how to put the boundary condition in the Newton method , for Dirichlet , Neumann or Robin condition.
For example, solving the toy equation d2 u(x) /dx2 + u(x) -1 =0, u(0)=1, u(1)=10. It’s just to try the program. Here limits are added to each loop, so it’s an error.
fespace Vh(Th,P1);
Vh u, v, du, dv;
varf right(u, v) = int2d(Th)( -dx(u) * dx(v) +v * u ) -int2d(Th)( v*1.0 )
- on(2,u=10 ) + on(4,u=1);
varf left(du , dv ) = int2d(Th)( -dx(du) *dx(dv) +dv *du )
- on(2,du=0 ) + on(4,du=0) ;
for (int n = 0; n < 6; n++){
real[int] b= right(0, Vh) ;
matrix a=left(Vh, Vh );
du[]= a^-1 * b ;
u[] += du[];
}
Thank you