function plotDis_3D_to_2D_1to3(i, r, OutputRs, type) coordinate=r.coordinates; nodes=r.nodes; cell_divided_by_fracture_flag = r.cell_divided_by_fracture_flag; nmc = size(nodes,1); % nel = size(nodes,2); nel = 4; if type == 1 v = OutputRs{i}.p; else v = 1-OutputRs{i}.sw;%含油饱和度 end number_divided_cells = size(cell_divided_by_fracture_flag,1); dis = zeros(nel, nmc-number_divided_cells); x = zeros(nel, nmc-number_divided_cells); y = zeros(nel, nmc-number_divided_cells); the_numbering = 0; for i = 1 :nmc if ~ismember(i,cell_divided_by_fracture_flag) the_numbering = the_numbering +1; for j = 1 :nel x(j, the_numbering) = coordinate(nodes(i,j), 1); y(j, the_numbering) = coordinate(nodes(i,j), 2); if j == 3 x(j, the_numbering) = coordinate(nodes(i,4), 1); y(j, the_numbering) = coordinate(nodes(i,4), 2); end if j == 4 x(j, the_numbering) = coordinate(nodes(i,3), 1); y(j, the_numbering) = coordinate(nodes(i,3), 2); end dis(j, the_numbering) = v(i); end end end % 被裂缝剖分的网格绘图 nel = 3; % if type == 1 % v = OutputRs{i}.p; % else % v = 1-OutputRs{i}.sw;%含油饱和度 % end fractureCell_matrixCell_addedMatrixCell = r.fractureCell_matrixCell_addedMatrixCell; volume_ratio = r.volume_ratio; number_divided_cells = size(cell_divided_by_fracture_flag,1); % dis_division = zeros(nel, 2*number_divided_cells); % x_division = zeros(nel, 2*number_divided_cells); % y_division = zeros(nel, 2*number_divided_cells); dis_division_type1 = []; x_division_type1 = []; y_division_type1 = []; nel_type1 = 4; dis_division_type2 = []; x_division_type2 = []; y_division_type2 = []; nel_type2 = 3; the_numbering_division = 0; for i = 1:nmc if ismember(i,cell_divided_by_fracture_flag) aaa = find(cell_divided_by_fracture_flag==i); theVolumeRatio = volume_ratio(aaa); theMatrixCell = cell_divided_by_fracture_flag(aaa); bbb = find(fractureCell_matrixCell_addedMatrixCell(:,2) == theMatrixCell); theAddedMatrixCell = fractureCell_matrixCell_addedMatrixCell(bbb,3); if theVolumeRatio == 5/6 % % % % 右侧四边形, 添加的基质网格 % % % the_x_division_type1 = [coordinate(nodes(i,1), 1);coordinate(nodes(i,2), 1);coordinate(nodes(i,4), 1);2/3*coordinate(nodes(i,3), 1)+1/3*coordinate(nodes(i,4), 1)]; % % % x_division_type1 = [x_division_type1, the_x_division_type1]; % % % % % % the_y_division_type1 = [coordinate(nodes(i,1), 2);coordinate(nodes(i,2), 2);coordinate(nodes(i,4), 2);2/3*coordinate(nodes(i,3), 2)+1/3*coordinate(nodes(i,4), 2)]; % % % y_division_type1 = [y_division_type1, the_y_division_type1]; % % % % % % the_dis_division_type1 = v(theAddedMatrixCell)*ones(4,1); % % % dis_division_type1 = [dis_division_type1, the_dis_division_type1]; % 左侧三角形, 原始基质网格 the_x_division_type2 = [2/3*coordinate(nodes(i,3), 1)+1/3*coordinate(nodes(i,4), 1);coordinate(nodes(i,1), 1);coordinate(nodes(i,3), 1);]; x_division_type2 = [x_division_type2, the_x_division_type2]; the_y_division_type2 = [2/3*coordinate(nodes(i,3), 2)+1/3*coordinate(nodes(i,4), 2);coordinate(nodes(i,1), 2);coordinate(nodes(i,3), 2);]; y_division_type2 = [y_division_type2, the_y_division_type2]; the_dis_division_type2 = v(theMatrixCell)*ones(3,1); dis_division_type2 = [dis_division_type2, the_dis_division_type2]; end if theVolumeRatio == 1/2 % % % % 右侧添加的四边形基质网格 % % % the_x_division_type1 = [2/3*coordinate(nodes(i,1), 1)+1/3*coordinate(nodes(i,2), 1);coordinate(nodes(i,2), 1);coordinate(nodes(i,4), 1);1/3*coordinate(nodes(i,3), 1)+2/3*coordinate(nodes(i,4), 1)]; % % % x_division_type1 = [x_division_type1, the_x_division_type1]; % % % % % % the_y_division_type1 = [2/3*coordinate(nodes(i,1), 2)+1/3*coordinate(nodes(i,2), 2);coordinate(nodes(i,2), 2);coordinate(nodes(i,4), 2);1/3*coordinate(nodes(i,3), 2)+2/3*coordinate(nodes(i,4), 2)]; % % % y_division_type1 = [y_division_type1, the_y_division_type1]; % % % % % % the_dis_division_type1 = v(theAddedMatrixCell)*ones(4,1); % % % dis_division_type1 = [dis_division_type1, the_dis_division_type1]; % 左侧原始的四边形基质网格 the_x_division_type1 = [2/3*coordinate(nodes(i,1), 1)+1/3*coordinate(nodes(i,2), 1);1/3*coordinate(nodes(i,3), 1)+2/3*coordinate(nodes(i,4), 1); coordinate(nodes(i,3), 1);coordinate(nodes(i,1), 1);]; x_division_type1 = [x_division_type1, the_x_division_type1]; the_y_division_type1 = [2/3*coordinate(nodes(i,1), 2)+1/3*coordinate(nodes(i,2), 2);1/3*coordinate(nodes(i,3), 2)+2/3*coordinate(nodes(i,4), 2); coordinate(nodes(i,3), 2);coordinate(nodes(i,1), 2);]; y_division_type1 = [y_division_type1, the_y_division_type1]; the_dis_division_type1 = v(theMatrixCell)*ones(4,1); dis_division_type1 = [dis_division_type1, the_dis_division_type1]; end if theVolumeRatio == 1/6 % 四边形, 左侧原始基质网格 the_x_division_type1 = [coordinate(nodes(i,1), 1);1/3*coordinate(nodes(i,1), 1)+2/3*coordinate(nodes(i,2), 1);coordinate(nodes(i,4), 1);coordinate(nodes(i,3), 1);]; x_division_type1 = [x_division_type1, the_x_division_type1]; the_y_division_type1 = [coordinate(nodes(i,1), 2);1/3*coordinate(nodes(i,1), 2)+2/3*coordinate(nodes(i,2), 2);coordinate(nodes(i,4), 2);coordinate(nodes(i,3), 2);]; y_division_type1 = [y_division_type1, the_y_division_type1]; the_dis_division_type1 = v(theMatrixCell)*ones(4,1); dis_division_type1 = [dis_division_type1, the_dis_division_type1]; % % % % 三角形, 右侧添加的基质网格 % % % the_x_division_type2 = [1/3*coordinate(nodes(i,1), 1)+2/3*coordinate(nodes(i,2), 1); coordinate(nodes(i,2), 1);coordinate(nodes(i,4), 1);]; % % % x_division_type2 = [x_division_type2, the_x_division_type2]; % % % % % % the_y_division_type2 = [1/3*coordinate(nodes(i,1), 2)+2/3*coordinate(nodes(i,2), 2); coordinate(nodes(i,2), 2);coordinate(nodes(i,4), 2);]; % % % y_division_type2 = [y_division_type2, the_y_division_type2]; % % % % % % the_dis_division_type2 = v(theAddedMatrixCell)*ones(3,1); % % % dis_division_type2 = [dis_division_type2, the_dis_division_type2]; end end end % fill(x,y,dis,'EdgeAlpha',1); figure('color','w'); fill(x,y,dis,'EdgeColor','interp'); hold on; fill(x_division_type2,y_division_type2,dis_division_type2,'EdgeColor','interp'); hold on; fill(x_division_type1,y_division_type1,dis_division_type1,'EdgeColor','interp'); % dis_division_type1 = []; x_division_type1 = []; y_division_type1 = []; nel_type1 = 4; dis_division_type2 = []; x_division_type2 = []; y_division_type2 = []; nel_type2 = 3; for i = 1:nmc if ismember(i,cell_divided_by_fracture_flag) aaa = find(cell_divided_by_fracture_flag==i); theVolumeRatio = volume_ratio(aaa); theMatrixCell = cell_divided_by_fracture_flag(aaa); bbb = find(fractureCell_matrixCell_addedMatrixCell(:,2) == theMatrixCell); theAddedMatrixCell = fractureCell_matrixCell_addedMatrixCell(bbb,3); if theVolumeRatio == 5/6 % 右侧四边形, 添加的基质网格 the_x_division_type1 = [coordinate(nodes(i,1), 1);coordinate(nodes(i,2), 1);coordinate(nodes(i,4), 1);2/3*coordinate(nodes(i,3), 1)+1/3*coordinate(nodes(i,4), 1)]; x_division_type1 = [x_division_type1, the_x_division_type1]; the_y_division_type1 = [coordinate(nodes(i,1), 2);coordinate(nodes(i,2), 2);coordinate(nodes(i,4), 2);2/3*coordinate(nodes(i,3), 2)+1/3*coordinate(nodes(i,4), 2)]; y_division_type1 = [y_division_type1, the_y_division_type1]; the_dis_division_type1 = v(theAddedMatrixCell)*ones(4,1); dis_division_type1 = [dis_division_type1, the_dis_division_type1]; % % % % 左侧三角形, 原始基质网格 % % % the_x_division_type2 = [2/3*coordinate(nodes(i,3), 1)+1/3*coordinate(nodes(i,4), 1);coordinate(nodes(i,1), 1);coordinate(nodes(i,3), 1);]; % % % x_division_type2 = [x_division_type2, the_x_division_type2]; % % % % % % the_y_division_type2 = [2/3*coordinate(nodes(i,3), 2)+1/3*coordinate(nodes(i,4), 2);coordinate(nodes(i,1), 2);coordinate(nodes(i,3), 2);]; % % % y_division_type2 = [y_division_type2, the_y_division_type2]; % % % % % % the_dis_division_type2 = v(theMatrixCell)*ones(3,1); % % % dis_division_type2 = [dis_division_type2, the_dis_division_type2]; end if theVolumeRatio == 1/2 % 右侧添加的四边形基质网格 the_x_division_type1 = [2/3*coordinate(nodes(i,1), 1)+1/3*coordinate(nodes(i,2), 1);coordinate(nodes(i,2), 1);coordinate(nodes(i,4), 1);1/3*coordinate(nodes(i,3), 1)+2/3*coordinate(nodes(i,4), 1)]; x_division_type1 = [x_division_type1, the_x_division_type1]; the_y_division_type1 = [2/3*coordinate(nodes(i,1), 2)+1/3*coordinate(nodes(i,2), 2);coordinate(nodes(i,2), 2);coordinate(nodes(i,4), 2);1/3*coordinate(nodes(i,3), 2)+2/3*coordinate(nodes(i,4), 2)]; y_division_type1 = [y_division_type1, the_y_division_type1]; the_dis_division_type1 = v(theAddedMatrixCell)*ones(4,1); dis_division_type1 = [dis_division_type1, the_dis_division_type1]; % 左侧原始的四边形基质网格 % % % the_x_division_type1 = [2/3*coordinate(nodes(i,1), 1)+1/3*coordinate(nodes(i,2), 1);1/3*coordinate(nodes(i,3), 1)+2/3*coordinate(nodes(i,4), 1); coordinate(nodes(i,3), 1);coordinate(nodes(i,1), 1);]; % % % x_division_type1 = [x_division_type1, the_x_division_type1]; % % % % % % the_y_division_type1 = [2/3*coordinate(nodes(i,1), 2)+1/3*coordinate(nodes(i,2), 2);1/3*coordinate(nodes(i,3), 2)+2/3*coordinate(nodes(i,4), 2); coordinate(nodes(i,3), 2);coordinate(nodes(i,1), 2);]; % % % y_division_type1 = [y_division_type1, the_y_division_type1]; % % % % % % the_dis_division_type1 = v(theMatrixCell)*ones(4,1); % % % dis_division_type1 = [dis_division_type1, the_dis_division_type1]; end if theVolumeRatio == 1/6 % % % % 四边形, 左侧原始基质网格 % % % the_x_division_type1 = [coordinate(nodes(i,1), 1);1/3*coordinate(nodes(i,1), 1)+2/3*coordinate(nodes(i,2), 1);coordinate(nodes(i,4), 1);coordinate(nodes(i,3), 1);]; % % % x_division_type1 = [x_division_type1, the_x_division_type1]; % % % % % % the_y_division_type1 = [coordinate(nodes(i,1), 2);1/3*coordinate(nodes(i,1), 2)+2/3*coordinate(nodes(i,2), 2);coordinate(nodes(i,4), 2);coordinate(nodes(i,3), 2);]; % % % y_division_type1 = [y_division_type1, the_y_division_type1]; % % % % % % the_dis_division_type1 = v(theMatrixCell)*ones(4,1); % % % dis_division_type1 = [dis_division_type1, the_dis_division_type1]; % 三角形, 右侧添加的基质网格 the_x_division_type2 = [1/3*coordinate(nodes(i,1), 1)+2/3*coordinate(nodes(i,2), 1); coordinate(nodes(i,2), 1);coordinate(nodes(i,4), 1);]; x_division_type2 = [x_division_type2, the_x_division_type2]; the_y_division_type2 = [1/3*coordinate(nodes(i,1), 2)+2/3*coordinate(nodes(i,2), 2); coordinate(nodes(i,2), 2);coordinate(nodes(i,4), 2);]; y_division_type2 = [y_division_type2, the_y_division_type2]; the_dis_division_type2 = v(theAddedMatrixCell)*ones(3,1); dis_division_type2 = [dis_division_type2, the_dis_division_type2]; end end end hold on; fill(x_division_type2,y_division_type2,dis_division_type2,'EdgeColor','interp'); hold on; fill(x_division_type1,y_division_type1,dis_division_type1,'EdgeColor','interp'); % xlabel( 'x, m' ); ylabel( 'y, m' ); axis equal; axis tight xlim([0,60]); ylim([0,60]); colorbar colormap jet if type == 1 caxis([14,43]); end % fill(x,y,dis); % axis off