To compare a known exact solution u and to its approximated solution:
[err] = weighted_HL_k_3_e(f_vec_r,f_vec_th,f_vec_z,gd,sf,ns,mesh,z_vec_r,z_vec_th,z_vec_z,p_exact,n)
To find the approximated solution to an unknown solution:
[basis_edges,basis_triangles,z_h,p_h] = weighted_HL_k_3(f,gd,sf,ns,mesh,n)
f
- given function
gd,sf,ns
- outputs of pdepoly specifying domain
mesh
- max mesh level
z_vec_r
- exact solution z vector r component
z_vec_th
- exact solution z vector theta component
z_vec_z
- exact solution z vector z component
p_vec_r
- exact solution p vector r component
p_vec_th
- exact solution p vector theta component
p_vec_z
- exact solution p vector z component
err_z
- array of L2 errors for mesh levels corresponding to indices
err_p
- array of L2 errors for mesh levels corresponding to indices
basis_edges
- a matrix representing piece-wise basis functions for each edge in each triangle. basis(i,:,T) represents the pieceiwise basis function for the ith edge in triangle T.
basis_triangles
- a vector representing piece-wise basis functions for edge triangle. basis(1,T) represents the piecewise basis function for the Tth triangle.
z_h
- approximated solution vector for z
p_h
- approximated solution vector for p
% add path for get_data_1() 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
[z_vec_r,z_vec_th,z_vec_z,p_exact,f] = get_data_1(n);
% run the program
[err_z,err_p] = weighted_HL_k_3_e(f,gd,sf,ns,mesh,z_vec_r,z_vec_th,z_vec_z,p_exact,n)
Return to main page