290 likes | 616 Views
Norms and spaces. Definition:. The space of all square integrable funcions defined in the domain. is a finite number not infinity. L2 norm of f. Example. compute. Norms and spaces. Definition:. The function and its first derivatives are square integrable. Def:. Example. Def:.
E N D
Norms and spaces Definition: The space of all square integrable funcions defined in the domain is a finite number not infinity L2 norm of f Example compute
Norms and spaces Definition: The function and its first derivatives are square integrable Def: Example Def:
Norms and spaces Def: Energy norm Example Example Compute the energy norm of the function
Norms and spaces Definition: Example Which of the following belongs to
Norms and spaces Triangle inequality (Real numbers) Triangle inequality Cauchy-Schwartz inequality Cauchy-Schwartz inequality
Norms and spaces Definition: the space of all continuous piecewise linear polynomials Definition: Relations: the space of all continuous piecewise linear polynomials which vanishes on the boundary
Mesh size h local mesh size mesh size Example: the length of the longest edge on K 5 4 Example: 1 2 3
A Priori Error Estimates in what sense the error e becomes small
A Priori Error Estimates variational formulation finite element method
Galerkin Orthogonality Theorem 1 (Galerkin Orthogonality). The finite element approximation uh, satisfies the orthogonality Proof: from the variational formulation we have: variational formulation finite element method subtract
Best Approximation Theorem 2 (Best Approximation). The finite element approximation uh, satisfies Proof: This shows that the finite element solution uh is the closest of all functions in Vh to the exact solution u when measuring distance using the energy norm.
Energy Norm Error Theorem 3 (error depends on meshsize). The finite element approximation uh, satisfies the a priori error estimate This shows that how the error depends on the mesh size. with a constant C independent of Proof: Start from the best approximation Remark choosing v= πu the gradient of the error tends to zero as the maximum mesh size h tend to zero.
Error Depends on h Theorem (Poincare Inequality). For any function Remark These constants C’s are different
L2 error is h2 we expect that the L2 error to be h2 and not h Theorem 4 (The L2-error) The finite element approximation uh, satisfies the a priori error estimate with a constant C independent of The proof uses a well-known technique called Nitsche’s trick, Main problem Dual problem or adjoint problem
Continuous Piecewise Linear Interpolation Definition: Let we define its continuous piecewise linear interpolant by Remark: approximates by taking on the same values in the nodes Ni.
L2 error is h2 Theorem 4 (The L2-error) The finite element approximation uh, satisfies the a priori error estimate with a constant C independent of Proof: let ϕ be the solution of the dual problem Cauchy-Schwartz inequality Dividing by ∥e∥ Multiplying by e and integrating using Green’s formula
Error norms Theorem (Energy Norm) The finite element approximation uh, satisfies the a priori error estimate with a constant C independent of Theorem (L2 Norm) The finite element approximation uh, satisfies the a priori error estimate with a constant C independent of
Calcuate the L2 error Exact solution
function [l2error] = compute_error(p, t, uh, u, u_x, u_y) % calculates the error nt = size(t, 2); % number of triangles np = size(p,2); t1 = t(1,:); t2 = t(2,:); t3 = t(3,:); x1 = p(1, t1); x2 = p(1, t2); x3 = p(1, t3); y1 = p(2, t1); y2 = p(2, t2); y3 = p(2, t3); xc = (x1 + x2 + x3)/3; % x-coord of element midpoints yc = (y1 + y2 + y3)/3; % y-coord of element midpoints exact = feval(u, xc, yc); % exact sol at the midpoints uhc = pdeintrp(p, t, uh); % FE sol at the midpoints l2error2 =0; for K = 1:nt loc2glob = t(1:3,K); x = p(1,loc2glob); y = p(2,loc2glob); area = polyarea(x,y); loc_er = (exact(loc2glob) - uhc(loc2glob)).^2; l2error2 = l2error2 + sum(loc_er)*area end l2error = sqrt(l2error2); [exact' , uhc', abs(exact-uhc)'] function [p,e,t,uh] = solveE(hmax) % Poisson's equation on a square [-1,1]X[-1,1] is solved % and the resulting finite element solution is stored in % the vector uh. % g = 'squareg'; % domain b = 'squareb1'; % Dirichlet data f = '-2*((x.^2 - 1) + (y.^2 - 1))'; % right hand side [p, e, t] = initmesh(g,'Hmax',hmax); % triangulation uh = assempde(b, p, e, t, 1, 0, f); % solve pde u = inline('(x.^2 - 1).*(y.^2 - 1)', 'x', 'y'); % exact sol u_x = inline('2*x.*(y.^2 - 1)', 'x', 'y'); % u_x exact u_y = inline('2*y.*(x.^2 - 1)', 'x', 'y'); % u_yexact h1=0.2; [p1,e1,t1,uh1] = solveE(h1); [l2error1] = compute_error(p1, t1, uh1, u, u_x, u_y) h2=0.1; [p2,e2,t2,uh2] = solveE(h2); [l2error2] = compute_error(p2, t2, uh2, u, u_x, u_y) log(l2error1/l2error2)/log(h1/h2)
Calcuate the energy norm of the error Exercise a) Write matlab file to compute the energy norm of the error function [energy_error] = energy_error(p, t, uh, u, u_x, u_y) b) Write matlab file to compute the energy norm of the error for two different meshes with meshsizes h1 and h2 and verify the rate of convergence