From 6387f89b269a9eee62c81952f7660b61e0e1228a Mon Sep 17 00:00:00 2001 From: Nicole Stock Date: Tue, 6 Oct 2020 16:59:47 -0400 Subject: [PATCH] Update names in files and correct date --- basis_functions_weighted_HL_p2.m | 2 +- create_b_HL_p2.m | 2 +- errors_exact_weighted_HL_p2.m | 5 +++-- errors_no_exact_weighted_HL_p2.m | 4 ++-- stiffness_matrix_weighted_HL_p2.m | 2 +- weighted_HL_k_0_p2.m | 21 +++++++++++---------- weighted_HL_k_0_p2_e.m | 28 +++++++++++++++------------- 7 files changed, 34 insertions(+), 30 deletions(-) diff --git a/basis_functions_weighted_HL_p2.m b/basis_functions_weighted_HL_p2.m index ae00d94..bb9e617 100644 --- a/basis_functions_weighted_HL_p2.m +++ b/basis_functions_weighted_HL_p2.m @@ -18,7 +18,7 @@ % function for the ith node in triangle T. % % Author: Nicole Stock -% Date: Spring 2020 +% Date: Fall 2020 [~,triangles] = size(t); basis = zeros(6,6,triangles); diff --git a/create_b_HL_p2.m b/create_b_HL_p2.m index 5a7bed0..1c36780 100644 --- a/create_b_HL_p2.m +++ b/create_b_HL_p2.m @@ -23,7 +23,7 @@ % b - vector such that stiffness_matrix * b = solution. % % Author: Nicole Stock -% Date: Spring 2020 +% Date: Fall 2020 [~,triangles] = size(t); [~,nodes] = size(p); diff --git a/errors_exact_weighted_HL_p2.m b/errors_exact_weighted_HL_p2.m index 78125f5..0dd8ead 100644 --- a/errors_exact_weighted_HL_p2.m +++ b/errors_exact_weighted_HL_p2.m @@ -1,4 +1,4 @@ -function [err,grad_err,max_err] = errors_exact_weighted_p2(p,t,p2,t2,basis,u_h,n,u,grad_u_r,grad_u_z) +function [err,grad_err,max_err] = errors_exact_weighted_HL_p2(p,t,p2,t2,basis,u_h,n,u,grad_u_r,grad_u_z) % ERRORS_EXACT_WEIGHTED_p2 - Calculate the errors of our solution u_h % compared to the exact solution u. @@ -24,7 +24,8 @@ % max_err - max error % % Author: Nicole Stock -% Date: Spring 2020 +% Date: Fall 2020 + addpath('data') [~,triangles] = size(t); diff --git a/errors_no_exact_weighted_HL_p2.m b/errors_no_exact_weighted_HL_p2.m index f145894..25c481d 100644 --- a/errors_no_exact_weighted_HL_p2.m +++ b/errors_no_exact_weighted_HL_p2.m @@ -1,4 +1,4 @@ -function [err,grad_err,max_err] = errors_no_exact_weighted_p2(p,t,p2,t2,basis,u_h_km1,u_h_k,n) +function [err,grad_err,max_err] = errors_no_exact_weighted_HL_p2(p,t,p2,t2,basis,u_h_km1,u_h_k,n) % ERRORS_NO_EXACT_WEIGHTED_p2 - Calculate the errors of our solution u_h_km1 % compared to the approximate solution for the next mesh level (u_h_k). % @@ -23,7 +23,7 @@ % max_err - max error % % Author: Nicole Stock -% Date: Spring 2020 +% Date: Fall 2020 [~,triangles] = size(t); [~,nodes] = size(p); diff --git a/stiffness_matrix_weighted_HL_p2.m b/stiffness_matrix_weighted_HL_p2.m index 7dc1b4c..01c4eb0 100644 --- a/stiffness_matrix_weighted_HL_p2.m +++ b/stiffness_matrix_weighted_HL_p2.m @@ -18,7 +18,7 @@ % stiffness_matrix - stiffness matrix % % Author: Nicole Stock -% Date: Spring 2020 +% Date: Fall 2020 [~,triangles] = size(t); [~,nodes] = size(p); diff --git a/weighted_HL_k_0_p2.m b/weighted_HL_k_0_p2.m index 02615d4..583f8d6 100644 --- a/weighted_HL_k_0_p2.m +++ b/weighted_HL_k_0_p2.m @@ -1,5 +1,5 @@ -function [err,grad_err,max_err] = weighted_HL_k_0(u,grad_u_r,grad_u_z,gd,sf,ns,mesh_level,n) -%WEIGHTED_HL_K_0 Weighted Hodge Laplacian with k = 0. +function [err,grad_err,max_err] = weighted_HL_k_0_p2(u,grad_u_r,grad_u_z,gd,sf,ns,mesh_level,n) +%WEIGHTED_HL_K_0_P2 Weighted Hodge Laplacian with k = 0. % % Syntax: % [err,grad_err,max_err] = @@ -25,13 +25,14 @@ % n = 1; % pdepoly([0,1,1,0], [0,0,1,1]); % (OR) [gd,sf,ns] = get_gd_sf_ns([0,1,1,0],[0,0,1,1]); -% [err,grad_err,max_err] = weighted_HL_k_0(u,grad_u_r,grad_u_z,gd,sf,ns,mesh,n) +% [err,grad_err,max_err] = weighted_HL_k_0_p2(u,grad_u_r,grad_u_z,gd,sf,ns,mesh,n) % Dependencies: -% basis_functions_weighted_p2.m +% basis_functions_weighted_HL_p2.m +% create_b_HL_p2.m % display_errors.m -% errors_no_exact_weighted_p2.m +% errors_no_exact_weighted_HL_p2.m % prolongation_matrix.m -% stiffness_matrix_weighted_p2.m +% stiffness_matrix_weighted_HL_p2.m % % Note: % prolongation_matrix.m not working yet. Thus errors are wrong. @@ -86,7 +87,7 @@ % Solve [basis,Qh] = solve(p,p2,e,t,t2,u,grad_u_r,grad_u_z,n); - [err(i),grad_err(i),max_err(i)] = errors_no_exact_weighted_p2(p,t,p2,t2,basis,Qh_extended,Qh,n); + [err(i),grad_err(i),max_err(i)] = errors_no_exact_weighted_HL_p2(p,t,p2,t2,basis,Qh_extended,Qh,n); end display_errors(err,grad_err,max_err) @@ -98,10 +99,10 @@ % subfunction function [basis,Qh] = solve(p,p2,e,t,t2,u,grad_u_r,grad_u_z,n) - basis = basis_functions_weighted_p2(p,t,p2,t2); - S = stiffness_matrix_weighted_p2(p,t,p2,t2,basis,n); + basis = basis_functions_weighted_HL_p2(p,t,p2,t2); + S = stiffness_matrix_weighted_HL_p2(p,t,p2,t2,basis,n); disp(S); - b = create_b_p2(p,t,p2,t2,basis,u,grad_u_r,grad_u_z,n); + b = create_b_HL_p2(p,t,p2,t2,basis,u,grad_u_r,grad_u_z,n); disp(b); Qh = S\b; disp(Qh); diff --git a/weighted_HL_k_0_p2_e.m b/weighted_HL_k_0_p2_e.m index 26b5321..02bf20a 100644 --- a/weighted_HL_k_0_p2_e.m +++ b/weighted_HL_k_0_p2_e.m @@ -1,5 +1,5 @@ -function [err,grad_err,max_err] = weighted_HL_k_0_e(f,grad_f_r,grad_f_z,gd,sf,ns,mesh_level,n,u,grad_u_r,grad_u_z) -%WEIGHTED_HL_K_0_e Weighted Hodge Laplacian with k = 0. +function [err,grad_err,max_err] = weighted_HL_k_0_p2_e(f,grad_f_r,grad_f_z,gd,sf,ns,mesh_level,n,u,grad_u_r,grad_u_z) +%WEIGHTED_HL_K_0_P2_E Weighted Hodge Laplacian with k = 0. % This program is set up to be given an exact solution. % % Syntax: @@ -28,15 +28,17 @@ % n = 1; % pdepoly([0,1,1,0], [0,0,1,1]); % (OR) [gd,sf,ns] = get_gd_sf_ns([0,1,1,0],[0,0,1,1]); -% [err,grad_err,max_err] = weighted_HL_k_0_e(f,grad_f_r,grad_f_z,gd,sf,ns,mesh,n,u,grad_u_r,grad_u_z) +% [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) % Dependencies: -% basis_functions_weighted_p2.m +% basis_functions_weighted_HL_p2.m +% create_b_HL_p2.m % display_errors.m -% errors_exact_weighted_p2.m -% stiffness_matrix_weighted_p2.m +% errors_exact_weighted_HL_p2.m +% stiffness_matrix_weighted_HL_p2.m % % Author: Nicole Stock % Date: Fall 2020 + addpath('data') model=createpde(1); @@ -61,7 +63,7 @@ [p2,t2] = find_midpoints(p,t); [basis,Qh] = solve(p,p2,e,t,t2,f,grad_f_r,grad_f_z,n); - [err(1),grad_err(1),max_err(1)] = errors_exact_weighted_p2(p,t,p2,t2,basis,Qh,n,u,grad_u_r,grad_u_z); + [err(1),grad_err(1),max_err(1)] = errors_exact_weighted_HL_p2(p,t,p2,t2,basis,Qh,n,u,grad_u_r,grad_u_z); for i = 2:mesh_level % Refine mesh to next level @@ -72,7 +74,7 @@ [p2,t2] = find_midpoints(p,t); [basis,Qh] = solve(p,p2,e,t,t2,f,grad_f_r,grad_f_z,n); - [err(i),grad_err(i),max_err(i)] = errors_exact_weighted_p2(p,t,p2,t2,basis,Qh,n,u,grad_u_r,grad_u_z); + [err(i),grad_err(i),max_err(i)] = errors_exact_weighted_HL_p2(p,t,p2,t2,basis,Qh,n,u,grad_u_r,grad_u_z); end display_errors(err,grad_err,max_err) @@ -85,11 +87,11 @@ % subfunction function [basis,Qh] = solve(p,p2,e,t,t2,f,grad_f_r,grad_f_z,n) - basis = basis_functions_weighted_p2(p,t,p2,t2); - S = stiffness_matrix_weighted_p2(p,t,p2,t2,basis,n); - b = create_b_p2(p,t,p2,t2,basis,f,grad_f_r,grad_f_z,n); + basis = basis_functions_weighted_HL_p2(p,t,p2,t2); + S = stiffness_matrix_weighted_HL_p2(p,t,p2,t2,basis,n); + b = create_b_HL_p2(p,t,p2,t2,basis,f,grad_f_r,grad_f_z,n); Qh = S\b; - figure(); - pdeplot([p,p2],e,t, 'XYData',Qh, 'ZData', Qh, 'Mesh', 'on'); + %figure(); + %pdeplot([p,p2],e,t, 'XYData',Qh, 'ZData', Qh, 'Mesh', 'on'); end