231 lines
7.3 KiB
Matlab
231 lines
7.3 KiB
Matlab
function r = GridProp_new(modelflag, r, kx, ky, kz, f, frac_information, fellip, Kf, Wf, pori, prpor, cpor, Porf, prporf, cporf, cf, ca, valid_grids)
|
|
tic;
|
|
%% 基质网格参数及网格参数读取
|
|
nx = r.nx;
|
|
ny = r.ny;
|
|
nz = r.nz;
|
|
dx = r.dx;
|
|
dy = r.dy;
|
|
dz = r.dz;
|
|
NTG = r.NTG;
|
|
coordinates = r.coordinates;
|
|
nodes = r.nodes;
|
|
nP = r.nP;
|
|
nmc = r.nmc;
|
|
dxv = r.dxv;
|
|
dyv = r.dyv;
|
|
dzv = r.dzv;
|
|
zm = r.zm;
|
|
vm = r.vm;
|
|
xrao = r.xrao;
|
|
yrao = r.yrao;
|
|
zrao = r.zrao;
|
|
cell_mid_coords = r.cell_mid_coords;
|
|
%
|
|
kx(valid_grids==0)=1e-12;
|
|
ky(valid_grids==0)=1e-12;
|
|
kz(valid_grids==0)=1e-12;
|
|
%
|
|
r.modelflag=modelflag;
|
|
r.kx = kx;
|
|
r.ky = ky;
|
|
r.kz = kz;
|
|
r.Kf = Kf;%裂缝面对应的渗透率,非裂缝单元
|
|
r.Wf = Wf;%裂缝面对应的缝宽,非裂缝单元
|
|
r.cf = cf;
|
|
r.ca = ca;
|
|
% r.co=co;
|
|
r.cpor=cpor;
|
|
r.cporf=cporf;
|
|
r.frac_information = frac_information;
|
|
|
|
% % % [coordinates, nodes, nP, nE, dxv, dyv,dzv,zm,vm,xrao,yrao,zrao,cell_mid_coordinates] = GenerateNode_final(dx, dy,dz ,nx,ny,nz,NTG);
|
|
% % % r.coordinates = coordinates;
|
|
% % % r.nodes = nodes;
|
|
% % % nmc=nE;
|
|
% % % r.nmc =nmc;
|
|
% % % r.dxv = dxv;
|
|
% % % r.dyv = dyv;
|
|
% % % r.dzv = dzv;
|
|
% % % r.vm=vm;
|
|
% % % r.cell_mid_coordinates=cell_mid_coordinates;
|
|
%% 求解裂缝与基质网格连接情况
|
|
%% 关键参数矩阵初始化
|
|
m=size(f,1);
|
|
n=size(fellip,1);
|
|
nfr=m/5;%矩形规则裂缝条数
|
|
nfir=n/5;%不规则裂缝条数(当然包含椭圆)
|
|
r.nfr=nfr; r.nfir=nfir;
|
|
nf=nfr+nfir;
|
|
r.nf=nf;
|
|
if (nfir~=0) && (nfr~=0)
|
|
f=[f;fellip];
|
|
else if nfr~=0
|
|
f=f;
|
|
else if nfir~=0
|
|
f=fellip;
|
|
else error('Dr Rao reminds you that there is no information about fractures');
|
|
end
|
|
end
|
|
end
|
|
|
|
%d3intersection=-1000*ones(1000,3);%用-1000做标识
|
|
raopoint=cell(nfr+nfir,2);%利用元胞数组存储每条裂缝与基质网格线的交点,
|
|
%第一列是三维坐标形式,即d3intersection
|
|
%第二列是裂缝面参数形式,即anothersection
|
|
pointvsregion=cell(nfr+nfir,3);%利用元胞数组存储interarea函数的结果numofmesh, numvspoint,numofregion
|
|
fracrossfra=cell(nfr+nfir,nfr+nfir-1);%判断裂缝之间两交点坐标
|
|
fratmaxfra=zeros(nfr+nfir,nfr+nfir-1);%判断裂缝之间交线参数的最大值
|
|
fratminfra=zeros(nfr+nfir,nfr+nfir-1);%判断裂缝之间交线参数的最小值
|
|
fracturemesh=cell(nf,1);%每一行是一条裂缝面上的网格剖分情况
|
|
|
|
%% 计算裂缝与基质网格相交情况
|
|
for i=1:nfr
|
|
raopoint{i,1}= intersectionsolve_new_modified_r(f((5*i-4):(5*i),:),dx,dy,dz,nx,ny,nz,xrao,yrao,zrao );
|
|
raopoint{i,2}= anosection( f((5*i-4):(5*i),:),raopoint{i,1} );
|
|
[ pointvsregion{i,1},pointvsregion{i,2} ,pointvsregion{i,3}] = interarea( raopoint{i,1},dx,dy,dz,nx,ny,nz,xrao,yrao,zrao );
|
|
end
|
|
% 不规则缝计算
|
|
if nfir>0
|
|
for i=1:nfir
|
|
raopoint{nfr+i,1}= intersectionsolve_new_modified_irr(fellip((5*i-4):(5*i),:),dx,dy,dz,nx,ny,nz,xrao,yrao,zrao );
|
|
raopoint{nfr+i,2}= anosection( f((5*(nfr+i)-4):(5*(nfr+i)),:),raopoint{nfr+i,1} );
|
|
[ pointvsregion{nfr+i,1},pointvsregion{nfr+i,2} ,pointvsregion{nfr+i,3}] = interarea( raopoint{nfr+i,1},dx,dy,dz,nx,ny,nz,xrao,yrao,zrao );
|
|
end
|
|
end
|
|
|
|
%% 计算裂缝之间相交线情况
|
|
for i=1:nf
|
|
for j=1:nf
|
|
if i>nfr || j>nfr cross=zeros(2,3);tmax=0;tmin=0;
|
|
else
|
|
% [ cross,tmax,tmin ]=frac_cross_frac( f((5*i-4):(5*i),:),f((5*j-4):(5*j),:) );
|
|
cross=zeros(2,3);tmax=0;tmin=0;
|
|
end
|
|
fracrossfra{i,j}=cross;fratmaxfra(i,j)=tmax;fratminfra(i,j)=tmin;
|
|
end
|
|
end
|
|
%% 计算裂缝被基质网格、其它裂缝与之相交后的网格分布情况,绘制二维裂缝平面参数坐标系上的网格分布情况
|
|
% figure('color','w');
|
|
addflag=zeros(nf,1);%乘2的幂次,防止因为裂缝条数较多,造成矩阵太大
|
|
for i=1:nf
|
|
d3intersection=raopoint{i,1};anothersection=raopoint{i,2};
|
|
[ mesh ] = frac_mat_mesh( d3intersection,anothersection,pointvsregion{i,2},pointvsregion{i,1} );
|
|
% for j=1:nf
|
|
% [ mesh,d3intersection,anothersection,add_flag ]= frac_frac_mesh_modified(xrao,yrao,zrao,mesh,f(5*i-4,:),f(5*i-3,:),f(5*i-2,:),fracrossfra{i,j},fratmaxfra(i,j),fratminfra(i,j),d3intersection,anothersection,pointvsregion{i,2},pointvsregion{i,1} );
|
|
% addflag(j,1)=addflag(j,1)+add_flag;
|
|
% end
|
|
raopoint{i,1} = d3intersection; raopoint{i,2} = anothersection;%由原来裂缝与网格的交点不断更新加入其它裂缝与该裂缝的交点
|
|
fracturemesh{i,1}=mesh;
|
|
% subplot(nf,1,i);color_fill={'y','r','b','g'};
|
|
% plotmesh2D(mesh,raopoint{i,2},color_fill{1,mod(i,4)+1});
|
|
end
|
|
|
|
%% 绘制三维背景网格(基质网格)及裂缝网格分布
|
|
%figure(2)
|
|
%network3D(dx,dy,dz,nx,ny,nz );
|
|
%hold on;
|
|
figure('color','w');
|
|
% plot_reservoir_3D(max(xrao),max(yrao),dz(1),1,1,nz);
|
|
% plot_reservoir_3D(dx(1),dy(1),dz(1),nx,ny,nz);
|
|
network3D(dx(1),dy(1),dz(1),nx,ny,nz);
|
|
% network3D(1000,700,10,1,1,1);
|
|
% network3D(800,300,10,1,1,1);
|
|
hold on;
|
|
|
|
% network3D_arbitrary(dx,dy,dz,nx,ny,nz);
|
|
% refine;
|
|
% hold on;
|
|
for i=1:nf
|
|
% color_fill={'y','r','b','g','c','m'};
|
|
% color_fill={'y','r','b','g'};
|
|
% plotmesh3D( fracturemesh{i,1},raopoint{i,1},color_fill{1,mod(i,4)+1});hold on;
|
|
if i <= 100
|
|
color_fill='b'; %流动屏障
|
|
% elseif i <=19
|
|
% color_fill='b'; %压裂缝
|
|
% if i == 2 || i == 9
|
|
% color_fill='r';
|
|
% end
|
|
else
|
|
color_fill='k'; %天然裂缝
|
|
end
|
|
% plotmesh3D( fracturemesh{i,1},raopoint{i,1},color_fill{1,mod(i,4)+1});hold on;
|
|
plotmesh3D( fracturemesh{i,1},raopoint{i,1},color_fill);hold on;
|
|
end
|
|
% % % basic_node_coord = [0,0,0];
|
|
% % % x_length = 700;
|
|
% % % y_length = 800;
|
|
% % % z_length = 10;
|
|
% % % nodes_domain = [basic_node_coord;]
|
|
% % % fill3(x,y,z,'w');
|
|
% refine1;
|
|
% refine_chengjiepaper;
|
|
% refine;
|
|
% plot_reservoir_3D(max(xrao),max(yrao),dz(1),1,1,nz);
|
|
% plot_reservoir_3D(dx(1),dy(1),dz(1),nx,ny,nz);
|
|
xlabel('x, m','FontSize',14);
|
|
ylabel('y, m','FontSize',14);
|
|
zlabel('z, m','FontSize',14);
|
|
ax = gca;
|
|
ax.FontSize = 14;
|
|
%
|
|
% zticks([0, 5]);
|
|
% yticks(-1:0.5:1);
|
|
% 设置x轴和y轴的刻度标签
|
|
% zticklabels({'-2005', '-2000'});
|
|
% yticklabels({'-1', '-0.5', '0', '0.5', '1'});
|
|
% 关闭刻度标签的旋转
|
|
% xticklabels('Rotation', 0);
|
|
% yticklabels('Rotation', 0);
|
|
% axis equal;
|
|
% refine;
|
|
% hold on
|
|
% network3D(dx(1),dy(1),dz(1),nx,ny,nz);
|
|
% network3D(max(xrao),max(yrao),max(zrao),1,1,1 );
|
|
% network3D(10,10,10,2,1,1 );
|
|
% network3D(10,10,10,6,1,2 );
|
|
alpha(1)
|
|
view(3)
|
|
% axis([min(xrao),max(xrao),min(yrao),max(yrao),min(zrao),max(zrao)]);
|
|
% axis equal
|
|
% % hold off;
|
|
%% 确定裂缝编号及连接情况,计算传导系数
|
|
if modelflag==1 %表示用2014, Monifar
|
|
[ matrixvsfra,connectmf,fracnumber,fracstart,corevsfra,connect_infrac, N,T,zf,fcinff,vf,porf,fcff,T_convection,mat_frac,cell_divided_by_fracture_flag, flowArea, perm, matrixflag, T_diff ] = connections_2014( fracturemesh,pointvsregion,raopoint,f,nf,nx,ny,nz,kx,ky,kz,pori,Kf,Wf,Porf,dxv,dyv,dzv,coordinates,nodes,NTG,addflag,valid_grids );
|
|
nfc=size(fracnumber,1);
|
|
nex=size(T,1);
|
|
r.nfc=nfc;
|
|
nc=nfc+nmc;
|
|
r.nc=nc;%基质网格和裂缝单元总数
|
|
r.nex=nex;%具有流体交换的总数
|
|
kf=Kf(fcinff);
|
|
wf=Wf(fcinff);
|
|
r.kf=kf;%裂缝单元对应的渗透率
|
|
r.wf=wf;%裂缝单元对应的缝宽
|
|
r.N=N;
|
|
r.T=T;
|
|
r.T_convection=T_convection;
|
|
r.T_diff = T_diff;
|
|
r.vf=vf;
|
|
r.V=[vm;vf];
|
|
r.porf=porf;
|
|
r.fcff=fcff;
|
|
r.mat_frac=mat_frac;
|
|
r.cell_divided_by_fracture_flag = cell_divided_by_fracture_flag;
|
|
r.flowArea=flowArea;
|
|
r.perm=perm;
|
|
r.matrixflag=matrixflag;
|
|
end
|
|
%% 计算深度(以下平面为基准计算得到的高度,值为正数)
|
|
z=[zm;zf];
|
|
r.z=z;
|
|
rpt = [ones(nmc, 1); zeros(nfc, 1)];
|
|
r.rpt = rpt;
|
|
r.Porf = Porf;
|
|
pori = [pori; porf];
|
|
r.pori = pori;
|
|
r.por = @(p)por(p, prpor, pori, cpor, prporf, cporf, r.rpt);
|
|
tpre=toc;
|
|
r.tpre=tpre;
|