This commit is contained in:
xinxiao
2026-03-13 11:24:41 +08:00
commit 04e2bb29c7
238 changed files with 29102 additions and 0 deletions
@@ -0,0 +1,629 @@
function [ matrixvsfra,connectmf,fracnumber,fracstart,corevsfra,connect_infrac,N,T,zf,fcinff,vf,porf,fcff,T_convection,mat_frac,number_of_adding,cell_divided_by_fracture_flag,volume_ratio, fractureCell_matrixCell_addedMatrixCell] = connections_unstructured_EDFM_EX1_solutions( fracturemesh,pointvsregion,raopoint,f,nf,nx,ny,nz,kx,ky,kz,kf,wf,Porf,dxv,dyv,dzv,coord,nodes,NTG,addflag )
%
%
%
%connections
%:xink矩阵去掉零行后
%:
%:
%matrixvsfra矩阵代表基质网格中包含裂缝网格编号的情况
%fracnumber矩阵
%areavsfra矩阵
%
%lengthvsfra矩阵
%corevsfra矩阵
%disvsfra矩阵
matrixvsfra=zeros(nx*ny*nz,10);%10
fracnumber=zeros(1000,20);%1000
%m=size(xink,1);
rownum=zeros(nf,1);
for i=1:nf
rownum(i)=size(fracturemesh{i,1},1);
end
%%
q=1;
fracstart=zeros(nf+1,1);%
for j=1:nf
fracstart(j)=q;
numofmesh=pointvsregion{j,1};
for i=1:1:rownum(j)
if(norm(fracturemesh{j,1}(i,:))~=0)
raoindice=size(fracturemesh{j,1}(i,:),2);
fracnumber(q,1:raoindice)=fracturemesh{j,1}(i,:);%q即是该裂缝编号
% m=floor((i+(2^nf)-1)/(2^nf));
m=floor((i+(2^addflag(j)-1))/(2^addflag(j)));
indice=find(matrixvsfra(numofmesh(m),:)~=0);
% indice=find(matrixvsfra(numofmesh(i),:)~=0);
if (size(indice,2)==0) xiang=1;
else
rao=max(indice');
xiang=rao(1)+1;
end
matrixvsfra(numofmesh(m),xiang)=q;%
q=q+1;
end
end
end
fracstart(nf+1)=q;%+1
fracnumber(q:1000,:)=[];
%% ,
m=size(matrixvsfra,1);
mat_frac=[];
connectmf=cell(1,4);
% for i=1:m
% if (norm(matrixvsfra(i,:))~=0)
% ConnecS = cell(1,4);
cc = 0;
cl = 1;
for i = 1 : m
%
% if ~isempty(matrixvsfra(i,:))
if (norm(matrixvsfra(i,:)))~=0
cc = cc + 1;
%
connectmf{cc,1} = i;
mat_frac=[mat_frac;i];
%/
A=matrixvsfra(i,:);
A(A==0)=[];
connectmf{cc,2} =A;
end
end
%%
% edgevsfra=cell(nf,1);
% Kffl=funtion_data.Kffl;
% Dffl=funtion_data.Dffl;
% kffl=zeros(q-1,1);
% dffl=zeros(q-1,1);
fractureCellFlag = (1:q-1)';
normalvec=zeros(q-1,3);%unit
areavsfra=zeros(q-1,1);%q-1
lengthvsfra=zeros(q-1,10);
Kf=zeros(q-1,10);%
corevsfra=zeros(q-1,3);
disvsfra=zeros(q-1,10);
tran=zeros(q-1,10);
avtran=zeros(q-1,1);%
ave_disvsfra=zeros(q-1,1);
fcinff=zeros(q-1,1);%
zf=zeros(q-1,1);%
vf=zeros(q-1,1);%
porf=zeros(q-1,1);%
for i=1:1:q-1 %
if(norm(fracnumber(i,:))==0) break;
else
for k=2:(nf+1)
if(i<fracstart(k)) fcinff(i)=k-1; break;%,k-1
end
end
d3intersection=raopoint{k-1,1};
anothersection=raopoint{k-1,2};
fraindice=find(fracnumber(i,:)~=0);
rx=size(fraindice,2);
for j=1:1:(rx-1)
%edgevsfra(i,(4*j-3):(4*j))=[fracnumber(i,j),fracnumber(i,j+1),fracnumber(i,j+1),fracnumber(i,j)];%edgevsfra矩阵赋值
%%2
%2线
normalvec(i,:)=cross(f(5*(k-1)-3,:),f(5*(k-1)-2,:))/norm(cross(f(5*(k-1)-3,:),f(5*(k-1)-2,:)));
areavsfra(i)=area(anothersection(fracnumber(i,1:(rx-1))',:) ,f(5*(k-1)-3,:),f(5*(k-1)-2,:) );%
vf(i)=areavsfra(i)*wf(k-1);
porf(i)=Porf(k-1);
Kf(i,1)=kf(k-1);
% kffl(i,1)=Kffl(k-1);
% dffl(i,1)=Dffl(k-1);
lengthvsfra(i,j)=norm(d3intersection(fracnumber(i,j+1),:)-d3intersection(fracnumber(i,j),:));%
corevsfra(i,:)=1/(rx-1)*d3intersection(fracnumber(i,j),:)+corevsfra(i,:);%
zf(i)=corevsfra(i,3);%
rao1=corevsfra(i,:)-d3intersection(fracnumber(i,j),:);
rao2=d3intersection(fracnumber(i,j+1),:)-d3intersection(fracnumber(i,j),:);
disvsfra(i,j)=norm(cross(rao1',rao2'))/norm(rao2);%
tran(i,j)=kf(k-1)*wf(k-1)*lengthvsfra(i,j)./disvsfra(i,j);
end
avtran(i)=sum(tran(i,:))/(rx-1);
ave_disvsfra(i)=sum(disvsfra(i,:))/(rx-1);
end
end
% %% cell数组及其它形状信息
% fcff=cell(1,8);
% fcff{1,1}=fracnumber; fcff{1,2}=fcinff;fcff{1,3}=lengthvsfra;fcff{1,4}=corevsfra;fcff{1,5}=disvsfra;fcff{1,6}=tran;fcff{1,7}=avtran;fcff{1,8}=areavsfra;
%%
maxarea=max(areavsfra,2);
% minlength=min(lengthvsfra,[],2);
% maxlength=max(lengthvsfra,[],2);
newnum=zeros(q-1,1);
[deindex1,~]=find(areavsfra<0*maxarea);
deindex2=[];
for i=1:(q-1)
zeroindex=find(lengthvsfra(i,:)~=0);
minlength=min(lengthvsfra(i,zeroindex));
maxlength=max(lengthvsfra(i,:));
if minlength<0*maxlength
deindex2=[deindex2;i];
end
end
deindex=[deindex1;deindex2];
deindex=unique(deindex);
deindex=sort(deindex);
hui=length(deindex);
if hui>0
for i=1:(q-1)
[dogindex,~]=find(deindex==i);
if length(dogindex)~=0
newnum(i)=0;
else
[catindex,~]=find(deindex<i);
rao=length(catindex);
newnum(i)=i-rao;
end
end
fracnumber(deindex,:)=[];
fcinff(deindex,:)=[];
lengthvsfra(deindex,:)=[];
corevsfra(deindex,:)=[];
disvsfra(deindex,:)=[];
tran(deindex,:)=[];
avtran(deindex,:)=[];
areavsfra(deindex,:)=[];
zf(deindex,:)=[];
vf(deindex,:)=[];
porf(deindex,:)=[];
% change matrixvsfra
for i=1:m%matrixvsfra矩阵的行数
for j=1:10
if matrixvsfra(i,j)~=0
matrixvsfra(i,j)=newnum(matrixvsfra(i,j));
end
end
end
% change fracstart
fracstart(nf+1,1)=length(fracnumber)+1;
for i=1:nf
[daiindex,~]=find(deindex<fracstart(i,1));
dai=length(daiindex);
fracstart(i)=fracstart(i)-dai;
end
end
%% cell数组及其它形状信息
fcff=cell(1,8);
fcff{1,1}=fracnumber; fcff{1,2}=fcinff;fcff{1,3}=lengthvsfra;fcff{1,4}=corevsfra;fcff{1,5}=disvsfra;fcff{1,6}=tran;fcff{1,7}=avtran;fcff{1,8}=areavsfra;
%%
%% (
connect_infrac=cell(nf,1);
Nff=zeros(1,2); %
Tff=zeros(1,1); %
Tff_convection=zeros(1,1); %
for i=1:nf
p=1;
raoconnect=zeros(fracstart(i+1)-fracstart(i),10);%10
d3intersection=raopoint{i,1};
anothersection=raopoint{i,2};
for j=fracstart(i):((fracstart(i+1)-1)-1)%i条裂缝的编号范围
q=1;
for k=j:(fracstart(i+1)-1)
A=fracnumber(j,:);
B=fracnumber(k,:);
%00
A(A==0)=[];
B(B==0)=[];
[a,~]=find(matrixvsfra==j); [b,~]=find(matrixvsfra==k);
if length(a)~=1
heihei=1;
end
raoflag=intersect(A,B);
if((size(raoflag,2)>2)||((size(raoflag,2)<2))) continue;%2
%2线
else if (a==b) continue; %
else
raoconnect(p,q)=k;q=q+1;
lengthcat=norm(d3intersection(raoflag(1),:)-d3intersection(raoflag(2),:));%
rao1k=corevsfra(k,:)-d3intersection(raoflag(1),:);
rao1j=corevsfra(j,:)-d3intersection(raoflag(1),:);
rao2=d3intersection(raoflag(1),:)-d3intersection(raoflag(2),:);
%
disk=norm(cross(rao1k',rao2'))/norm(rao2);
disj=norm(cross(rao1j',rao2'))/norm(rao2);
if kf(i)==0 hartran=0;hartran_convection=0;
else
tran1=kf(i)*wf(i)*lengthcat/disk;
tran2=kf(i)*wf(i)*lengthcat/disj;
% hartran=length/(disk+disj);%
hartran=tran1*tran2/(tran1+tran2);
k_harmony= kf(i);
hartran_convection=kf(i)/(disk+disj)^2;
end
Nff=[Nff; j,k];
Tff=[Tff;hartran];
Tff_convection=[Tff_convection;hartran_convection];
%
end
end
p=p+1;
end
connect_infrac{i,1}=raoconnect;
end
end
Nff(1,:)=[]; %
Tff(1,:)=[];
Tff_convection(1,:)=[];
%%
nmc=size(matrixvsfra,1);
Nmff=zeros(1,2);
Tmff=zeros(1,1);
Tmff_convection=zeros(1,1);
for i=1:nmc
if(norm(matrixvsfra(i,:))~=0)
indice=find(matrixvsfra(i,:)~=0);
n=size(indice,2);
if (n>1) %
% lengthvsfra(matrixvsfra(i,indice))./disvsfra(matrixvsfra(i,indice))
for j=1:n-1
for k=(j+1):n
Nmff=[Nmff;matrixvsfra(i,indice(j)), matrixvsfra(i,indice(k))];
%
fc1=matrixvsfra(i,indice(j)); fc2=matrixvsfra(i,indice(k));
allfc=matrixvsfra(i,1:n); sumtran=sum(fcff{1,7}(allfc));
if sumtran==0 Tmff=[Tmff; 0];Tmff_convection=[Tmff_convection;0];
else
Tmff=[Tmff; fcff{1,7}(fc1)*fcff{1,7}(fc2)/sumtran];
end
end
end
end
end
end
Nmff(1,:)=[]; %
Tmff(1,:)=[];
Tmff_convection(1,:)=[];
% N = [N; Nmff+nmc];
% T = [T; Tmff];
%%
nmc=nx * ny*nz;%
nfc=size(fracnumber,1);%
rpt = [ones(nmc, 1); zeros(nfc, 1)];
% r.rpt = rpt;
nmm = (nx-1)*ny*nz+(ny-1)*nx*nz+(nz-1)*nx*ny;%nmm是基质网格之间存在流体交换的总数
% r.nf = nmm + nff;%nff是裂缝单元之间存在流体交换的总数
Kx=kx.*ones(nmc,1);
Ky=ky.*ones(nmc,1);
Kz=kz.*ones(nmc,1);
N = zeros(nmm, 2);%
T = zeros(nmm, 1);%N矩阵的传导系数
T_convection = zeros(nmm, 1);
c = 0;
for k= 1 : nz
for j = 1 : ny
for i = 1 : nx - 1
c = c + 1;
index = i + (j - 1) * nx + (k - 1) * nx * ny;
indexn = index + 1;
N(c, :) = [index, indexn];
T(c) = 2 * dzv(index)*dyv(index)*Kx(index)*Kx(indexn)*NTG(index)*NTG(indexn)/(Kx(index)*dxv(indexn)*NTG(index) + Kx(indexn)*dxv(index)*NTG(indexn));
T_convection(c) = 2/(1/Kx(index)+1/Kx(indexn))/(dxv(indexn)+dxv(index));
end
end
end
for k= 1 : nz
for i = 1 : nx
for j = 1 : ny - 1
c = c + 1;
index = i + (j - 1) * nx + (k - 1) * nx * ny;
indexn = index + nx;
N(c, :) = [index, indexn];
T(c) = 2 * dzv(index)*dxv(index)*Ky(index)*Ky(indexn)/(Ky(index)*dyv(indexn) + Ky(indexn)*dyv(index));
T_convection(c) = 2/(1/Ky(index)+1/Ky(indexn))/(dyv(indexn)+dyv(index));
end
end
end
for i = 1 : nx
for j = 1 : ny
for k= 1: nz-1
c = c + 1;
index = i + (j - 1) * nx + (k - 1) * nx * ny;
indexn = index + nx * ny;
N(c, :) = [index, index + nx*ny];
T(c) = 2 * dxv(index)*dyv(index)*Kz(index)*Kz(indexn)/(Kz(index)*dzv(indexn) + Kz(indexn)*dzv(index));
T_convection(c) = 2/(1/Kz(index)+1/Kz(indexn))/(dzv(indexn)+dzv(index));
end
end
end
%% 2014
syms x y z;
Ninterflow=[];
Tinterflow=[];
Tinterflow_convection=[];
matrix_cells_containing_fracture_cells = [];
volume_ratio = [];
fractureMatrixFlag = zeros(size(fractureCellFlag,1),2);
numberInGroup = 3;
for i=1:nx*ny*nz %
for j=1:10
if matrixvsfra(i,j)~=0 %this matrix cell contains a fracture cell
fractureMatrixFlag(matrixvsfra(i,j),:) = [matrixvsfra(i,j),i];
matrix_cells_containing_fracture_cells = [matrix_cells_containing_fracture_cells; i];
if mod(matrixvsfra(i,j),numberInGroup) == 1 volume_ratio = [volume_ratio; 5/6];end
if mod(matrixvsfra(i,j),numberInGroup) == 2 volume_ratio = [volume_ratio; 1/2];end
if mod(matrixvsfra(i,j),numberInGroup) == 0 volume_ratio = [volume_ratio; 1/6];end
Ninterflow=[Ninterflow;i,matrixvsfra(i,j)+nmc];
kcell=(kx(i)*ky(i)*kz(i))^(1/3);
Knnc=kcell*Kf(matrixvsfra(i,j))/(kcell+Kf(matrixvsfra(i,j)));
Annc=2*areavsfra(matrixvsfra(i,j));
fracore=corevsfra(matrixvsfra(i,j),:);
matnodes=nodes(i,:);
verco=coord(matnodes,:);norvec=normalvec(matrixvsfra(i,j),:);
matcore=mean(verco);d0=matcore-fracore;
dn=(x+d0(1))*norvec(1)+(y+d0(2))*norvec(2)+(z+d0(3))*norvec(3);
% dn=abs(dn);%
dn=sqrt(dn^2);
dn=matlabFunction(dn);
if norvec(1)~=0 && norvec(2)~=0 && norvec(3)~=0
Dn=integral3(dn,-dxv(i)/2,dxv(i)/2,-dyv(i)/2,dyv(i)/2,-dzv(i)*NTG(i)/2,dzv(i)*NTG(i)/2)/(dxv(i)*dyv(i)*dzv(i)*NTG(i));
else if norvec(1)~=0 && norvec(2)~=0
Dn=dzv(i)*NTG(i)*integral2(dn,-dxv(i)/2,dxv(i)/2,-dyv(i)/2,dyv(i)/2)/(dxv(i)*dyv(i)*dzv(i)*NTG(i));
else if norvec(1)~=0 && norvec(3)~=0
Dn=dyv(i)*integral2(dn,-dxv(i)/2,dxv(i)/2,-dzv(i)*NTG(i)/2,dzv(i)*NTG(i)/2)/(dxv(i)*dyv(i)*dzv(i)*NTG(i));
else if norvec(2)~=0 && norvec(3)~=0
Dn=dxv(i)*integral2(dn,-dyv(i)/2,dyv(i)/2,-dzv(i)*NTG(i)/2,dzv(i)*NTG(i)/2)/(dxv(i)*dyv(i)*dzv(i)*NTG(i));
else if norvec(1)~=0
Dn=dyv(i)*dzv(i)*NTG(i)*integral(dn,-dxv(i)/2,dxv(i)/2)/(dxv(i)*dyv(i)*dzv(i)*NTG(i));
else if norvec(2)~=0
Dn=dxv(i)*dzv(i)*NTG(i)*integral(dn,-dyv(i)/2,dyv(i)/2)/(dxv(i)*dyv(i)*dzv(i)*NTG(i));
else if norvec(3)~=0
Dn=dxv(i)*dyv(i)*integral(dn,-dzv(i)*NTG(i)/2,dzv(i)*NTG(i)/2)/(dxv(i)*dyv(i)*dzv(i)*NTG(i));
end
end
end
end
end
end
end
raoT=Knnc*Annc/Dn;
raoT_convection=2*Knnc/Dn^2;
Tinterflow=[Tinterflow;raoT];
Tinterflow_convection=[Tinterflow_convection;raoT_convection];
end
end
end
%%
nfc=size(fracnumber,1);
the_added_matrix_cells = [];
nmc=nx * ny*nz;
the_added_mf_connec = [];
the_added_mf_T = [];
number_of_adding = 0;
cell_divided_by_fracture_flag = matrix_cells_containing_fracture_cells;
% ,
matrixCellsDivided = zeros(size(matrix_cells_containing_fracture_cells,1),2);
deletedFlag = [];
for i = 1:size(matrix_cells_containing_fracture_cells,1)
the_matrix_cell = matrix_cells_containing_fracture_cells(i,1);
number_of_adding = number_of_adding+1;
the_new_cell = number_of_adding+nmc;
the_added_matrix_cells = [the_added_matrix_cells; the_new_cell];
matrixCellsDivided(i,:) = [the_matrix_cell, the_new_cell];
% m-m连接
for j = 1:size(N,1)
if N(j,1) == the_matrix_cell || N(j,2) == the_matrix_cell
deletedFlag = [deletedFlag; j];
end
% % % if N(j,2) == the_matrix_cell+1
% % % N(j,1) = the_new_cell; T(j) = ...
% % % ((Kx(the_matrix_cell)*dzv(the_matrix_cell)*dyv(the_matrix_cell)/(dxv(the_matrix_cell)/3))^(-1)+(Kx(the_matrix_cell+1)*dzv(the_matrix_cell+1)*dyv(the_matrix_cell+1)/(dxv(the_matrix_cell+1)/2))^(-1))^(-1);
% % % end
% % % if N(j,2) == the_matrix_cell-nx
% % % N(j,1) = the_new_cell; T(j) = ...
% % % ((Ky(the_matrix_cell)*dzv(the_matrix_cell)*dxv(the_matrix_cell)/(dyv(the_matrix_cell)/3))^(-1)+(Ky(the_matrix_cell-n)*dzv(the_matrix_cell-n)*dxv(the_matrix_cell-n)/(dxv(the_matrix_cell-n)/2))^(-1))^(-1);
% % % end
% % % if N(j,1) == the_matrix_cell+1
% % % N(j,2) = the_new_cell; T(j) = ...
% % % ((Kx(the_matrix_cell)*dzv(the_matrix_cell)*dyv(the_matrix_cell)/(dxv(the_matrix_cell)/3))^(-1)+(Kx(the_matrix_cell+1)*dzv(the_matrix_cell+1)*dyv(the_matrix_cell+1)/(dxv(the_matrix_cell+1)/2))^(-1))^(-1);
% % % end
% % % if N(j,1) == the_matrix_cell-nx
% % % N(j,2) = the_new_cell; T(j) = ...
% % % ((Ky(the_matrix_cell)*dzv(the_matrix_cell)*dxv(the_matrix_cell)/(dyv(the_matrix_cell)/3))^(-1)+(Ky(the_matrix_cell-n)*dzv(the_matrix_cell-n)*dxv(the_matrix_cell-n)/(dxv(the_matrix_cell-n)/2))^(-1))^(-1);
% % % end
end
end
deletedFlag = unique(deletedFlag);
N(deletedFlag,:) = [];
T(deletedFlag,:) = [];
% --便
fractureCell_matrixCell_addedMatrixCell = zeros(size(fractureCellFlag,1),3);
for xiang = 1:size(fractureCellFlag,1)
theFractureCell = fractureCellFlag(xiang,1);
aaa = find(fractureMatrixFlag(:,1) == theFractureCell);
theMatrixCell = fractureMatrixFlag(aaa,2);
bbb = find(matrixCellsDivided(:,1) == theMatrixCell);
theAddedMatrixCells = matrixCellsDivided(bbb,2);
fractureCell_matrixCell_addedMatrixCell(theFractureCell,:) = [theFractureCell, theMatrixCell, theAddedMatrixCells];
end
%
relatedN = [];
relatedT = [];
for xiang = 1:size(fractureCellFlag,1)/numberInGroup
addedNSs =[
% x方向上的连接
fractureCell_matrixCell_addedMatrixCell(3*xiang-2,2)-1, fractureCell_matrixCell_addedMatrixCell(3*xiang-2,2);
fractureCell_matrixCell_addedMatrixCell(3*xiang-1,2)-1, fractureCell_matrixCell_addedMatrixCell(3*xiang-1,2);
fractureCell_matrixCell_addedMatrixCell(3*xiang-0,2)-1, fractureCell_matrixCell_addedMatrixCell(3*xiang-0,2);
% x方向上的连接
fractureCell_matrixCell_addedMatrixCell(3*xiang-2,3), fractureCell_matrixCell_addedMatrixCell(3*xiang-2,2)+1;
fractureCell_matrixCell_addedMatrixCell(3*xiang-1,3), fractureCell_matrixCell_addedMatrixCell(3*xiang-1,2)+1;
fractureCell_matrixCell_addedMatrixCell(3*xiang-0,3), fractureCell_matrixCell_addedMatrixCell(3*xiang-0,2)+1;
% y方向上的连接
fractureCell_matrixCell_addedMatrixCell(3*xiang-2,2), fractureCell_matrixCell_addedMatrixCell(3*xiang-1,2);
fractureCell_matrixCell_addedMatrixCell(3*xiang-1,2), fractureCell_matrixCell_addedMatrixCell(3*xiang-0,2);
fractureCell_matrixCell_addedMatrixCell(3*xiang-0,2), fractureCell_matrixCell_addedMatrixCell(3*xiang-0,2)+nx;
% y方向上的连接
fractureCell_matrixCell_addedMatrixCell(3*xiang-2,2)-nx, fractureCell_matrixCell_addedMatrixCell(3*xiang-2,3);
fractureCell_matrixCell_addedMatrixCell(3*xiang-2,3), fractureCell_matrixCell_addedMatrixCell(3*xiang-1,3);
fractureCell_matrixCell_addedMatrixCell(3*xiang-1,3), fractureCell_matrixCell_addedMatrixCell(3*xiang-0,3);
];
relatedN = [relatedN;
addedNSs
];
%
addedTs = [];
for dai = 1:size(addedNSs,1)
the_matrix_cell1 = addedNSs(dai,1); the_matrix_cell2 = addedNSs(dai,2);
if the_matrix_cell1> nmc
aaa = find(fractureCell_matrixCell_addedMatrixCell(:,3) == the_matrix_cell1);
the_matrix_cell1 = fractureCell_matrixCell_addedMatrixCell(aaa,2);
end
if the_matrix_cell2> nmc
aaa = find(fractureCell_matrixCell_addedMatrixCell(:,3) == the_matrix_cell2);
the_matrix_cell2 = fractureCell_matrixCell_addedMatrixCell(aaa,2);
end
if dai == 1
theT = ((Kx(the_matrix_cell1)*dzv(the_matrix_cell1)*dyv(the_matrix_cell1)/(dxv(the_matrix_cell1)/2))^(-1)+(Kx(the_matrix_cell2)*dzv(the_matrix_cell2)*dyv(the_matrix_cell2)/(dxv(the_matrix_cell2)/6))^(-1))^(-1);
end
if dai == 2
theT = ((Kx(the_matrix_cell1)*dzv(the_matrix_cell1)*dyv(the_matrix_cell1)/(dxv(the_matrix_cell1)/2))^(-1)+(Kx(the_matrix_cell2)*dzv(the_matrix_cell2)*dyv(the_matrix_cell2)/(dxv(the_matrix_cell2)/4))^(-1))^(-1);
end
if dai == 3
theT = ((Kx(the_matrix_cell1)*dzv(the_matrix_cell1)*dyv(the_matrix_cell1)/(dxv(the_matrix_cell1)/2))^(-1)+(Kx(the_matrix_cell2)*dzv(the_matrix_cell2)*dyv(the_matrix_cell2)/(dxv(the_matrix_cell2)*5/12))^(-1))^(-1);
end
if dai == 4
theT = ((Kx(the_matrix_cell1)*dzv(the_matrix_cell1)*dyv(the_matrix_cell1)/(dxv(the_matrix_cell1)*5/12))^(-1)+(Kx(the_matrix_cell2)*dzv(the_matrix_cell2)*dyv(the_matrix_cell2)/(dxv(the_matrix_cell2)/2))^(-1))^(-1);
end
if dai == 5
theT = ((Kx(the_matrix_cell1)*dzv(the_matrix_cell1)*dyv(the_matrix_cell1)/(dxv(the_matrix_cell1)*1/4))^(-1)+(Kx(the_matrix_cell2)*dzv(the_matrix_cell2)*dyv(the_matrix_cell2)/(dxv(the_matrix_cell2)/2))^(-1))^(-1);
end
if dai == 6
theT = ((Kx(the_matrix_cell1)*dzv(the_matrix_cell1)*dyv(the_matrix_cell1)/(dxv(the_matrix_cell1)*1/6))^(-1)+(Kx(the_matrix_cell2)*dzv(the_matrix_cell2)*dyv(the_matrix_cell2)/(dxv(the_matrix_cell2)/2))^(-1))^(-1);
end
if dai == 7
theT = ((Ky(the_matrix_cell1)*dzv(the_matrix_cell1)*dxv(the_matrix_cell1)*1/3/(dyv(the_matrix_cell1)/2))^(-1)+(Kx(the_matrix_cell2)*dzv(the_matrix_cell2)*dxv(the_matrix_cell2)*1/3/(dyv(the_matrix_cell2)/2))^(-1))^(-1);
end
if dai == 8
theT = ((Ky(the_matrix_cell1)*dzv(the_matrix_cell1)*dxv(the_matrix_cell1)*2/3/(dyv(the_matrix_cell1)/2))^(-1)+(Kx(the_matrix_cell2)*dzv(the_matrix_cell2)*dxv(the_matrix_cell2)*2/3/(dyv(the_matrix_cell2)/2))^(-1))^(-1);
end
if dai == 9
theT = ((Ky(the_matrix_cell1)*dzv(the_matrix_cell1)*dxv(the_matrix_cell1)*3/3/(dyv(the_matrix_cell1)/2))^(-1)+(Kx(the_matrix_cell2)*dzv(the_matrix_cell2)*dxv(the_matrix_cell2)*3/3/(dyv(the_matrix_cell2)/2))^(-1))^(-1);
end
if dai == 10
theT = ((Ky(the_matrix_cell1)*dzv(the_matrix_cell1)*dxv(the_matrix_cell1)*3/3/(dyv(the_matrix_cell1)/2))^(-1)+(Kx(the_matrix_cell2)*dzv(the_matrix_cell2)*dxv(the_matrix_cell2)*3/3/(dyv(the_matrix_cell2)/2))^(-1))^(-1);
end
if dai == 11
theT = ((Ky(the_matrix_cell1)*dzv(the_matrix_cell1)*dxv(the_matrix_cell1)*2/3/(dyv(the_matrix_cell1)/2))^(-1)+(Kx(the_matrix_cell2)*dzv(the_matrix_cell2)*dxv(the_matrix_cell2)*2/3/(dyv(the_matrix_cell2)/2))^(-1))^(-1);
end
if dai == 12
theT = ((Ky(the_matrix_cell1)*dzv(the_matrix_cell1)*dxv(the_matrix_cell1)*1/3/(dyv(the_matrix_cell1)/2))^(-1)+(Kx(the_matrix_cell2)*dzv(the_matrix_cell2)*dxv(the_matrix_cell2)*1/3/(dyv(the_matrix_cell2)/2))^(-1))^(-1);
end
% % % ((Kx(the_matrix_cell1)*dzv(the_matrix_cell1)*dyv(the_matrix_cell1)/(dxv(the_matrix_cell1)*5/12))^(-1)+(Kx(the_matrix_cell2)*dzv(the_matrix_cell2)*dyv(the_matrix_cell2)/(dxv(the_matrix_cell2)/2))^(-1))^(-1);
% % % ((Kx(the_matrix_cell1)*dzv(the_matrix_cell1)*dyv(the_matrix_cell1)/(dxv(the_matrix_cell1)*1/4))^(-1)+(Kx(the_matrix_cell2)*dzv(the_matrix_cell2)*dyv(the_matrix_cell2)/(dxv(the_matrix_cell2)/2))^(-1))^(-1);
% % % ((Kx(the_matrix_cell1)*dzv(the_matrix_cell1)*dyv(the_matrix_cell1)/(dxv(the_matrix_cell1)*1/6))^(-1)+(Kx(the_matrix_cell2)*dzv(the_matrix_cell2)*dyv(the_matrix_cell2)/(dxv(the_matrix_cell2)/2))^(-1))^(-1);
% % %
% % % ((Ky(the_matrix_cell1)*dzv(the_matrix_cell1)*dxv(the_matrix_cell1)*1/3/(dyv(the_matrix_cell1)/2))^(-1)+(Kx(the_matrix_cell2)*dzv(the_matrix_cell2)*dxv(the_matrix_cell2)*1/3/(dyv(the_matrix_cell2)/2))^(-1))^(-1);
% % % ((Ky(the_matrix_cell1)*dzv(the_matrix_cell1)*dxv(the_matrix_cell1)*2/3/(dyv(the_matrix_cell1)/2))^(-1)+(Kx(the_matrix_cell2)*dzv(the_matrix_cell2)*dxv(the_matrix_cell2)*2/3/(dyv(the_matrix_cell2)/2))^(-1))^(-1);
% % % ((Ky(the_matrix_cell1)*dzv(the_matrix_cell1)*dxv(the_matrix_cell1)*3/3/(dyv(the_matrix_cell1)/2))^(-1)+(Kx(the_matrix_cell2)*dzv(the_matrix_cell2)*dxv(the_matrix_cell2)*3/3/(dyv(the_matrix_cell2)/2))^(-1))^(-1);
% % %
% % % ((Ky(the_matrix_cell1)*dzv(the_matrix_cell1)*dxv(the_matrix_cell1)*3/3/(dyv(the_matrix_cell1)/2))^(-1)+(Kx(the_matrix_cell2)*dzv(the_matrix_cell2)*dxv(the_matrix_cell2)*3/3/(dyv(the_matrix_cell2)/2))^(-1))^(-1);
% % % ((Ky(the_matrix_cell1)*dzv(the_matrix_cell1)*dxv(the_matrix_cell1)*2/3/(dyv(the_matrix_cell1)/2))^(-1)+(Kx(the_matrix_cell2)*dzv(the_matrix_cell2)*dxv(the_matrix_cell2)*2/3/(dyv(the_matrix_cell2)/2))^(-1))^(-1);
% % % ((Ky(the_matrix_cell1)*dzv(the_matrix_cell1)*dxv(the_matrix_cell1)*1/3/(dyv(the_matrix_cell1)/2))^(-1)+(Kx(the_matrix_cell2)*dzv(the_matrix_cell2)*dxv(the_matrix_cell2)*1/3/(dyv(the_matrix_cell2)/2))^(-1))^(-1);
addedTs = [addedTs; theT];
end
relatedT = [relatedT;addedTs];
end
N = [N; relatedN];
T = [T; relatedT];
%
Ninterflow(:,2) = Ninterflow(:,2)+ number_of_adding;
ori_nmc = nmc;
nmc = ori_nmc +number_of_adding;
% m-f连接
% number_of_adding = 0;
for i = 1:size(matrix_cells_containing_fracture_cells,1)
the_matrix_cell = matrix_cells_containing_fracture_cells(i,1);
aaa = find(fractureCell_matrixCell_addedMatrixCell(:,2) == the_matrix_cell);
the_new_cell = fractureCell_matrixCell_addedMatrixCell(aaa,3);
the_fracture_cell_flag = fractureCell_matrixCell_addedMatrixCell(aaa,1);
% number_of_adding = number_of_adding+1;
% the_new_cell = number_of_adding+ori_nmc;
for j = 1:size(Ninterflow,1)
if Ninterflow(j,1) == the_matrix_cell
the_added_mf_connec = [the_added_mf_connec;the_new_cell,Ninterflow(j,2)];
if mod(the_fracture_cell_flag, numberInGroup) == 1
the_added_mf_T = [the_added_mf_T; Tinterflow(j)/2*((1/4)/((1+2/3)/2))];
Tinterflow(j) = Tinterflow(j)/2*((1/4)/((0+1/3)/2));
end
if mod(the_fracture_cell_flag, numberInGroup) == 2
the_added_mf_T = [the_added_mf_T; Tinterflow(j)/2];
Tinterflow(j) = Tinterflow(j)/2;
end
if mod(the_fracture_cell_flag, numberInGroup) == 0
the_added_mf_T = [the_added_mf_T; Tinterflow(j)/2*((1/4)/((0+1/3)/2))];
Tinterflow(j) = Tinterflow(j)/2*((1/4)/((1+2/3)/2));
end
end
end
end
Ninterflow = [Ninterflow; the_added_mf_connec];
Tinterflow = [Tinterflow; the_added_mf_T];
%% 2014
% syms x y z;
% Ninterflow=[];
% Tinterflow=[];
% for i=1:nx*ny*nz %
% for j=1:10
% if matrixvsfra(i,j)~=0 %this matrix cell contains a fracture cell
% Ninterflow=[Ninterflow;i,matrixvsfra(i,j)+nmc];
% kcell=(kx(i)*ky(i)*kz(i))^(1/3);
% K1=Kf(matrixvsfra(i,j));d1=Wf(matrixvsfra(i,j));
% K2=kffl(matrixvsfra(i,j));d2=dffl(matrixvsfra(i,j));
% Annc=2*areavsfra(matrixvsfra(i,j));
% fracore=corevsfra(matrixvsfra(i,j),:);
% matnodes=nodes(i,:);
% verco=coord(matnodes,:);norvec=normalvec(matrixvsfra(i,j),:);
% matcore=mean(verco);d0=matcore-fracore;
% dn=(x+d0(1))*norvec(1)+(y+d0(2))*norvec(2)+(z+d0(3))*norvec(3);
% % dn=abs(dn);%
% dn=sqrt(dn^2);
% dn=matlabFunction(dn);
% if norvec(1)~=0 && norvec(2)~=0 && norvec(3)~=0
% Dn=integral3(dn,-dxv(i)/2,dxv(i)/2,-dyv(i)/2,dyv(i)/2,-dzv(i)*NTG(i)/2,dzv(i)*NTG(i)/2)/(dxv(i)*dyv(i)*dzv(i)*NTG(i));
% else if norvec(1)~=0 && norvec(2)~=0
% Dn=dzv(i)*NTG(i)*integral2(dn,-dxv(i)/2,dxv(i)/2,-dyv(i)/2,dyv(i)/2)/(dxv(i)*dyv(i)*dzv(i)*NTG(i));
% else if norvec(1)~=0 && norvec(3)~=0
% Dn=dyv(i)*integral2(dn,-dxv(i)/2,dxv(i)/2,-dzv(i)*NTG(i)/2,dzv(i)*NTG(i)/2)/(dxv(i)*dyv(i)*dzv(i)*NTG(i));
% else if norvec(2)~=0 && norvec(3)~=0
% Dn=dxv(i)*integral2(dn,-dyv(i)/2,dyv(i)/2,-dzv(i)*NTG(i)/2,dzv(i)*NTG(i)/2)/(dxv(i)*dyv(i)*dzv(i)*NTG(i));
% else if norvec(1)~=0
% Dn=dyv(i)*dzv(i)*NTG(i)*integral(dn,-dxv(i)/2,dxv(i)/2)/(dxv(i)*dyv(i)*dzv(i)*NTG(i));
% else if norvec(2)~=0
% Dn=dxv(i)*dzv(i)*NTG(i)*integral(dn,-dyv(i)/2,dyv(i)/2)/(dxv(i)*dyv(i)*dzv(i)*NTG(i));
% else if norvec(3)~=0
% Dn=dxv(i)*dyv(i)*integral(dn,-dzv(i)*NTG(i)/2,dzv(i)*NTG(i)/2)/(dxv(i)*dyv(i)*dzv(i)*NTG(i));
% end
% end
% end
% end
% end
% end
% end
% raoT=((Kcell*Annc/(Dn-d2))^(-1)+(K2*Annc/d2)^(-1)+(K1*Annc/d1)^(-1))^(-1);
% Tinterflow=[Tinterflow;raoT];
% end
% end
% end
%%
N = [N; Nmff+nmc; Nff+nmc;Ninterflow;];
T = [T; Tmff; Tff;Tinterflow;];
T_convection = [T_convection;Tmff_convection; Tff_convection;Tinterflow_convection;];
nex=size(N,1);
end