From: alexis p. <ale...@gm...> - 2011-10-12 11:49:14
|
Dear geopdes-users, I tried to test some convergenece rates by applying several refinement strategies such k-refinement and h refinement.Although h refinement has relatively a smooth convergence , krefinement presents a lot of oscillations .After creating a krefinement m file as such: function geo = krefinement( geo,degr,knts) nurbs=geo.nurbs; degelev=max(degr-(nurbs.order-1),0); nurbs=nrbdegelev(nurbs,degelev); [rknots,zeta,nknots]=kntrefine(nurbs.knots,knts,nurbs.order-1,nurbs.order-2); nurbs=nrbkntins(nurbs,nknots); geo=geo_load(nurbs); end I then apply homo_kerror.m to the 'geo_ring.txt' domain function errors = homo_kerror(geometry,i ) errors=[]; for j=1:1:i [dofs(1) errors(1)] = homo_poisson( geometry ); refined_geo(j)=krefinement(geometry,[j j],[1 1]); [dofs(j+1) errors(j+1)]=homo_poisson(refined_geo(j)); [dofs3(1) errors3(1)] = homo_poisson( geometry ); refined_geo2(j)=hrefinement(geometry,[j j]); [dofs2(j+1) errors2(j+1)]=homo_poisson(refined_geo2(j)); end loglog(dofs,errors,'-ko',dofs2,errors2,'-go') legend('krefinement','hrefinement') xlabel('dofs'); ylabel('error'); grid on end where homo_poisson.m is the problem presented in the geopdes report (article 4.1) function [dofs ,err] = homo_poisson( geometry ) nurbs=geometry.nurbs; geometry=geo_load(nurbs); knots = geometry.nurbs.knots; [qn, qw] = msh_set_quad_nodes (knots, msh_gauss_nodes (geometry.nurbs.order)); msh = msh_2d (knots, qn, qw, geometry); space = sp_nurbs_2d (geometry.nurbs, msh); dofs=space.ndof; mat = op_gradu_gradv_tp (space, space, msh, @(x, y) ones (size (x))); rhs = op_f_v_tp (space, msh, @(x, y) (8-9*sqrt(x.^2+y.^2)).*sin(2*atan(y./x))./(x.^2+y.^2)); drchlt_dofs = []; for iside = 1:4 drchlt_dofs = union (drchlt_dofs, space.boundary(iside).dofs); end int_dofs = setdiff (1:space.ndof, drchlt_dofs); u = zeros (space.ndof, 1); u(int_dofs) = mat(int_dofs, int_dofs) \ rhs(int_dofs); sp_to_vtk (u, space, geometry, [20 20], 'laplace_solution.vts', 'u') err = sp_l2_error (space, msh, u, @(x,y)(x.^2+y.^2-3*sqrt(x.^2+y.^2)+2).*sin(2.*atan(y./x))) end I tried several domains and problems and I get similar results. In krefinement the order elevates by 1 and then a new knot is inserted(in both directions) at each step. any suggestions why this occurs? Thank you, Alexis Papagiannopoulos |