Files
3D_EDFM_SIM-X/generic extended/calculate_relative_errors.m
T
2026-03-13 11:24:41 +08:00

36 lines
2.0 KiB
Matlab

function [ relative_errors ] = calculate_relative_errors( results_EDFM_matrix, results_pEDFM_case1, results_pEDFM_case2, r_EDFMs)
%CALCULATE_RELATIVE_ERRORS 此处显示有关此函数的摘要
% 此处显示详细说明
% % % EDFM_result = results_EDFM_matrix(:,1);
% % % pEDFM_result_case1 = results_pEDFM_case1(:,2);
% % % modified_EDFM_result = results_pEDFM_case2(:,3);
% % % new_EDFM_result = results_EDFMs_matrix(:,4);
% % % LGR_result = results_LGR(:,1);
EDFMs_cell_mid_point_coordinates = r_EDFMs.cell_mid_coordinates;
% LGR_cell_mid_point_coordinates = r_LGR.cell_mid_coordinates;
num_of_cells = size(EDFMs_cell_mid_point_coordinates,1);
% the_reference_solution_for_comparison = zeros(num_of_cells,1);
% % % for i = 1:num_of_cells
% % % [a,b]=min((LGR_cell_mid_point_coordinates(:,1)- EDFMs_cell_mid_point_coordinates(i,1)).^2+(LGR_cell_mid_point_coordinates(:,2)- EDFMs_cell_mid_point_coordinates(i,2)).^2);
% % % the_reference_solution_for_comparison(i,1) = LGR_result(b(1),1);
% % % end
% 相对误差计算
fracture_perm = [ 100, 700, 4000, 20000, 100000];
relative_errors = zeros(2,5);
for j = 1:5
relative_errors(1,j) = norm(results_EDFM_matrix(1:num_of_cells,j)-results_pEDFM_case2(1:num_of_cells,j))/norm(results_pEDFM_case2(1:num_of_cells,j));
relative_errors(2,j) = norm(results_pEDFM_case1(1:num_of_cells,j)-results_pEDFM_case2(1:num_of_cells,j))/norm(results_pEDFM_case2(1:num_of_cells,j));
% relative_errors(1,2) = norm(pEDFM_result(1:num_of_cells,1)-the_reference_solution_for_comparison(:,1))/norm(the_reference_solution_for_comparison(:,1));
% relative_errors(1,3) = norm(modified_EDFM_result(1:num_of_cells,1)-the_reference_solution_for_comparison(:,1))/norm(the_reference_solution_for_comparison(:,1));
% relative_errors(1,4) = norm(new_EDFM_result(1:num_of_cells,1)-the_reference_solution_for_comparison(:,1))/norm(the_reference_solution_for_comparison(:,1));
end
% relative_errors(1,5) = norm(LGR_result(:,1)-the_reference_solution_for_comparison(:,1))/norm(the_reference_solution_for_comparison(:,1));
end