To compare a known exact solution u and to its approximated solution:
[err] = weighted_HL_k_0_p1_e(f,grad_f_r,grad_f_z,gd,sf,ns,mesh,n,u,grad_u_r,grad_u_z)
To find the approximated solution to an unknown solution:
[basis,u_h] = weighted_HL_k_0_p1(f,grad_f_r,grad_f_z,gd,sf,ns,mesh,n)
To compare a known exact solution u and to its approximated solution:
[err,grad_err,max_err] = weighted_HL_k_0_p2_e(f,grad_f_r,grad_f_z,gd,sf,ns,mesh,n,u,grad_u_r,grad_u_z)
To find the approximated solution to an unknown solution:
[basis,u_h] = weighted_HL_k_0_p2(f,grad_f_r,grad_f_z,gd,sf,ns,mesh,n)
f
- given function
grad_f_r
- gradient(f) with respect to r
grad_f_z
- gradient(f) with respect to z
gd,sf,ns
- outputs of pdepoly specifying domain
mesh
- max mesh level
n
- n-th Fourier mode
u
- exact solution function
grad_u_r
- gradient(u) with respect to r
grad_u_z
- gradient(u) with respect to z
err
- array of L2 errors for mesh levels corresponding to indices
grad_err
- array of L2 gradient errors for mesh levels corresponding to indices
max_err
- array of max errors for mesh levels corresponding to indicies
basis
- a matrix representing piece-wise basis functions for each node in each triangle. basis(i,:,k) represents the pieceiwise basis function for the ith node in triangle k.
u_h
- approximated solution vector for u
% add path for get_data_7() function
addpath ../data/
% define the highest mesh level
mesh = 5;
% define the nth-Fourier mode
n = 1;
% define the problem domain
pdepoly([0,1,1,0], [0,0,1,1]);
% define the equations
[f,grad_f_r,grad_f_z,u,grad_u_r,grad_u_z] = get_data7();
% run the program
% the lowest order
[err] = weighted_HL_k_0_p1_e(f,grad_f_r,grad_f_z,gd,sf,ns,mesh,n,u,grad_u_r,grad_u_z);
% or the first order
[err,grad_err,max_err] = weighted_HL_k_0_p2_e(f,grad_f_r,grad_f_z,gd,sf,ns,mesh,n,u,grad_u_r,grad_u_z);
Return to main page