init
This commit is contained in:
@@ -0,0 +1,343 @@
|
||||
function [ r, Times, OutputRs, Wellpara, trun ] = data_standard( )
|
||||
tic;
|
||||
%% 模型选取
|
||||
% 1--2014, Monifar 2--2018, steady, Rao 3--2018, transient, Rao
|
||||
% 4-- PEDFM, Tene, Jiang, Younis
|
||||
modelflag=1;
|
||||
%前处理综合
|
||||
%% 基质网格参数输入并进行网格参数计算
|
||||
% dx=[10*ones(1,100) ];nx=size(dx,2);
|
||||
% dy=[10*ones(1,50) ];ny=size(dy,2);
|
||||
% dz=[10*ones(1,4)];nz=size(dz,2);
|
||||
% dx=[10*ones(1,50) ];nx=size(dx,2);
|
||||
% dy=[10*ones(1,30) ];ny=size(dy,2);
|
||||
% dz=[10*ones(1,3)];nz=size(dz,2);
|
||||
dx=[10*ones(1,100) ];nx=size(dx,2);
|
||||
dy=[10*ones(1,50) ];ny=size(dy,2);
|
||||
dz=[10*ones(1,1)];nz=size(dz,2);
|
||||
%% 裂缝参数输入
|
||||
% 两种输入方式,1表示向量输入,2表示基准点、倾角、方位角、抬升角输入
|
||||
input_style=2;
|
||||
if input_style==1
|
||||
% ==================向量输入====================================== %
|
||||
%首先对矩形缝进行研究,裂缝参数包括三个向量和两个参数的取值范围,如果是其它类型缝,则是两个参数间的函数关系
|
||||
%因此一个5行三列的矩阵可以确定一条裂缝
|
||||
%向量分量可为非整数,以此保证参数范围的取值为整数即可,
|
||||
%故可先随意确定为整数的参数范围,再根据缝长缝高去确定向量分量的取值
|
||||
f=[
|
||||
0,1200,0;10,-20,0;0,0,10;0,60,0;0,3,0;
|
||||
0,1200,0;10,20,0;0,0,10;0,15,0;0,3,0;
|
||||
150,1500,0;20,-10,0;0,0,10;0,20,0;0,3,0;
|
||||
550,1300,0;10,10,0;0,0,10;0,10,0;0,3,0;
|
||||
650,1400,0;10,-20,0;0,0,10;0,55,0;0,3,0;
|
||||
605,705,0;10,0,0;0,0,10;-20,20,0;0,3,0;
|
||||
|
||||
% 385,485,2;5,0,0;0,0,1;-6,12,0;0,24,0;
|
||||
% 385,365,2;5,0,0;0,0,1;-12,20,0;0,24,0;
|
||||
% 385,245,2;5,0,0;0,0,1;-10,20,0;0,24,0;
|
||||
% 385,925,2;5,0,0;0,0,1;-9,18,0;0,20,0;
|
||||
% 385,805,2;5,0,0;0,0,1;-8,14,0;0,20,0;
|
||||
% 385,685,2;5,0,0;0,0,1;-12,20,0;0,24,0;
|
||||
% 385,565,2;5,0,0;0,0,1;-10,20,0;0,22,0;
|
||||
% 385,445,2;5,0,0;0,0,1;-6,12,0;0,24,0;
|
||||
% 955,1305,5;5,0,0;0,0,1;-5,4,0;0,15,0;
|
||||
% 955,1225,5;5,0,0;0,0,1;-7,5,0;0,15,0;
|
||||
% 955,1145,5;5,0,0;0,0,1;-9,6,0;0,15,0;
|
||||
% 955,1065,5;5,0,0;0,0,1;-7,6,0;0,15,0;
|
||||
% 955,985,5;5,0,0;0,0,1;-6,4,0;0,15,0;
|
||||
% 955,755,5;5,0,0;0,0,1;-5,4,0;0,15,0;
|
||||
% 955,675,5;5,0,0;0,0,1;-8,6,0;0,15,0;
|
||||
% 955,595,5;5,0,0;0,0,1;-8,6,0;0,15,0;
|
||||
% 955,515,5;5,0,0;0,0,1;-10,7,0;0,15,0;
|
||||
% 955,435,5;5,0,0;0,0,1;-7,6,0;0,15,0;
|
||||
% 955,355,5;5,0,0;0,0,1;-9,6,0;0,15,0;
|
||||
% 1635,1245,5;5,0,0;0,0,1;-10,2,0;0,20,0;
|
||||
% 1635,1165,5;5,0,0;0,0,1;-16,3,0;0,20,0;
|
||||
% 1635,1085,5;5,0,0;0,0,1;-15,3,0;0,20,0;
|
||||
% 1635,1005,5;5,0,0;0,0,1;-12,2,0;0,20,0;
|
||||
% 1635,925,5;5,0,0;0,0,1;-10,2,0;0,20,0;
|
||||
% 1635,695,5;5,0,0;0,0,1;-10,2,0;0,20,0;
|
||||
% 1635,615,5;5,0,0;0,0,1;-12,2,0;0,20,0;
|
||||
];
|
||||
% 椭圆缝
|
||||
% fellip=[320,210,10;10,2,0;0,0,2;0,0,8;0,0,5;
|
||||
% 280,300,10;10,2,0;0,0,2;0,0,10;0,0,4;];
|
||||
% 300,205,10;10,0,0;0,0,2;0,0,10;0,0,5];
|
||||
fellip=[];
|
||||
else
|
||||
% ==================工程应用输入====================================== %
|
||||
%仅能刻画具有双对称性质的矩形缝或椭圆缝
|
||||
% 基准点坐标(1),方位角(2),倾角(3),抬升角(4),缝长(椭圆长轴长)(5),缝高(椭圆短轴长)(6),类型1是矩形缝、2是椭圆缝(7)
|
||||
input_content={
|
||||
[255,255,5],90,90,0,200,10,1;
|
||||
[305,255,5],90,90,0,200,10,1;
|
||||
[355,255,5],90,90,0,200,10,1;
|
||||
[405,255,5],90,90,0,200,10,1;
|
||||
[455,255,5],90,90,0,200,10,1;
|
||||
[505,255,5],90,90,0,200,10,1;
|
||||
[555,255,5],90,90,0,200,10,1;
|
||||
[605,255,5],90,90,0,200,10,1;
|
||||
[655,255,5],90,90,0,200,10,1;
|
||||
[705,255,5],90,90,0,200,10,1;
|
||||
[755,255,5],90,90,0,200,10,1;
|
||||
};
|
||||
[f,fellip]=sort_fracture(input_content);
|
||||
end
|
||||
|
||||
% ==================裂缝情况整理====================================== %
|
||||
m=size(f,1);
|
||||
n=size(fellip,1);
|
||||
nf=(m+n)/5;%裂缝条数
|
||||
%% 渗流介质相关参数
|
||||
% =====================基质孔渗====================================== %
|
||||
% kx = 0.1*1e-3 * ones(nx*ny*nz, 1);%生成基质网格绝对渗透率x方向矩阵
|
||||
% ky =0.1*1e-3 * ones(nx*ny*nz, 1);%y方向
|
||||
% kz = 0.1*1e-3 * ones(nx*ny*nz, 1);%y方向
|
||||
pori = 0.3 * ones(nx*ny*nz, 1);%生成基质网格孔隙度矩阵
|
||||
prpor = 16;%基质孔隙度基准压力
|
||||
cpor = 1.07e-4;%孔隙体积压缩系数
|
||||
NTG= 1 * ones(nx*ny*nz, 1);
|
||||
% SRV区域定义
|
||||
base_x=23:78; nx_SRV=length(base_x);
|
||||
base_y=15:36; ny_SRV=length(base_y);
|
||||
base_z=1:1;nz_SRV=length(base_z);
|
||||
SRV=[];
|
||||
for k=1:nz_SRV
|
||||
for j=1:ny_SRV
|
||||
for i=1:nx_SRV
|
||||
SRV=[SRV;(base_z(k)-1)*nx*ny+(base_y(j)-1)*nx+base_x(i)];
|
||||
end
|
||||
end
|
||||
end
|
||||
% 非SRV渗透率赋值
|
||||
kx = 0.1*1e-3 * ones(nx*ny*nz, 1);%生成基质网格绝对渗透率x方向矩阵
|
||||
ky =0.1*1e-3 * ones(nx*ny*nz, 1);%y方向
|
||||
kz = 0.1*1e-3 * ones(nx*ny*nz, 1);%y方向
|
||||
% SRV渗透率赋值
|
||||
kx(SRV)=2*1e-3 * ones(length(SRV), 1);
|
||||
ky(SRV)=2*1e-3 * ones(length(SRV), 1);
|
||||
kz(SRV)=2*1e-3 * ones(length(SRV), 1);
|
||||
% load ('NTG.mat');
|
||||
% NTG=sort_input(NTG,nx,ny,nz);
|
||||
% =====================裂缝孔渗====================================== %
|
||||
Kf = 20000*1e-3*ones(1,nf);%裂缝渗透率
|
||||
% Kf = [0*1e-3*ones(1,5) 10000*1e-3*ones(1,1);];%裂缝渗透率
|
||||
Wf =1e-2*ones(1,nf);%裂缝宽度
|
||||
Porf = 0.30*ones(1,nf);%裂缝孔隙度
|
||||
prporf = 20;%裂缝孔隙度基准压力
|
||||
cporf = 1.07e-4;%裂缝孔隙体积压缩系数
|
||||
|
||||
Rpt = 2;%flag
|
||||
cf = 1;
|
||||
ca = 1;
|
||||
% co = 3.02e-3;
|
||||
%% 流体性质参数
|
||||
% =======================密度================================= %
|
||||
Dosi=820; %Dosi是地面标况下测得的油相密度,单位是千克/每立方米
|
||||
Dwsi=1000; %Dwsi是地面标况下测得的水相密度
|
||||
% ====================体积系数及压缩系数================================= %
|
||||
pb = 20.0;%泡点压力
|
||||
Bopb = 1.0;%泡点压力pb对应的原油体积系数
|
||||
co = 3.02e-3;%原油体积压缩系数
|
||||
prw = 20.0;%地层水体积系数基准压力
|
||||
Bwi = 1.00001;%原始地层水体积系数
|
||||
cw = 5e-4;%地层水体积压缩系数
|
||||
prg = 25.0;%地层水体积系数基准压力
|
||||
% =======================粘度================================= %
|
||||
visopb = 2;%泡点压力pb对应的原有粘度
|
||||
cvo = 0;%原油粘度随压力变化的系数
|
||||
vwi =0.6;%原始地层水粘度
|
||||
cvw = 0;%地层水粘度随压力变化的系数
|
||||
% ==================相渗及毛管力曲线====================================== %
|
||||
% ==================基质油水相渗====================================== %
|
||||
RPOW=[
|
||||
0 0 0.8 0
|
||||
0.15 0 0.8 0
|
||||
0.45 0.04 0.4 0
|
||||
0.5212 0.08 0.227 0
|
||||
0.5425 0.103 0.184 0
|
||||
0.5638 0.125 0.156 0
|
||||
0.5851 0.145 0.125 0
|
||||
0.6064 0.174 0.094 0
|
||||
0.6276 0.207 0.063 0
|
||||
0.6489 0.247 0.046 0
|
||||
0.6701 0.292 0.031 0
|
||||
0.6914 0.335 0.021 0
|
||||
0.7127 0.378 0.011 0
|
||||
0.76 0.475 0.005 0
|
||||
0.85 0.552 0 0
|
||||
1 0.552 0 0
|
||||
];
|
||||
SW=RPOW(:,1);KRW=RPOW(:,2);KRO=RPOW(:,3);PCOW=RPOW(:,4);
|
||||
% ==================裂缝油水相渗====================================== %
|
||||
% 在裂缝中,性质就是简单得两点线性插值
|
||||
if Rpt ~= 1%表示该网格是裂缝网格
|
||||
PRF=[
|
||||
0 0 0.8 0
|
||||
0.15 0 0.8 0
|
||||
0.85 0.6 0 0
|
||||
1 0.6 0 0
|
||||
];
|
||||
SWF = PRF(:,1);KRWF = PRF(:,2);KROF = PRF(:,3);PCOWF=PRF(:,4);
|
||||
end
|
||||
% ==================毛管力情况====================================== %
|
||||
ifpcow = 0;%此处为控制是否忽略油水相间毛管力,0代表忽略,非0代表考虑
|
||||
%% 结合网格和流动介质参数进行前处理
|
||||
r = GridProp(modelflag, nx, ny, nz, dx, dy, dz, kx, ky, kz, f, fellip, Kf, Wf, pori, prpor, cpor, Porf, prporf, cporf, cf, ca,co, NTG);
|
||||
%% 生成向量化变成所需要的算子
|
||||
os = OperatorRS(r.N, r.nex, r.nc);
|
||||
%% 结合流体性质参数进行处理
|
||||
f = fluidPVT(Bopb, pb, co, Bwi, prw, cw, vwi, cvw, visopb, cvo, SW, KRO, KRW, PCOW, ifpcow, SWF, KROF, KRWF, PCOWF, r.rpt,Dosi,Dwsi);
|
||||
%% 初值条件 Initial Condition Section
|
||||
% =================压力、饱和度初值======================================= %
|
||||
%压力初值要考虑重力,给出油藏下表面压力值
|
||||
P = [20 * ones(r.nmc, 1); 20 * ones(r.nfc, 1)];
|
||||
% plow=25; % P =plow-1e-6*800*9.8*r.z;
|
||||
Sw = [0.15 * ones(r.nmc, 1); 0.15 * ones(r.nfc, 1)];
|
||||
state0 = initialRS(P, Sw);
|
||||
%% schedule
|
||||
% 井参数输入
|
||||
% Wellcpara: welltype(1) nperf(2) index(3) rw(4) protype(5) value(6)
|
||||
% constraints(7) skin(8) welltype2(9)
|
||||
% welltype = 1 prod, welltype = 2 inj
|
||||
% protype = 1 const flowrate, protype = 2 const pwf
|
||||
% welltype2=1 直井, welltype2=2 水平井沿x方向,welltype2=3 水平井沿y方向 welltype2=4 多段压裂水平井
|
||||
%将直井、水平井与多段压裂水平井分开处理
|
||||
%直井、水平井,该种井型的处理是将射孔段安排在基质网格
|
||||
%由于是三维的储层,具体基质网格不好直接给出,对于直井、斜井、水平井,采取与eclipse一致的方式,给出其在基质网格中位置
|
||||
%每个射孔点由下px,py,pz确定,分别表示该射孔点在x方向,y方向的网格编号,及层数即z反方向上的网格编号(最初是以垂直向上建立的基质网格)
|
||||
well1={
|
||||
% 2, 3, [10 20 1;10 20 2;10 20 3], 0.178/2, 2, 35 , 35, 0, 1;
|
||||
% 2, 3, [67 20 1;67 20 2;67 20 3], 0.178/2, 2, 35 , 35, 0, 1;
|
||||
% 2, 3, [130 20 1;130 20 2;130 20 3], 0.178/2, 2, 35 , 35, 0, 1;
|
||||
% 2, 3, [196 20 1;196 20 2;196 20 3], 0.178/2, 2, 35 , 35, 0, 1;
|
||||
% 2, 3, [10 148 1;10 148 2;10 148 3], 0.178/2, 2, 35 , 35, 0, 1;
|
||||
% 2, 3, [67 148 1;67 148 2;67 148 3], 0.178/2, 2, 35 , 35, 0, 1;
|
||||
% 2, 3, [130 148 1;130 148 2;130 148 3], 0.178/2, 2, 35 , 35, 0, 1;
|
||||
% 2, 3, [196 148 1;196 148 2;196 148 3], 0.178/2, 2, 35 , 35, 0, 1;
|
||||
};
|
||||
%需要找到射孔段具体所在的基质网格编号
|
||||
n1=size(well1,1);
|
||||
for i=1:n1
|
||||
perf=well1{i,3};
|
||||
nperf=well1{i,2};
|
||||
perf(:,3)=(r.nz+1)*ones(nperf,1)-perf(:,3);
|
||||
A=repmat([0 1 1],nperf,1);
|
||||
B=(perf-A)*[1;r.nx;r.nx*r.ny];
|
||||
B=B'; %转换为行向量
|
||||
well1{i,3}=B;
|
||||
end
|
||||
% %多段压裂水平井的处理,射孔段设置在裂缝单元上,可以给出该射孔点所在的坐标,然后去寻找该点所在的裂缝单元编号
|
||||
welloc1=[
|
||||
[255,255,5];
|
||||
[305,255,5];
|
||||
[355,255,5];
|
||||
[405,255,5];
|
||||
[455,255,5];
|
||||
[505,255,5];
|
||||
[555,255,5];
|
||||
[605,255,5];
|
||||
[655,255,5];
|
||||
[705,255,5];
|
||||
[755,255,5];
|
||||
% [205,255,15];
|
||||
% [405,255,21];
|
||||
% [605,255,21];
|
||||
% [805,255,31];
|
||||
% 385,805,15;
|
||||
% 385,685,15;
|
||||
% 385,565,15;
|
||||
% 385,445,15;
|
||||
];
|
||||
% welloc2=[955,1305,15;
|
||||
% 955,1225,15;
|
||||
% 955,1145,15;
|
||||
% 955,1065,15;
|
||||
% 955,985,15;
|
||||
% 955,755,15;
|
||||
% 955,675,15;
|
||||
% 955,595,15;
|
||||
% 955,515,15;
|
||||
% 955,435,15;
|
||||
% 955,355,15;];
|
||||
% welloc3=[1635,1245,15;
|
||||
% 1635,1165,15;
|
||||
% 1635,1085,15;
|
||||
% 1635,1005,15;
|
||||
% 1635,925,15;
|
||||
% 1635,695,15;
|
||||
% 1635,615,15;
|
||||
% ];
|
||||
perfnum1 = findWelloc(r, welloc1);%在用以Wellc0之中
|
||||
% perfnum2 = findWelloc(r, welloc2);
|
||||
% perfnum3 = findWelloc(r, welloc3);
|
||||
well2={
|
||||
1, length(perfnum1), perfnum1, 0.178/2, 2,10, 10, 0,4;
|
||||
% 1, length(perfnum2), perfnum2, 0.178/2, 2,8, 8, 0,4;
|
||||
% 1, length(perfnum3), perfnum3, 0.178/2, 2,8, 8, 0,4;
|
||||
};
|
||||
% well2={};
|
||||
% well2={1, length(perfnum), perfnum, 0.1, 2,10, 10, 0,4;
|
||||
% };
|
||||
% 2, 1, [ 5030 ], 0.3/0.318, 1,0.05, 30, 0,4
|
||||
%把两类井整合到一起
|
||||
nwell1=size(well1,1);
|
||||
nwell2=size(well2,1);
|
||||
nwell=nwell1+nwell2;
|
||||
Wellc0=cell(nwell,9);
|
||||
if nwell1==0
|
||||
Wellc0=well2;
|
||||
elseif nwell2==0
|
||||
Wellc0=well1;
|
||||
else
|
||||
for i=1:nwell1
|
||||
for j=1:9
|
||||
Wellc0{i,j}=well1{i,j};
|
||||
end
|
||||
end
|
||||
for i=1:nwell2
|
||||
for j=1:9
|
||||
Wellc0{i+nwell1,j}=well2{i,j};
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
yitap = 5; % 50-500psi
|
||||
yitas = 0.04; % 0.05-0.5
|
||||
omega = 0.5; % 0-1
|
||||
Nmax = 50;
|
||||
epsave = 1e-6;
|
||||
epsmax = 1e-6;
|
||||
dtmin = 0.001;
|
||||
dtmax =20;
|
||||
tend = 500;
|
||||
nwel = size(Wellc0, 1);
|
||||
WelChg = zeros(nwel, 1);%这表示都开井
|
||||
Wellc = calcTrans(r, Wellc0);
|
||||
w.yitap = yitap;
|
||||
w.yitas = yitas;
|
||||
w.omega = omega;
|
||||
w.Nmax = Nmax;
|
||||
w.epsave = epsave;
|
||||
w.epsmax = epsmax;
|
||||
w.epsave = epsave;
|
||||
w.epsmax = epsmax;
|
||||
w.dtmin = dtmin;
|
||||
w.dtmax = dtmax;
|
||||
w.tend = tend;
|
||||
w.WelChg = WelChg;
|
||||
w.Wellc = Wellc;
|
||||
|
||||
%% 计算
|
||||
if modelflag==1 || modelflag==4
|
||||
[Times, OutputRs, Wellpara, trun] = mainRS_MB_2014(r, f, os, w, state0);
|
||||
else
|
||||
[Times, OutputRs, Wellpara, trun] = mainRS_MB_modified(r, f, os, w, state0);
|
||||
end
|
||||
% [Times, OutputRs, Wellpara, trun] = mainRS_MB_modified(r, f, os, w, state0);
|
||||
run_time=toc;
|
||||
trun.run_time=run_time;
|
||||
end
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,144 @@
|
||||
function plotDis(i, r,OutputRs, type)
|
||||
%为便于作图进行前处理
|
||||
figure('color','w')
|
||||
[ downgrid, frontgrid ,leftgrid, rightgrid, backgrid, upgrid ] = preplot_dis( r );
|
||||
coordinate=r.coordinates;
|
||||
nodes=r.nodes;
|
||||
% nmc = size(nodes,1);%基质网格数量
|
||||
% % nel = size(nodes,2);%每个基质网格所包含的点数量
|
||||
% order=[1,2,4,3,1,5,6,8,7,3,4,8,6,2,1];%用以fill函数作图
|
||||
% nel=size(order,2);
|
||||
if type == 1
|
||||
v = OutputRs{i}.p;
|
||||
elseif type == 2
|
||||
v = 1-OutputRs{i}.sw;%含油饱和度
|
||||
elseif type == 3
|
||||
v = OutputRs{i}.sg;%含油饱和度
|
||||
else
|
||||
v = OutputRs{i}.sw;%含油饱和度
|
||||
end
|
||||
% 底面
|
||||
order=[1,2,4,3,1];
|
||||
nel=size(order,2);
|
||||
nmc=size(downgrid,2);
|
||||
dis = zeros(nel, nmc);
|
||||
x = zeros(nel, nmc);
|
||||
y = zeros(nel, nmc);
|
||||
z = zeros(nel, nmc);
|
||||
for i = 1 : nmc
|
||||
for j = 1 : nel
|
||||
x(j, i) = coordinate(nodes(downgrid(i),order(j)), 1);
|
||||
y(j, i) = coordinate(nodes(downgrid(i),order(j)), 2);
|
||||
z(j, i) = coordinate(nodes(downgrid(i),order(j)), 3)-max(coordinate(:,3))-2000;
|
||||
dis(j, i) = v(downgrid(i));
|
||||
end
|
||||
end
|
||||
fill3(x,y,z,dis,'edgeColor','interp');
|
||||
hold on
|
||||
|
||||
%左面
|
||||
order=[1,5,7,3,1];
|
||||
nel=size(order,2);
|
||||
nmc=size(leftgrid,2);
|
||||
dis = zeros(nel, nmc);
|
||||
x = zeros(nel, nmc);
|
||||
y = zeros(nel, nmc);
|
||||
z = zeros(nel, nmc);
|
||||
for i = 1 : nmc
|
||||
for j = 1 : nel
|
||||
x(j, i) = coordinate(nodes(leftgrid(i),order(j)), 1);
|
||||
y(j, i) = coordinate(nodes(leftgrid(i),order(j)), 2);
|
||||
z(j, i) = coordinate(nodes(leftgrid(i),order(j)), 3)-max(coordinate(:,3))-2000;
|
||||
dis(j, i) = v(leftgrid(i));
|
||||
end
|
||||
end
|
||||
fill3(x,y,z,dis,'edgeColor','interp');
|
||||
|
||||
%右面
|
||||
order=[2,4,8,6,2];
|
||||
nel=size(order,2);
|
||||
nmc=size(rightgrid,2);
|
||||
dis = zeros(nel, nmc);
|
||||
x = zeros(nel, nmc);
|
||||
y = zeros(nel, nmc);
|
||||
z = zeros(nel, nmc);
|
||||
for i = 1 : nmc
|
||||
for j = 1 : nel
|
||||
x(j, i) = coordinate(nodes(rightgrid(i),order(j)), 1);
|
||||
y(j, i) = coordinate(nodes(rightgrid(i),order(j)), 2);
|
||||
z(j, i) = coordinate(nodes(rightgrid(i),order(j)), 3)-max(coordinate(:,3))-2000;
|
||||
dis(j, i) = v(rightgrid(i));
|
||||
end
|
||||
end
|
||||
fill3(x,y,z,dis,'edgeColor','interp');
|
||||
|
||||
%前面
|
||||
order=[1,2,6,5,1];
|
||||
nel=size(order,2);
|
||||
nmc=size(frontgrid,2);
|
||||
dis = zeros(nel, nmc);
|
||||
x = zeros(nel, nmc);
|
||||
y = zeros(nel, nmc);
|
||||
z = zeros(nel, nmc);
|
||||
for i = 1 : nmc
|
||||
for j = 1 : nel
|
||||
x(j, i) = coordinate(nodes(frontgrid(i),order(j)), 1);
|
||||
y(j, i) = coordinate(nodes(frontgrid(i),order(j)), 2);
|
||||
z(j, i) = coordinate(nodes(frontgrid(i),order(j)), 3)-max(coordinate(:,3))-2000;
|
||||
dis(j, i) = v(frontgrid(i));
|
||||
end
|
||||
end
|
||||
fill3(x,y,z,dis,'edgeColor','interp');
|
||||
|
||||
%后面
|
||||
order=[3,4,8,7,3];
|
||||
nel=size(order,2);
|
||||
nmc=size(backgrid,2);
|
||||
dis = zeros(nel, nmc);
|
||||
x = zeros(nel, nmc);
|
||||
y = zeros(nel, nmc);
|
||||
z = zeros(nel, nmc);
|
||||
for i = 1 : nmc
|
||||
for j = 1 : nel
|
||||
x(j, i) = coordinate(nodes(backgrid(i),order(j)), 1);
|
||||
y(j, i) = coordinate(nodes(backgrid(i),order(j)), 2);
|
||||
z(j, i) = coordinate(nodes(backgrid(i),order(j)), 3)-max(coordinate(:,3))-2000;
|
||||
dis(j, i) = v(backgrid(i));
|
||||
end
|
||||
end
|
||||
fill3(x,y,z,dis,'edgeColor','interp');
|
||||
|
||||
%上面
|
||||
order=[5,6,8,7,5];
|
||||
nel=size(order,2);
|
||||
nmc=size(upgrid,2);
|
||||
dis = zeros(nel, nmc);
|
||||
x = zeros(nel, nmc);
|
||||
y = zeros(nel, nmc);
|
||||
z = zeros(nel, nmc);
|
||||
for i = 1 : nmc
|
||||
for j = 1 : nel
|
||||
x(j, i) = coordinate(nodes(upgrid(i),order(j)), 1);
|
||||
y(j, i) = coordinate(nodes(upgrid(i),order(j)), 2);
|
||||
z(j, i) = coordinate(nodes(upgrid(i),order(j)), 3)-max(coordinate(:,3))-2000;
|
||||
dis(j, i) = v(upgrid(i));
|
||||
end
|
||||
end
|
||||
fill3(x,y,z,dis,'edgeColor','interp');
|
||||
set(gca,'FontName','Times New Roman','FontSize',10,'FontWeight','bold');
|
||||
xlabel('x, m');
|
||||
ylabel('y, m');
|
||||
zlabel('z, m');
|
||||
view(3);
|
||||
% 绘制油藏框架
|
||||
% plotframe( r );
|
||||
alpha(1)
|
||||
% caxis([0.2,0.8]);
|
||||
caxis([10,13]);
|
||||
% caxis([12,22]);
|
||||
colormap jet
|
||||
colorbar
|
||||
% zlim([-2020,-2000]);
|
||||
% axis equal
|
||||
axis tight
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
function plotDis_3D_to_2D(i, r, OutputRs, type)
|
||||
coordinate=r.coordinates;
|
||||
nodes=r.nodes;
|
||||
nmc = size(nodes,1);
|
||||
% nel = size(nodes,2);
|
||||
nel = 4;
|
||||
if type == 1
|
||||
% v = r.kx;
|
||||
v = OutputRs{i}.p;
|
||||
else
|
||||
v = 1-OutputRs{i}.sw;%º¬Æø±¥ºÍ¶È
|
||||
end
|
||||
dis = zeros(nel, nmc);
|
||||
x = zeros(nel, nmc);
|
||||
y = zeros(nel, nmc);
|
||||
for i = 1 :nmc
|
||||
for j = 1 :nel
|
||||
x(j, i) = coordinate(nodes(i,j), 1);
|
||||
y(j, i) = coordinate(nodes(i,j), 2);
|
||||
if j == 3
|
||||
x(j, i) = coordinate(nodes(i,4), 1);
|
||||
y(j, i) = coordinate(nodes(i,4), 2);
|
||||
end
|
||||
if j == 4
|
||||
x(j, i) = coordinate(nodes(i,3), 1);
|
||||
y(j, i) = coordinate(nodes(i,3), 2);
|
||||
end
|
||||
dis(j, i) = v(i);
|
||||
end
|
||||
end
|
||||
% fill(x,y,dis,'EdgeAlpha',1);
|
||||
figure('color','w');
|
||||
fill(x,y,dis,'EdgeColor','interp');
|
||||
xlabel('x, m','FontSize',14);
|
||||
ylabel('y, m','FontSize',14);
|
||||
ax = gca;
|
||||
ax.FontSize = 14;
|
||||
axis equal;
|
||||
axis tight
|
||||
% xlim([0,60]);
|
||||
% ylim([0,60]);
|
||||
% clim([10,15]);
|
||||
colorbar
|
||||
colormap jet
|
||||
% fill(x,y,dis);
|
||||
% axis off
|
||||
@@ -0,0 +1,129 @@
|
||||
function plotDis_ECLIPSE( r,ECLIPSE_data)
|
||||
%为便于作图进行前处理
|
||||
[ downgrid, frontgrid ,leftgrid, rightgrid, backgrid, upgrid ] = preplot_dis( r );
|
||||
|
||||
coordinate=r.coordinates;
|
||||
nodes=r.nodes;
|
||||
% nmc = size(nodes,1);%基质网格数量
|
||||
% % nel = size(nodes,2);%每个基质网格所包含的点数量
|
||||
% order=[1,2,4,3,1,5,6,8,7,3,4,8,6,2,1];%用以fill函数作图
|
||||
% nel=size(order,2);
|
||||
v =reshape( ECLIPSE_data',[],1);%含油饱和度
|
||||
|
||||
% 底面
|
||||
order=[1,2,4,3,1];
|
||||
nel=size(order,2);
|
||||
nmc=size(downgrid,2);
|
||||
dis = zeros(nel, nmc);
|
||||
x = zeros(nel, nmc);
|
||||
y = zeros(nel, nmc);
|
||||
z = zeros(nel, nmc);
|
||||
for i = 1 : nmc
|
||||
for j = 1 : nel
|
||||
x(j, i) = coordinate(nodes(downgrid(i),order(j)), 1);
|
||||
y(j, i) = coordinate(nodes(downgrid(i),order(j)), 2);
|
||||
z(j, i) = coordinate(nodes(downgrid(i),order(j)), 3);
|
||||
dis(j, i) = v(downgrid(i));
|
||||
end
|
||||
end
|
||||
fill3(x,y,z,dis,'edgeColor','interp');
|
||||
hold on
|
||||
|
||||
%左面
|
||||
order=[1,5,7,3,1];
|
||||
nel=size(order,2);
|
||||
nmc=size(leftgrid,2);
|
||||
dis = zeros(nel, nmc);
|
||||
x = zeros(nel, nmc);
|
||||
y = zeros(nel, nmc);
|
||||
z = zeros(nel, nmc);
|
||||
for i = 1 : nmc
|
||||
for j = 1 : nel
|
||||
x(j, i) = coordinate(nodes(leftgrid(i),order(j)), 1);
|
||||
y(j, i) = coordinate(nodes(leftgrid(i),order(j)), 2);
|
||||
z(j, i) = coordinate(nodes(leftgrid(i),order(j)), 3);
|
||||
dis(j, i) = v(leftgrid(i));
|
||||
end
|
||||
end
|
||||
fill3(x,y,z,dis,'edgeColor','interp');
|
||||
|
||||
%右面
|
||||
order=[2,4,8,6,2];
|
||||
nel=size(order,2);
|
||||
nmc=size(rightgrid,2);
|
||||
dis = zeros(nel, nmc);
|
||||
x = zeros(nel, nmc);
|
||||
y = zeros(nel, nmc);
|
||||
z = zeros(nel, nmc);
|
||||
for i = 1 : nmc
|
||||
for j = 1 : nel
|
||||
x(j, i) = coordinate(nodes(rightgrid(i),order(j)), 1);
|
||||
y(j, i) = coordinate(nodes(rightgrid(i),order(j)), 2);
|
||||
z(j, i) = coordinate(nodes(rightgrid(i),order(j)), 3);
|
||||
dis(j, i) = v(rightgrid(i));
|
||||
end
|
||||
end
|
||||
fill3(x,y,z,dis,'edgeColor','interp');
|
||||
|
||||
%前面
|
||||
order=[1,2,6,5,1];
|
||||
nel=size(order,2);
|
||||
nmc=size(frontgrid,2);
|
||||
dis = zeros(nel, nmc);
|
||||
x = zeros(nel, nmc);
|
||||
y = zeros(nel, nmc);
|
||||
z = zeros(nel, nmc);
|
||||
for i = 1 : nmc
|
||||
for j = 1 : nel
|
||||
x(j, i) = coordinate(nodes(frontgrid(i),order(j)), 1);
|
||||
y(j, i) = coordinate(nodes(frontgrid(i),order(j)), 2);
|
||||
z(j, i) = coordinate(nodes(frontgrid(i),order(j)), 3);
|
||||
dis(j, i) = v(frontgrid(i));
|
||||
end
|
||||
end
|
||||
fill3(x,y,z,dis,'edgeColor','interp');
|
||||
|
||||
%后面
|
||||
order=[3,4,8,7,3];
|
||||
nel=size(order,2);
|
||||
nmc=size(backgrid,2);
|
||||
dis = zeros(nel, nmc);
|
||||
x = zeros(nel, nmc);
|
||||
y = zeros(nel, nmc);
|
||||
z = zeros(nel, nmc);
|
||||
for i = 1 : nmc
|
||||
for j = 1 : nel
|
||||
x(j, i) = coordinate(nodes(backgrid(i),order(j)), 1);
|
||||
y(j, i) = coordinate(nodes(backgrid(i),order(j)), 2);
|
||||
z(j, i) = coordinate(nodes(backgrid(i),order(j)), 3);
|
||||
dis(j, i) = v(backgrid(i));
|
||||
end
|
||||
end
|
||||
fill3(x,y,z,dis,'edgeColor','interp');
|
||||
|
||||
%上面
|
||||
order=[5,6,8,7,5];
|
||||
nel=size(order,2);
|
||||
nmc=size(upgrid,2);
|
||||
dis = zeros(nel, nmc);
|
||||
x = zeros(nel, nmc);
|
||||
y = zeros(nel, nmc);
|
||||
z = zeros(nel, nmc);
|
||||
for i = 1 : nmc
|
||||
for j = 1 : nel
|
||||
x(j, i) = coordinate(nodes(upgrid(i),order(j)), 1);
|
||||
y(j, i) = coordinate(nodes(upgrid(i),order(j)), 2);
|
||||
z(j, i) = coordinate(nodes(upgrid(i),order(j)), 3);
|
||||
dis(j, i) = v(upgrid(i));
|
||||
end
|
||||
end
|
||||
fill3(x,y,z,dis,'edgeColor','interp');
|
||||
|
||||
% 绘制油藏框架
|
||||
% plotframe( r );
|
||||
|
||||
|
||||
|
||||
% axis equal
|
||||
axis tight
|
||||
|
||||
@@ -0,0 +1,147 @@
|
||||
function plotDislayer(i, k ,r,OutputRs, type)
|
||||
%i:时间点,k是从上至下数的层位,type: 1是压力场
|
||||
figure('color','w')
|
||||
[ downgrid, frontgrid ,leftgrid, rightgrid, backgrid, upgrid ] = preplot_dislayer( r,k );
|
||||
coordinate=r.coordinates;
|
||||
nodes=r.nodes;
|
||||
nx=r.nx;
|
||||
ny=r.ny;
|
||||
nz=r.nz;
|
||||
% order=[1,2,4,3,1,5,6,8,7,3,4,8,6,2,1];%用以fill函数作图
|
||||
% % nmc = size(nodes,1);%基质网格数量
|
||||
% nmc = nx*ny;
|
||||
% % nel = size(nodes,2);%每个基质网格所包含的点数量
|
||||
% nel=size(order,2);
|
||||
if type == 1
|
||||
v = OutputRs{i}.p;
|
||||
% v = log(r.kx);
|
||||
elseif type == 2
|
||||
% v = 1-OutputRs{i}.sw -OutputRs{i}.sg;%含油饱和度
|
||||
v = 1-OutputRs{i}.sw;%含油饱和度
|
||||
elseif type == 3
|
||||
v = OutputRs{i}.sg;%含油饱和度
|
||||
else
|
||||
v = OutputRs{i}.sw;%含油饱和度
|
||||
end
|
||||
% 底面
|
||||
order=[1,2,4,3,1];
|
||||
nel=size(order,2);
|
||||
nmc=size(downgrid,2);
|
||||
dis = zeros(nel, nmc);
|
||||
x = zeros(nel, nmc);
|
||||
y = zeros(nel, nmc);
|
||||
z = zeros(nel, nmc);
|
||||
for i = 1 : nmc
|
||||
for j = 1 : nel
|
||||
x(j, i) = coordinate(nodes(downgrid(i),order(j)), 1);
|
||||
y(j, i) = coordinate(nodes(downgrid(i),order(j)), 2);
|
||||
z(j, i) = coordinate(nodes(downgrid(i),order(j)), 3);
|
||||
dis(j, i) = v(downgrid(i));
|
||||
end
|
||||
end
|
||||
fill3(x,y,z,dis,'edgeColor','interp');
|
||||
hold on
|
||||
|
||||
%左面
|
||||
order=[1,5,7,3,1];
|
||||
nel=size(order,2);
|
||||
nmc=size(leftgrid,2);
|
||||
dis = zeros(nel, nmc);
|
||||
x = zeros(nel, nmc);
|
||||
y = zeros(nel, nmc);
|
||||
z = zeros(nel, nmc);
|
||||
for i = 1 : nmc
|
||||
for j = 1 : nel
|
||||
x(j, i) = coordinate(nodes(leftgrid(i),order(j)), 1);
|
||||
y(j, i) = coordinate(nodes(leftgrid(i),order(j)), 2);
|
||||
z(j, i) = coordinate(nodes(leftgrid(i),order(j)), 3);
|
||||
dis(j, i) = v(leftgrid(i));
|
||||
end
|
||||
end
|
||||
fill3(x,y,z,dis,'edgeColor','interp');
|
||||
|
||||
%右面
|
||||
order=[2,4,8,6,2];
|
||||
nel=size(order,2);
|
||||
nmc=size(rightgrid,2);
|
||||
dis = zeros(nel, nmc);
|
||||
x = zeros(nel, nmc);
|
||||
y = zeros(nel, nmc);
|
||||
z = zeros(nel, nmc);
|
||||
for i = 1 : nmc
|
||||
for j = 1 : nel
|
||||
x(j, i) = coordinate(nodes(rightgrid(i),order(j)), 1);
|
||||
y(j, i) = coordinate(nodes(rightgrid(i),order(j)), 2);
|
||||
z(j, i) = coordinate(nodes(rightgrid(i),order(j)), 3);
|
||||
dis(j, i) = v(rightgrid(i));
|
||||
end
|
||||
end
|
||||
fill3(x,y,z,dis,'edgeColor','interp');
|
||||
|
||||
%前面
|
||||
order=[1,2,6,5,1];
|
||||
nel=size(order,2);
|
||||
nmc=size(frontgrid,2);
|
||||
dis = zeros(nel, nmc);
|
||||
x = zeros(nel, nmc);
|
||||
y = zeros(nel, nmc);
|
||||
z = zeros(nel, nmc);
|
||||
for i = 1 : nmc
|
||||
for j = 1 : nel
|
||||
x(j, i) = coordinate(nodes(frontgrid(i),order(j)), 1);
|
||||
y(j, i) = coordinate(nodes(frontgrid(i),order(j)), 2);
|
||||
z(j, i) = coordinate(nodes(frontgrid(i),order(j)), 3);
|
||||
dis(j, i) = v(frontgrid(i));
|
||||
end
|
||||
end
|
||||
fill3(x,y,z,dis,'edgeColor','interp');
|
||||
|
||||
%后面
|
||||
order=[3,4,8,7,3];
|
||||
nel=size(order,2);
|
||||
nmc=size(backgrid,2);
|
||||
dis = zeros(nel, nmc);
|
||||
x = zeros(nel, nmc);
|
||||
y = zeros(nel, nmc);
|
||||
z = zeros(nel, nmc);
|
||||
for i = 1 : nmc
|
||||
for j = 1 : nel
|
||||
x(j, i) = coordinate(nodes(backgrid(i),order(j)), 1);
|
||||
y(j, i) = coordinate(nodes(backgrid(i),order(j)), 2);
|
||||
z(j, i) = coordinate(nodes(backgrid(i),order(j)), 3);
|
||||
dis(j, i) = v(backgrid(i));
|
||||
end
|
||||
end
|
||||
fill3(x,y,z,dis,'edgeColor','interp');
|
||||
|
||||
%上面
|
||||
order=[5,6,8,7,5];
|
||||
nel=size(order,2);
|
||||
nmc=size(upgrid,2);
|
||||
dis = zeros(nel, nmc);
|
||||
x = zeros(nel, nmc);
|
||||
y = zeros(nel, nmc);
|
||||
z = zeros(nel, nmc);
|
||||
for i = 1 : nmc
|
||||
for j = 1 : nel
|
||||
x(j, i) = coordinate(nodes(upgrid(i),order(j)), 1);
|
||||
y(j, i) = coordinate(nodes(upgrid(i),order(j)), 2);
|
||||
z(j, i) = coordinate(nodes(upgrid(i),order(j)), 3);
|
||||
dis(j, i) = v(upgrid(i));
|
||||
end
|
||||
end
|
||||
fill3(x,y,z,dis,'edgeColor','interp');
|
||||
set(gca,'FontName','Times New Roman','FontSize',10,'FontWeight','bold');
|
||||
xlabel('x, m');
|
||||
ylabel('y, m');
|
||||
zlabel('z, m');
|
||||
view(2);
|
||||
% fill(x,y,dis);
|
||||
axis equal
|
||||
% axis off
|
||||
axis tight
|
||||
colormap jet
|
||||
% caxis([12,22]);
|
||||
colorbar
|
||||
caxis([0.2,0.8]);
|
||||
|
||||
@@ -0,0 +1,153 @@
|
||||
function plotDislayer(i, k ,r,OutputRs, type)
|
||||
%i:时间点,k是从上至下数的层位,type: 1是压力场
|
||||
figure('color','w')
|
||||
[ downgrid, frontgrid ,leftgrid, rightgrid, backgrid, upgrid ] = preplot_dislayer( r,k );
|
||||
coordinate=r.coordinates;
|
||||
nodes=r.nodes;
|
||||
nx=r.nx;
|
||||
ny=r.ny;
|
||||
nz=r.nz;
|
||||
% order=[1,2,4,3,1,5,6,8,7,3,4,8,6,2,1];%用以fill函数作图
|
||||
% % nmc = size(nodes,1);%基质网格数量
|
||||
% nmc = nx*ny;
|
||||
% % nel = size(nodes,2);%每个基质网格所包含的点数量
|
||||
% nel=size(order,2);
|
||||
if type == 1
|
||||
v = OutputRs{i}.p;
|
||||
% v = log(r.kx);
|
||||
elseif type == 2
|
||||
% v = 1-OutputRs{i}.sw -OutputRs{i}.sg;%含油饱和度
|
||||
v = 1-OutputRs{i}.sw;%含油饱和度
|
||||
elseif type == 3
|
||||
v = OutputRs{i}.sg;%含油饱和度
|
||||
else
|
||||
v = OutputRs{i}.sw;%含油饱和度
|
||||
end
|
||||
% 底面
|
||||
order=[1,2,4,3,1];
|
||||
nel=size(order,2);
|
||||
nmc=size(downgrid,2);
|
||||
dis = zeros(nel, nmc);
|
||||
x = zeros(nel, nmc);
|
||||
y = zeros(nel, nmc);
|
||||
z = zeros(nel, nmc);
|
||||
for i = 1 : nmc
|
||||
for j = 1 : nel
|
||||
x(j, i) = coordinate(nodes(downgrid(i),order(j)), 1);
|
||||
y(j, i) = coordinate(nodes(downgrid(i),order(j)), 2);
|
||||
z(j, i) = coordinate(nodes(downgrid(i),order(j)), 3);
|
||||
dis(j, i) = v(downgrid(i));
|
||||
end
|
||||
end
|
||||
fill3(x,y,z,dis,'edgeColor','interp');
|
||||
hold on
|
||||
|
||||
%左面
|
||||
order=[1,5,7,3,1];
|
||||
nel=size(order,2);
|
||||
nmc=size(leftgrid,2);
|
||||
dis = zeros(nel, nmc);
|
||||
x = zeros(nel, nmc);
|
||||
y = zeros(nel, nmc);
|
||||
z = zeros(nel, nmc);
|
||||
for i = 1 : nmc
|
||||
for j = 1 : nel
|
||||
x(j, i) = coordinate(nodes(leftgrid(i),order(j)), 1);
|
||||
y(j, i) = coordinate(nodes(leftgrid(i),order(j)), 2);
|
||||
z(j, i) = coordinate(nodes(leftgrid(i),order(j)), 3);
|
||||
dis(j, i) = v(leftgrid(i));
|
||||
end
|
||||
end
|
||||
fill3(x,y,z,dis,'edgeColor','interp');
|
||||
|
||||
%右面
|
||||
order=[2,4,8,6,2];
|
||||
nel=size(order,2);
|
||||
nmc=size(rightgrid,2);
|
||||
dis = zeros(nel, nmc);
|
||||
x = zeros(nel, nmc);
|
||||
y = zeros(nel, nmc);
|
||||
z = zeros(nel, nmc);
|
||||
for i = 1 : nmc
|
||||
for j = 1 : nel
|
||||
x(j, i) = coordinate(nodes(rightgrid(i),order(j)), 1);
|
||||
y(j, i) = coordinate(nodes(rightgrid(i),order(j)), 2);
|
||||
z(j, i) = coordinate(nodes(rightgrid(i),order(j)), 3);
|
||||
dis(j, i) = v(rightgrid(i));
|
||||
end
|
||||
end
|
||||
fill3(x,y,z,dis,'edgeColor','interp');
|
||||
|
||||
%前面
|
||||
order=[1,2,6,5,1];
|
||||
nel=size(order,2);
|
||||
nmc=size(frontgrid,2);
|
||||
dis = zeros(nel, nmc);
|
||||
x = zeros(nel, nmc);
|
||||
y = zeros(nel, nmc);
|
||||
z = zeros(nel, nmc);
|
||||
for i = 1 : nmc
|
||||
for j = 1 : nel
|
||||
x(j, i) = coordinate(nodes(frontgrid(i),order(j)), 1);
|
||||
y(j, i) = coordinate(nodes(frontgrid(i),order(j)), 2);
|
||||
z(j, i) = coordinate(nodes(frontgrid(i),order(j)), 3);
|
||||
dis(j, i) = v(frontgrid(i));
|
||||
end
|
||||
end
|
||||
fill3(x,y,z,dis,'edgeColor','interp');
|
||||
|
||||
%后面
|
||||
order=[3,4,8,7,3];
|
||||
nel=size(order,2);
|
||||
nmc=size(backgrid,2);
|
||||
dis = zeros(nel, nmc);
|
||||
x = zeros(nel, nmc);
|
||||
y = zeros(nel, nmc);
|
||||
z = zeros(nel, nmc);
|
||||
for i = 1 : nmc
|
||||
for j = 1 : nel
|
||||
x(j, i) = coordinate(nodes(backgrid(i),order(j)), 1);
|
||||
y(j, i) = coordinate(nodes(backgrid(i),order(j)), 2);
|
||||
z(j, i) = coordinate(nodes(backgrid(i),order(j)), 3);
|
||||
dis(j, i) = v(backgrid(i));
|
||||
end
|
||||
end
|
||||
fill3(x,y,z,dis,'edgeColor','interp');
|
||||
|
||||
%上面
|
||||
order=[5,6,8,7,5];
|
||||
nel=size(order,2);
|
||||
nmc=size(upgrid,2);
|
||||
dis = zeros(nel, nmc);
|
||||
x = zeros(nel, nmc);
|
||||
y = zeros(nel, nmc);
|
||||
z = zeros(nel, nmc);
|
||||
for i = 1 : nmc
|
||||
for j = 1 : nel
|
||||
x(j, i) = coordinate(nodes(upgrid(i),order(j)), 1);
|
||||
y(j, i) = coordinate(nodes(upgrid(i),order(j)), 2);
|
||||
z(j, i) = coordinate(nodes(upgrid(i),order(j)), 3);
|
||||
dis(j, i) = v(upgrid(i));
|
||||
end
|
||||
end
|
||||
fill3(x,y,z,dis,'edgeColor','interp');
|
||||
set(gca,'FontName','Times New Roman','FontSize',10,'FontWeight','bold');
|
||||
xlabel('x, m');
|
||||
ylabel('y, m');
|
||||
zlabel('z, m');
|
||||
view(2);
|
||||
% fill(x,y,dis);
|
||||
axis equal
|
||||
% axis off
|
||||
axis tight
|
||||
colormap jet
|
||||
if type ==1
|
||||
caxis([5,22]);
|
||||
else
|
||||
caxis([0.2,0.8]);
|
||||
end
|
||||
% caxis([12,22]);
|
||||
% caxis([10,13]);
|
||||
colorbar
|
||||
% caxis([0.2,0.8]);
|
||||
|
||||
@@ -0,0 +1,131 @@
|
||||
function plotDislayer_ECLIPSE( k ,r,ECLIPSE_data)
|
||||
%i:时间点,k是从上至下数的层位,type: 1是压力场
|
||||
[ downgrid, frontgrid ,leftgrid, rightgrid, backgrid, upgrid ] = preplot_dislayer( r,k );
|
||||
coordinate=r.coordinates;
|
||||
nodes=r.nodes;
|
||||
nx=r.nx;
|
||||
ny=r.ny;
|
||||
nz=r.nz;
|
||||
% order=[1,2,4,3,1,5,6,8,7,3,4,8,6,2,1];%用以fill函数作图
|
||||
% % nmc = size(nodes,1);%基质网格数量
|
||||
% nmc = nx*ny;
|
||||
% % nel = size(nodes,2);%每个基质网格所包含的点数量
|
||||
% nel=size(order,2);
|
||||
v =reshape( ECLIPSE_data',[],1);%含油饱和度
|
||||
% 底面
|
||||
order=[1,2,4,3,1];
|
||||
nel=size(order,2);
|
||||
nmc=size(downgrid,2);
|
||||
dis = zeros(nel, nmc);
|
||||
x = zeros(nel, nmc);
|
||||
y = zeros(nel, nmc);
|
||||
z = zeros(nel, nmc);
|
||||
for i = 1 : nmc
|
||||
for j = 1 : nel
|
||||
x(j, i) = coordinate(nodes(downgrid(i),order(j)), 1);
|
||||
y(j, i) = coordinate(nodes(downgrid(i),order(j)), 2);
|
||||
z(j, i) = coordinate(nodes(downgrid(i),order(j)), 3);
|
||||
dis(j, i) = v(downgrid(i));
|
||||
end
|
||||
end
|
||||
fill3(x,y,z,dis,'edgeColor','interp');
|
||||
hold on
|
||||
|
||||
%左面
|
||||
order=[1,5,7,3,1];
|
||||
nel=size(order,2);
|
||||
nmc=size(leftgrid,2);
|
||||
dis = zeros(nel, nmc);
|
||||
x = zeros(nel, nmc);
|
||||
y = zeros(nel, nmc);
|
||||
z = zeros(nel, nmc);
|
||||
for i = 1 : nmc
|
||||
for j = 1 : nel
|
||||
x(j, i) = coordinate(nodes(leftgrid(i),order(j)), 1);
|
||||
y(j, i) = coordinate(nodes(leftgrid(i),order(j)), 2);
|
||||
z(j, i) = coordinate(nodes(leftgrid(i),order(j)), 3);
|
||||
dis(j, i) = v(leftgrid(i));
|
||||
end
|
||||
end
|
||||
fill3(x,y,z,dis,'edgeColor','interp');
|
||||
|
||||
%右面
|
||||
order=[2,4,8,6,2];
|
||||
nel=size(order,2);
|
||||
nmc=size(rightgrid,2);
|
||||
dis = zeros(nel, nmc);
|
||||
x = zeros(nel, nmc);
|
||||
y = zeros(nel, nmc);
|
||||
z = zeros(nel, nmc);
|
||||
for i = 1 : nmc
|
||||
for j = 1 : nel
|
||||
x(j, i) = coordinate(nodes(rightgrid(i),order(j)), 1);
|
||||
y(j, i) = coordinate(nodes(rightgrid(i),order(j)), 2);
|
||||
z(j, i) = coordinate(nodes(rightgrid(i),order(j)), 3);
|
||||
dis(j, i) = v(rightgrid(i));
|
||||
end
|
||||
end
|
||||
fill3(x,y,z,dis,'edgeColor','interp');
|
||||
|
||||
%前面
|
||||
order=[1,2,6,5,1];
|
||||
nel=size(order,2);
|
||||
nmc=size(frontgrid,2);
|
||||
dis = zeros(nel, nmc);
|
||||
x = zeros(nel, nmc);
|
||||
y = zeros(nel, nmc);
|
||||
z = zeros(nel, nmc);
|
||||
for i = 1 : nmc
|
||||
for j = 1 : nel
|
||||
x(j, i) = coordinate(nodes(frontgrid(i),order(j)), 1);
|
||||
y(j, i) = coordinate(nodes(frontgrid(i),order(j)), 2);
|
||||
z(j, i) = coordinate(nodes(frontgrid(i),order(j)), 3);
|
||||
dis(j, i) = v(frontgrid(i));
|
||||
end
|
||||
end
|
||||
fill3(x,y,z,dis,'edgeColor','interp');
|
||||
|
||||
%后面
|
||||
order=[3,4,8,7,3];
|
||||
nel=size(order,2);
|
||||
nmc=size(backgrid,2);
|
||||
dis = zeros(nel, nmc);
|
||||
x = zeros(nel, nmc);
|
||||
y = zeros(nel, nmc);
|
||||
z = zeros(nel, nmc);
|
||||
for i = 1 : nmc
|
||||
for j = 1 : nel
|
||||
x(j, i) = coordinate(nodes(backgrid(i),order(j)), 1);
|
||||
y(j, i) = coordinate(nodes(backgrid(i),order(j)), 2);
|
||||
z(j, i) = coordinate(nodes(backgrid(i),order(j)), 3);
|
||||
dis(j, i) = v(backgrid(i));
|
||||
end
|
||||
end
|
||||
fill3(x,y,z,dis,'edgeColor','interp');
|
||||
|
||||
%上面
|
||||
order=[5,6,8,7,5];
|
||||
nel=size(order,2);
|
||||
nmc=size(upgrid,2);
|
||||
dis = zeros(nel, nmc);
|
||||
x = zeros(nel, nmc);
|
||||
y = zeros(nel, nmc);
|
||||
z = zeros(nel, nmc);
|
||||
for i = 1 : nmc
|
||||
for j = 1 : nel
|
||||
x(j, i) = coordinate(nodes(upgrid(i),order(j)), 1);
|
||||
y(j, i) = coordinate(nodes(upgrid(i),order(j)), 2);
|
||||
z(j, i) = coordinate(nodes(upgrid(i),order(j)), 3);
|
||||
dis(j, i) = v(upgrid(i));
|
||||
end
|
||||
end
|
||||
fill3(x,y,z,dis,'edgeColor','interp');
|
||||
set(gca,'FontName','Times New Roman','FontSize',10,'FontWeight','bold');
|
||||
xlabel('X, m');
|
||||
ylabel('Y, m');
|
||||
zlabel('Z, m');
|
||||
view(2);
|
||||
% fill(x,y,dis);
|
||||
axis equal
|
||||
% axis off
|
||||
axis tight
|
||||
@@ -0,0 +1,48 @@
|
||||
function plot_layer(i, k, r, OutputRs, type)
|
||||
coordinate=r.coordinates;
|
||||
nodes=r.nodes;
|
||||
nz=r.nz;
|
||||
nx=r.nx
|
||||
nmc = size(nodes,1);
|
||||
% nel = size(nodes,2);
|
||||
nel = 4;
|
||||
if type == 1
|
||||
% v = r.kx;
|
||||
v = OutputRs{i}.p;
|
||||
else
|
||||
v = 1-OutputRs{i}.sw;%含气饱和度
|
||||
end
|
||||
dis = zeros(nel, nmc);
|
||||
x = zeros(nel, nmc);
|
||||
y = zeros(nel, nmc);
|
||||
for i = 1 :nmc
|
||||
for j = 1 :nel
|
||||
x(j, i) = coordinate(nodes(i,j), 1);
|
||||
y(j, i) = coordinate(nodes(i,j), 2);
|
||||
if j == 3
|
||||
x(j, i) = coordinate(nodes(i,4), 1);
|
||||
y(j, i) = coordinate(nodes(i,4), 2);
|
||||
end
|
||||
if j == 4
|
||||
x(j, i) = coordinate(nodes(i,3), 1);
|
||||
y(j, i) = coordinate(nodes(i,3), 2);
|
||||
end
|
||||
dis(j, i) = v(i);
|
||||
end
|
||||
end
|
||||
% fill(x,y,dis,'EdgeAlpha',1);
|
||||
figure('color','w');
|
||||
fill(x,y,dis,'EdgeColor','interp');
|
||||
xlabel('x, m','FontSize',14);
|
||||
ylabel('y, m','FontSize',14);
|
||||
ax = gca;
|
||||
ax.FontSize = 14;
|
||||
axis equal;
|
||||
axis tight
|
||||
% xlim([0,60]);
|
||||
% ylim([0,60]);
|
||||
% clim([10,15]);
|
||||
colorbar
|
||||
colormap jet
|
||||
% fill(x,y,dis);
|
||||
% axis off
|
||||
@@ -0,0 +1,49 @@
|
||||
function plot_layer(i, k, r, OutputRs, type)
|
||||
coordinate=r.coordinates;
|
||||
nodes=r.nodes;
|
||||
nz=r.nz;
|
||||
nx=r.nx;
|
||||
ny=r.ny;
|
||||
nmc = size(nodes,1);
|
||||
% nel = size(nodes,2);
|
||||
nel = 4;
|
||||
if type == 1
|
||||
% v = r.kx;
|
||||
v = OutputRs{i}.p;
|
||||
else
|
||||
v = 1-OutputRs{i}.sw;%º¬Æø±¥ºÍ¶È
|
||||
end
|
||||
dis = zeros(nel, nmc);
|
||||
x = zeros(nel, nmc);
|
||||
y = zeros(nel, nmc);
|
||||
for i = 1 :nmc
|
||||
for j = 1 :nel
|
||||
x(j, i) = coordinate(nodes(i,j), 1);
|
||||
y(j, i) = coordinate(nodes(i,j), 2);
|
||||
if j == 3
|
||||
x(j, i) = coordinate(nodes(i,4), 1);
|
||||
y(j, i) = coordinate(nodes(i,4), 2);
|
||||
end
|
||||
if j == 4
|
||||
x(j, i) = coordinate(nodes(i,3), 1);
|
||||
y(j, i) = coordinate(nodes(i,3), 2);
|
||||
end
|
||||
dis(j, i) = v(i+(nz-k)*nx*ny);
|
||||
end
|
||||
end
|
||||
% fill(x,y,dis,'EdgeAlpha',1);
|
||||
figure('color','w');
|
||||
fill(x,y,dis,'EdgeColor','interp');
|
||||
xlabel('x, m','FontSize',14);
|
||||
ylabel('y, m','FontSize',14);
|
||||
ax = gca;
|
||||
ax.FontSize = 14;
|
||||
axis equal;
|
||||
axis tight
|
||||
% xlim([0,60]);
|
||||
% ylim([0,60]);
|
||||
% clim([10,15]);
|
||||
colorbar
|
||||
colormap jet
|
||||
% fill(x,y,dis);
|
||||
% axis off
|
||||
@@ -0,0 +1,44 @@
|
||||
function [ ] = plot_reservoir_3D(dx,dy,dz,nx,ny,nz )
|
||||
%UNTITLED 此处显示有关此函数的摘要
|
||||
% 此处显示详细说明
|
||||
%figure
|
||||
% 绘制x-y平面
|
||||
for i=1:(nz+1)
|
||||
% if i ==nz+1
|
||||
face=[0,0,(i-1)*dz;nx*dx,0,(i-1)*dz;nx*dx,ny*dy,(i-1)*dz;0,ny*dy,(i-1)*dz];
|
||||
% fill3(face(:,1),face(:,2),face(:,3),[0.5,0.5,0.5]);
|
||||
fill3(face(:,1),face(:,2),face(:,3),'w');
|
||||
% end
|
||||
|
||||
hold on
|
||||
end
|
||||
% [0.5,0.5,0.5]
|
||||
|
||||
% 绘制x-z平面
|
||||
for i=1:(ny+1)
|
||||
% if i == 1
|
||||
face=[0,(i-1)*dy,0;nx*dx,(i-1)*dy,0;nx*dx,(i-1)*dy,nz*dz;0,(i-1)*dy,nz*dz];
|
||||
% fill3(face(:,1),face(:,2),face(:,3),[0.5,0.5,0.5]);
|
||||
fill3(face(:,1),face(:,2),face(:,3),'w');
|
||||
% end
|
||||
hold on
|
||||
end
|
||||
|
||||
% 绘制y-z平面
|
||||
for i=1:(nx+1)
|
||||
% if i == 1
|
||||
face=[(i-1)*dx,0,0;(i-1)*dx,ny*dy,0;(i-1)*dx,ny*dy,nz*dz;(i-1)*dx,0,nz*dz;];
|
||||
% fill3(face(:,1),face(:,2),face(:,3),[0.5,0.5,0.5]);
|
||||
fill3(face(:,1),face(:,2),face(:,3),'w');
|
||||
% end
|
||||
hold on
|
||||
end
|
||||
|
||||
xlabel('x,m');
|
||||
ylabel('y,m');
|
||||
zlabel('z,m');
|
||||
alpha(1);
|
||||
hold on;
|
||||
view(3)
|
||||
end
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
function [ ] = plotcp( Times,Times2,Wellpara,Wellpara2 )
|
||||
%PLOTCP 此处显示有关此函数的摘要
|
||||
% 此处显示详细说明
|
||||
t = Times;
|
||||
n=size(Times,1);
|
||||
% para = cell2mat(Wellpara);
|
||||
nw=1;%选井号
|
||||
% n = length(para);
|
||||
bhp = zeros(n,1);
|
||||
for i = 1 : n
|
||||
% bhp(i) = para(i).bhp(2);
|
||||
bhp(i) = Wellpara{i}{1,nw}.qo;
|
||||
% bhp(i) = Wellpara{i}{1,nw}.qw;
|
||||
% bhp(i) = Wellpara{i}{1,nw}.pwf;
|
||||
end
|
||||
plot(t,bhp,'r*-');
|
||||
|
||||
hold on
|
||||
t = Times2;
|
||||
n=size(Times2,1);
|
||||
% para = cell2mat(Wellpara);
|
||||
nw=1;%选井号
|
||||
% n = length(para);
|
||||
bhp = zeros(n,1);
|
||||
for i = 1 : n
|
||||
% bhp(i) = para(i).bhp(2);
|
||||
% bhp(i) = Wellpara2{i}{1,nw}.qo;
|
||||
bhp(i) = Wellpara2(i);
|
||||
% bhp(i) = Wellpara{i}{1,nw}.qw;
|
||||
% bhp(i) = Wellpara{i}{1,nw}.pwf;
|
||||
end
|
||||
plot(t,bhp,'bo-');
|
||||
|
||||
hold off
|
||||
|
||||
end
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
function [ ] = plotframe( r )
|
||||
%PLOTFRAME 此处显示有关此函数的摘要
|
||||
% 此处显示详细说明
|
||||
xe=1000;ye=500;ze=10;
|
||||
network3D(xe,ye,ze,1,1,1 );
|
||||
% f1=[335,445,0;
|
||||
% 335,445,10;
|
||||
% 335,555,10;
|
||||
% 335,555,0;
|
||||
% 335,455,0;];
|
||||
% plot3(f1(:,1),f1(:,2),f1(:,3));
|
||||
%
|
||||
% f2=[445,445,0;
|
||||
% 445,445,10;
|
||||
% 445,555,10;
|
||||
% 445,555,0
|
||||
% 445,445,0;];
|
||||
% plot3(f2(:,1),f2(:,2),f2(:,3));
|
||||
%
|
||||
% f3=[555,445,0;
|
||||
% 555,445,10;
|
||||
% 555,550,10;
|
||||
% 555,550,0
|
||||
% 555,445,0;];
|
||||
% plot3(f3(:,1),f3(:,2),f3(:,3));
|
||||
%
|
||||
% f4=[665,445,0;
|
||||
% 665,445,10;
|
||||
% 665,555,10;
|
||||
% 665,555,0
|
||||
% 665,445,0;];
|
||||
% plot3(f4(:,1),f4(:,2),f4(:,3));
|
||||
|
||||
% hold off
|
||||
|
||||
end
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
|
||||
%PLOTGRAPH 此处显示有关此函数的摘要
|
||||
% 此处显示详细说明
|
||||
% set(gca,'FontName','Times New Roman','FontSize',10,'FontWeight','bold');
|
||||
subplot(1,2,1)
|
||||
plotDislayer_new(15, 1 ,r,OutputRs, 1);
|
||||
% caxis([10,30]);
|
||||
title('Layer 1 in the 50th day','FontName','Times New Roman','FontSize',10,'FontWeight','bold');
|
||||
set(gca,'FontName','Times New Roman','FontSize',10,'FontWeight','bold');
|
||||
|
||||
axis equal
|
||||
axis tight
|
||||
% set(gca,'ztick',[0 30])
|
||||
% set(gca,'zticklabel',{'0' '30'})
|
||||
% xlabel('Layer 1 in the 50th day');
|
||||
% subplot(2,2,2)
|
||||
% plotDislayer_new(15, 2 ,r,OutputRs, 1);
|
||||
% caxis([10,20]);
|
||||
% title('Layer 2 in the 50th day','FontName','Times New Roman','FontSize',10,'FontWeight','bold');
|
||||
% set(gca,'FontName','Times New Roman','FontSize',10,'FontWeight','bold');
|
||||
% axis equal
|
||||
% axis tight
|
||||
% set(gca,'ztick',[0 30])
|
||||
% set(gca,'zticklabel',{'0' '30'})
|
||||
% xlabel('Layer 2 in the 50th day');
|
||||
% subplot(2,2,3)
|
||||
% plotDislayer_new(15, 3 ,r,OutputRs, 1);
|
||||
% caxis([10,20]);
|
||||
% title('Layer 3 in the 50th day','FontName','Times New Roman','FontSize',10,'FontWeight','bold');
|
||||
% set(gca,'FontName','Times New Roman','FontSize',10,'FontWeight','bold');
|
||||
% axis equal
|
||||
% axis tight
|
||||
% set(gca,'ztick',[0 30])
|
||||
% set(gca,'zticklabel',{'0' '30'})
|
||||
% xlabel('Layer 3 in the 50th day');
|
||||
subplot(1,2,2)
|
||||
plotDis_new(15 ,r,OutputRs, 1);
|
||||
% caxis([10,30]);
|
||||
% xlabel('3D reservoir in the 50th day');
|
||||
title('3D reservoir in the 50th day','FontName','Times New Roman','FontSize',10,'FontWeight','bold');
|
||||
set(gca,'FontName','Times New Roman','FontSize',10,'FontWeight','bold');
|
||||
axis equal
|
||||
axis tight
|
||||
% set(gca,'ztick',[0 30])
|
||||
% set(gca,'zticklabel',{'0' '30'})
|
||||
% colorbar('SouthOutside');
|
||||
colorbar('position',[0.93 0.3 0.03 0.4]);
|
||||
% subplot(1,2,1)
|
||||
% plotDislayer_new(9, 1 ,r,OutputRs, 1);
|
||||
% subplot(1,2,2)
|
||||
% plotDislayer_new(9, 2 ,r,OutputRs, 1);
|
||||
% subplot(2,4,5)
|
||||
% plotDislayer_new(31, 1 ,r,OutputRs, 1);
|
||||
% subplot(2,4,6)
|
||||
% plotDislayer_new(31, 2 ,r,OutputRs, 1);
|
||||
% subplot(2,4,7)
|
||||
% plotDislayer_new(31, 3 ,r,OutputRs, 1);
|
||||
% subplot(2,4,8)
|
||||
% plotDis_new(31 ,r,OutputRs, 1);
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
t = Times;
|
||||
n=size(Times,1);
|
||||
% para = cell2mat(Wellpara);
|
||||
nw= 1;%Ñ¡¾®ºÅ
|
||||
% n = length(para);
|
||||
bhp = zeros(n,1);
|
||||
for i = 1 : n
|
||||
% bhp(i) = para(i).bhp(2);
|
||||
% bhp(i) = Wellpara{i}{1,nw}.pwf;
|
||||
bhp(i) = Wellpara{i}{1,nw}.qo;
|
||||
% bhp(i) = Wellpara{i}{1,nw}.pwf;
|
||||
% bhp(i) = Wellpara{i}{1,nw}.qw/(Wellpara{i}{1,nw}.qw+Wellpara{i}{1,nw}.qo);
|
||||
end
|
||||
plot(t,bhp,'b^-')
|
||||
hold off
|
||||
% ylim([0,200]);
|
||||
xlabel('time, day');
|
||||
% ylabel('water cut');
|
||||
ylabel('oil production rate, m^3/d');
|
||||
@@ -0,0 +1,130 @@
|
||||
|
||||
n=size(Times,1);
|
||||
t = Times;
|
||||
% para = cell2mat(Wellpara);
|
||||
total_oil=sum(r.V.*r.pori)*0.85/1.056;
|
||||
total_water=sum(r.V.*r.pori)*0.15/1.056;
|
||||
|
||||
nw=1;%选井号
|
||||
% n = length(para);
|
||||
Qo = zeros(n,1);
|
||||
Qw = zeros(n,1);
|
||||
% Qg = zeros(n,1);
|
||||
water_content = zeros(n,1);
|
||||
Pwf = zeros(n,1);
|
||||
accumu_quan_oil = 0;
|
||||
% 累计采出量
|
||||
accumu_oil = zeros(n,1);
|
||||
% 采出程度
|
||||
proportion_oil = zeros(n,1);
|
||||
% 平均地层压力
|
||||
average_pressure = zeros(n,1);
|
||||
|
||||
for i = 1 : n
|
||||
Qo(i) = Wellpara{i}{1,nw}.qo;
|
||||
Qw(i) = Wellpara{i}{1,nw}.qw;
|
||||
water_content(i) = Qw(i)/(Qo(i)+Qw(i));
|
||||
Pwf(i) = Wellpara{i}{1,nw}.pwf;
|
||||
if i==1
|
||||
one_time_oil=Times(i)*Qo(i);
|
||||
one_time_water=Times(i)*Qw(i);
|
||||
accumu_oil(i)=one_time_oil;
|
||||
accumu_water(i)=one_time_water;
|
||||
else
|
||||
one_time_oil=(Times(i)-Times(i-1))*Qo(i);
|
||||
accumu_oil(i)=accumu_oil(i-1)+one_time_oil;
|
||||
one_time_water=(Times(i)-Times(i-1))*Qw(i);
|
||||
accumu_water(i)=accumu_water(i-1)+one_time_water;
|
||||
end
|
||||
proportion_oil(i)=accumu_oil(i)/total_oil;
|
||||
proportion_water(i)=accumu_water(i)/total_water;
|
||||
average_pressure(i)=mean(OutputRs{i,1}.p(1:r.nmc));
|
||||
end
|
||||
%% 绘制前处理
|
||||
t=t/1;
|
||||
%% 绘制日产油量和累积产油量
|
||||
% color('w');
|
||||
figure('color','w')
|
||||
% figure(1)
|
||||
[AX,H1,H2]=plotyy(t,Qo,t,accumu_oil);
|
||||
% [AX,H1,H2] = plotyy(24,0,0,0,'plot');
|
||||
set(AX(1),'XColor','k','YColor','b');
|
||||
set(AX(2),'XColor','k','YColor','r');
|
||||
set(get(AX(1),'Ylabel'),'String','日产油量/m^3')
|
||||
set(get(AX(2),'Ylabel'),'String','累积产油量/m^3')
|
||||
set(H1,'LineStyle','-');
|
||||
set(H1,'Marker','o');set(H1,'MarkerSize',4);
|
||||
set(H1,'color','b');
|
||||
set(H2,'LineStyle','-');
|
||||
set(H2,'Marker','^');set(H2,'MarkerSize',4);
|
||||
set(H2,'color','r');
|
||||
legend([H1,H2],{'日产油量';'累积产油量'},'Location','Best');
|
||||
set(AX(1),'ylim',[0 500])
|
||||
% set(AX(2),'ylim',[0 600])
|
||||
% set(AX(1),'ytick',50:50:250)
|
||||
% set(AX(2),'ytick',0:100:600)
|
||||
% set(AX,'xlim',[0 30])
|
||||
% set(AX,'xtick',0:5:30)
|
||||
% grid on
|
||||
xlabel('生产时间/年')
|
||||
% title('日产油量和累积产油量');
|
||||
%% 绘制日产水量和累积产水量
|
||||
% color('w');
|
||||
figure('color','w')
|
||||
% figure(1)
|
||||
[AX,H1,H2]=plotyy(t,Qw,t,accumu_water);
|
||||
% [AX,H1,H2] = plotyy(24,0,0,0,'plot');
|
||||
set(AX(1),'XColor','k','YColor','b');
|
||||
set(AX(2),'XColor','k','YColor','r');
|
||||
set(get(AX(1),'Ylabel'),'String','日产水量/m^3')
|
||||
set(get(AX(2),'Ylabel'),'String','累积产水量/m^3')
|
||||
set(H1,'LineStyle','-');
|
||||
set(H1,'Marker','o');set(H1,'MarkerSize',4);
|
||||
set(H1,'color','b');
|
||||
set(H2,'LineStyle','-');
|
||||
set(H2,'Marker','^');set(H2,'MarkerSize',4);
|
||||
set(H2,'color','r');
|
||||
legend([H1,H2],{'日产水量';'累积产水量'},'Location','Best');
|
||||
% set(AX(1),'ylim',[50 250])
|
||||
% set(AX(2),'ylim',[0 600])
|
||||
% set(AX(1),'ytick',50:50:250)
|
||||
% set(AX(2),'ytick',0:100:600)
|
||||
% set(AX,'xlim',[0 30])
|
||||
% set(AX,'xtick',0:5:30)
|
||||
% grid on
|
||||
xlabel('生产时间/年')
|
||||
% title('日产水量和累积产水量');
|
||||
%% 绘制平均地层压力和采出程度
|
||||
% color('w');
|
||||
figure('color','w')
|
||||
% figure(1)
|
||||
[AX,H1,H2]=plotyy(t,average_pressure,t,proportion_oil*100);
|
||||
% [AX,H1,H2] = plotyy(24,0,0,0,'plot');
|
||||
set(AX(1),'XColor','k','YColor','b');
|
||||
set(AX(2),'XColor','k','YColor','r');
|
||||
set(get(AX(1),'Ylabel'),'String','平均地层压力/MPa')
|
||||
set(get(AX(2),'Ylabel'),'String','采出程度/%')
|
||||
set(H1,'LineStyle','-');
|
||||
set(H1,'Marker','o');set(H1,'MarkerSize',4);
|
||||
set(H1,'color','b');
|
||||
set(H2,'LineStyle','-');
|
||||
set(H2,'Marker','^');set(H2,'MarkerSize',4);
|
||||
set(H2,'color','r');
|
||||
legend([H1,H2],{'平均地层压力';'采出程度'},'Location','Best');
|
||||
% set(AX(1),'ylim',[50 250])
|
||||
% set(AX(2),'ylim',[0 600])
|
||||
% set(AX(1),'ytick',50:50:250)
|
||||
% set(AX(2),'ytick',0:100:600)
|
||||
% set(AX,'xlim',[0 30])
|
||||
% set(AX,'xtick',0:5:30)
|
||||
% grid on
|
||||
xlabel('生产时间/天')
|
||||
% title('日产油量和累积产油量');
|
||||
%% 绘制含水率
|
||||
figure('color','w')
|
||||
plot(t,water_content);
|
||||
set(get(gca,'Xlabel'),'String','生产时间/天')
|
||||
xlabel('生产时间/天')
|
||||
ylabel('含水率')
|
||||
% hold on
|
||||
% plot(ECLIPSE(:,1),ECLIPSE(:,2),'B');
|
||||
@@ -0,0 +1,64 @@
|
||||
% network3D(2060,1580,10,1,1,3 );
|
||||
%REFINE 此处显示有关此函数的摘要
|
||||
% 此处显示详细说明
|
||||
% % % well=cell(4,1);
|
||||
% % % load('perforation1.mat');welloc1 = [perforation1, 7.5*ones(size(perforation1,1),1)];
|
||||
% % % load('perforation2.mat');welloc2 = [perforation2, 7.5*ones(size(perforation2,1),1)];
|
||||
% % % load('perforation3.mat');welloc3 = [perforation3, 7.5*ones(size(perforation3,1),1)];
|
||||
% % % load('perforation4.mat');welloc4 = [perforation4, 7.5*ones(size(perforation4,1),1)];
|
||||
% % % well{1,1} = welloc1;
|
||||
% % % well{2,1} = welloc2;
|
||||
% % % well{3,1} = welloc3;
|
||||
% % % well{4,1} = welloc4;
|
||||
% % %
|
||||
% % % for i=1:4
|
||||
% % % line(well{i,1}(:,1)',well{i,1}(:,2)',well{i,1}(:,3)','color','k','LineWidth',2);
|
||||
% % % hold on
|
||||
% % % end
|
||||
|
||||
% load('injectionWellsCoord.mat')
|
||||
% injectionWellsCoord = [45,45;
|
||||
% 655,45;
|
||||
% 45,625;
|
||||
% 655,625;];
|
||||
% for i=1:size(injectionWellsCoord,1)
|
||||
% line(injectionWellsCoord(i,1)*ones(2,1),injectionWellsCoord(i,2)*ones(2,1),[0;20],'color','k','LineWidth',2);
|
||||
% hold on
|
||||
% text(injectionWellsCoord(i,1),injectionWellsCoord(i,2),20,'注水井','FontSize',12,'FontWeight','bold');
|
||||
% hold on
|
||||
% end
|
||||
|
||||
% wellbore
|
||||
% wellbore = [250+100,100+100,46;
|
||||
% 550+100,100+1700,46];
|
||||
% % wellbore = [50,352,10;
|
||||
% % 950,352,10;];
|
||||
% plot3(wellbore(:,1),wellbore(:,2),wellbore(:,3),'color','k','LineWidth',2.5);
|
||||
|
||||
% wellbore = [450,520,10;
|
||||
% 450,1420,10;];
|
||||
% % wellbore = [50,352,10;
|
||||
% % 950,352,10;];
|
||||
% plot3(wellbore(:,1),wellbore(:,2),wellbore(:,3),'color','k','LineWidth',2.5);
|
||||
hold on
|
||||
% wellbore = [1175,370,10;
|
||||
% 1175,1170,10;];
|
||||
% % wellbore = [50,352,10;
|
||||
% % 950,352,10;];
|
||||
% plot3(wellbore(:,1),wellbore(:,2),wellbore(:,3),'color','k','LineWidth',2.5);
|
||||
% text(wellbore(1,1),wellbore(1,2),10,'压裂水平井','FontSize',12,'FontWeight','bold');
|
||||
hold on
|
||||
% hwell=cell(1,1);
|
||||
% hwell{1,1}=[385,1300,15;
|
||||
% 385,400,15;];
|
||||
% hwell{2,1}=[955,1330,15;
|
||||
% 955,330,15;];
|
||||
% hwell{3,1}=[1635,1275,15;
|
||||
% 1635,580,15;];
|
||||
% for i=1:3
|
||||
% line(hwell{i,1}(:,1)',hwell{i,1}(:,2)',hwell{i,1}(:,3)','color','k');
|
||||
% hold on
|
||||
% end
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
function [] = plotWellResponse(Times,Wellpara)
|
||||
% 输入
|
||||
wellNumber = 1; % 井号
|
||||
dataType = 'dPWF'; % 类型,产气速度 GPR,产气速度 OPR, 产水速度 WPR,井底流压 BHP,压力导数 dPWF
|
||||
%
|
||||
t = Times;
|
||||
n= size(Times,1);
|
||||
% para = cell2mat(Wellpara);
|
||||
nw = wellNumber;%选井号
|
||||
% n = length(para);
|
||||
data = zeros(n,1);
|
||||
if strcmp(dataType, 'GPR')
|
||||
for i = 1 : n
|
||||
data(i) = Wellpara{i}{1,nw}.qg;
|
||||
figureYlegend = 'Gas production rate, m^3/d';
|
||||
end
|
||||
plot(t,data,'k^-');hold off; xlabel('Time, day');ylabel(figureYlegend);
|
||||
end
|
||||
if strcmp(dataType, 'OPR')
|
||||
for i = 1 : n
|
||||
data(i) = Wellpara{i}{1,nw}.qo;
|
||||
figureYlegend = 'Oil production rate, m^3/d';
|
||||
end
|
||||
plot(t,data,'k^-');hold off; xlabel('Time, day');ylabel(figureYlegend);
|
||||
end
|
||||
if strcmp(dataType, 'WPR')
|
||||
for i = 1 : n
|
||||
data(i) = Wellpara{i}{1,nw}.qw;
|
||||
figureYlegend = 'Water production rate, m^3/d';
|
||||
end
|
||||
plot(t,data,'k^-');hold off; xlabel('Time, day');ylabel(figureYlegend);
|
||||
end
|
||||
if strcmp(dataType, 'BHP')
|
||||
for i = 1 : n
|
||||
data(i) = Wellpara{i}{1,nw}.pwf;
|
||||
figureYlegend = 'BHP, MPa';
|
||||
end
|
||||
plot(t,data,'k^-');hold off; xlabel('Time, day');ylabel(figureYlegend);
|
||||
end
|
||||
if strcmp(dataType, 'dPWF') % dpwf/dlnt = t*dpwf/dt
|
||||
for i = 1 : n
|
||||
if i == 1
|
||||
data(i) = (Wellpara{i+1}{1,nw}.pwf-Wellpara{i}{1,nw}.pwf)/(log(t(i+1))-log(t(i)));
|
||||
elseif i == n
|
||||
data(i) = (Wellpara{i}{1,nw}.pwf-Wellpara{i-1}{1,nw}.pwf)/(log(t(i))-log(t(i-1)));
|
||||
else
|
||||
data(i) = (Wellpara{i+1}{1,nw}.pwf-Wellpara{i-1}{1,nw}.pwf)/(log(t(i+1))-log(t(i-1)));
|
||||
end
|
||||
figureYlegend = 'Pressure derivative, MPa';
|
||||
end
|
||||
plot(t,data,'k^-');hold off; xlabel('Time, day');ylabel(figureYlegend);
|
||||
set(gca, 'XScale', 'log');
|
||||
set(gca, 'YScale', 'log');
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,50 @@
|
||||
function plot_2D_layer(i, k, r, OutputRs, type)
|
||||
coordinate=r.coordinates;
|
||||
nodes=r.nodes;
|
||||
nz=r.nz;
|
||||
nx=r.nx;
|
||||
ny=r.ny;
|
||||
nmc = size(nodes,1);
|
||||
% nel = size(nodes,2);
|
||||
nel = 4;
|
||||
if type == 1
|
||||
% v = r.kx;
|
||||
v = OutputRs{i}.p;
|
||||
else
|
||||
v = 1-OutputRs{i}.sw;%º¬Æø±¥ºÍ¶È
|
||||
end
|
||||
dis = zeros(nel, nx*ny);
|
||||
x = zeros(nel, nx*ny);
|
||||
y = zeros(nel, nx*ny);
|
||||
for i = 1 :nx*ny
|
||||
for j = 1 :nel
|
||||
grid_numbering = i+(nz-k)*nx*ny;
|
||||
x(j, i) = coordinate(nodes(grid_numbering,j), 1);
|
||||
y(j, i) = coordinate(nodes(grid_numbering,j), 2);
|
||||
if j == 3
|
||||
x(j, i) = coordinate(nodes(grid_numbering,4), 1);
|
||||
y(j, i) = coordinate(nodes(grid_numbering,4), 2);
|
||||
end
|
||||
if j == 4
|
||||
x(j, i) = coordinate(nodes(grid_numbering,3), 1);
|
||||
y(j, i) = coordinate(nodes(grid_numbering,3), 2);
|
||||
end
|
||||
dis(j, i) = v(grid_numbering);
|
||||
end
|
||||
end
|
||||
% fill(x,y,dis,'EdgeAlpha',1);
|
||||
figure('color','w');
|
||||
fill(x,y,dis,'EdgeColor','interp');
|
||||
xlabel('x, m','FontSize',14);
|
||||
ylabel('y, m','FontSize',14);
|
||||
ax = gca;
|
||||
ax.FontSize = 14;
|
||||
axis equal;
|
||||
axis tight
|
||||
% xlim([0,60]);
|
||||
% ylim([0,60]);
|
||||
% clim([10,15]);
|
||||
colorbar
|
||||
colormap jet
|
||||
% fill(x,y,dis);
|
||||
% axis off
|
||||
@@ -0,0 +1,70 @@
|
||||
% 主程序示例
|
||||
clear; clc; close all;
|
||||
|
||||
% 设置网格参数
|
||||
nx = 20;
|
||||
ny = 15;
|
||||
nz = 10;
|
||||
|
||||
% 生成非均匀网格尺寸
|
||||
dx = linspace(0.5, 1.5, nx)'; % x方向网格尺寸从0.5到1.5变化
|
||||
dy = linspace(0.8, 1.2, ny)'; % y方向网格尺寸从0.8到1.2变化
|
||||
dz = ones(nz, 1) * 1.0; % z方向均匀网格
|
||||
|
||||
% 生成示例数据(例如:三维高斯分布)
|
||||
x_center = sum(dx)/2; % 中心位置
|
||||
y_center = sum(dy)/2;
|
||||
z_center = sum(dz)/2;
|
||||
|
||||
% 计算每个网格点的坐标
|
||||
x_pos = zeros(nx, 1);
|
||||
x_pos(1) = dx(1)/2;
|
||||
for i = 2:nx
|
||||
x_pos(i) = x_pos(i-1) + (dx(i-1) + dx(i))/2;
|
||||
end
|
||||
|
||||
y_pos = zeros(ny, 1);
|
||||
y_pos(1) = dy(1)/2;
|
||||
for i = 2:ny
|
||||
y_pos(i) = y_pos(i-1) + (dy(i-1) + dy(i))/2;
|
||||
end
|
||||
|
||||
z_pos = zeros(nz, 1);
|
||||
z_pos(1) = dz(1)/2;
|
||||
for i = 2:nz
|
||||
z_pos(i) = z_pos(i-1) + (dz(i-1) + dz(i))/2;
|
||||
end
|
||||
|
||||
% 创建网格坐标
|
||||
[X, Y, Z] = ndgrid(x_pos, y_pos, z_pos);
|
||||
|
||||
% 生成示例物理量数据(三维高斯分布)
|
||||
sigma_x = max(x_pos)/3;
|
||||
sigma_y = max(y_pos)/3;
|
||||
sigma_z = max(z_pos)/3;
|
||||
data = exp(-((X - x_center).^2/(2*sigma_x^2) + ...
|
||||
(Y - y_center).^2/(2*sigma_y^2) + ...
|
||||
(Z - z_center).^2/(2*sigma_z^2)));
|
||||
|
||||
% 绘制不同类型的图
|
||||
% plot_3d_grid_data_slice(nx, ny, nz, dx, dy, dz, data);
|
||||
% plot_3d_grid_data_scatter(nx, ny, nz, dx, dy, dz, data);
|
||||
% plot_3d_grid_data_volume(nx, ny, nz, dx, dy, dz, data);
|
||||
% 方法1:基本体素图
|
||||
fprintf('绘制方法1:基本体素图...\n');
|
||||
plot_3d_grid_voxel_full(nx, ny, nz, dx, dy, dz, data);
|
||||
title('方法1:基本体素图 - 高斯分布');
|
||||
|
||||
% 方法2:优化版本
|
||||
fprintf('绘制方法2:优化版本...\n');
|
||||
plot_3d_grid_patch_optimized(nx, ny, nz, dx, dy, dz, data);
|
||||
title('方法2:优化版本 - 球壳分布');
|
||||
|
||||
% 方法3:体素函数法
|
||||
fprintf('绘制方法3:体素函数法...\n');
|
||||
plot_3d_grid_voxel_function(nx, ny, nz, dx, dy, dz, data);
|
||||
title('方法3:体素函数法 - 波纹分布');
|
||||
|
||||
% 方法4:半透明效果
|
||||
fprintf('绘制方法4:半透明效果...\n');
|
||||
plot_3d_grid_transparent(nx, ny, nz, dx, dy, dz, data);
|
||||
@@ -0,0 +1,144 @@
|
||||
function plot_3D_dis(i, r,OutputRs, type)
|
||||
%为便于作图进行前处理
|
||||
figure('color','w')
|
||||
[ downgrid, frontgrid ,leftgrid, rightgrid, backgrid, upgrid ] = preplot_dis( r );
|
||||
coordinate=r.coordinates;
|
||||
nodes=r.nodes;
|
||||
% nmc = size(nodes,1);%基质网格数量
|
||||
% % nel = size(nodes,2);%每个基质网格所包含的点数量
|
||||
% order=[1,2,4,3,1,5,6,8,7,3,4,8,6,2,1];%用以fill函数作图
|
||||
% nel=size(order,2);
|
||||
if type == 1
|
||||
v = OutputRs{i}.p;
|
||||
elseif type == 2
|
||||
v = 1-OutputRs{i}.sw;%含油饱和度
|
||||
elseif type == 3
|
||||
v = OutputRs{i}.sg;%含油饱和度
|
||||
else
|
||||
v = OutputRs{i}.sw;%含油饱和度
|
||||
end
|
||||
% 底面
|
||||
order=[1,2,4,3,1];
|
||||
nel=size(order,2);
|
||||
nmc=size(downgrid,2);
|
||||
dis = zeros(nel, nmc);
|
||||
x = zeros(nel, nmc);
|
||||
y = zeros(nel, nmc);
|
||||
z = zeros(nel, nmc);
|
||||
for i = 1 : nmc
|
||||
for j = 1 : nel
|
||||
x(j, i) = coordinate(nodes(downgrid(i),order(j)), 1);
|
||||
y(j, i) = coordinate(nodes(downgrid(i),order(j)), 2);
|
||||
z(j, i) = coordinate(nodes(downgrid(i),order(j)), 3)-max(coordinate(:,3))-2000;
|
||||
dis(j, i) = v(downgrid(i));
|
||||
end
|
||||
end
|
||||
fill3(x,y,z,dis,'edgeColor','interp');
|
||||
hold on
|
||||
|
||||
%左面
|
||||
order=[1,5,7,3,1];
|
||||
nel=size(order,2);
|
||||
nmc=size(leftgrid,2);
|
||||
dis = zeros(nel, nmc);
|
||||
x = zeros(nel, nmc);
|
||||
y = zeros(nel, nmc);
|
||||
z = zeros(nel, nmc);
|
||||
for i = 1 : nmc
|
||||
for j = 1 : nel
|
||||
x(j, i) = coordinate(nodes(leftgrid(i),order(j)), 1);
|
||||
y(j, i) = coordinate(nodes(leftgrid(i),order(j)), 2);
|
||||
z(j, i) = coordinate(nodes(leftgrid(i),order(j)), 3)-max(coordinate(:,3))-2000;
|
||||
dis(j, i) = v(leftgrid(i));
|
||||
end
|
||||
end
|
||||
fill3(x,y,z,dis,'edgeColor','interp');
|
||||
|
||||
%右面
|
||||
order=[2,4,8,6,2];
|
||||
nel=size(order,2);
|
||||
nmc=size(rightgrid,2);
|
||||
dis = zeros(nel, nmc);
|
||||
x = zeros(nel, nmc);
|
||||
y = zeros(nel, nmc);
|
||||
z = zeros(nel, nmc);
|
||||
for i = 1 : nmc
|
||||
for j = 1 : nel
|
||||
x(j, i) = coordinate(nodes(rightgrid(i),order(j)), 1);
|
||||
y(j, i) = coordinate(nodes(rightgrid(i),order(j)), 2);
|
||||
z(j, i) = coordinate(nodes(rightgrid(i),order(j)), 3)-max(coordinate(:,3))-2000;
|
||||
dis(j, i) = v(rightgrid(i));
|
||||
end
|
||||
end
|
||||
fill3(x,y,z,dis,'edgeColor','interp');
|
||||
|
||||
%前面
|
||||
order=[1,2,6,5,1];
|
||||
nel=size(order,2);
|
||||
nmc=size(frontgrid,2);
|
||||
dis = zeros(nel, nmc);
|
||||
x = zeros(nel, nmc);
|
||||
y = zeros(nel, nmc);
|
||||
z = zeros(nel, nmc);
|
||||
for i = 1 : nmc
|
||||
for j = 1 : nel
|
||||
x(j, i) = coordinate(nodes(frontgrid(i),order(j)), 1);
|
||||
y(j, i) = coordinate(nodes(frontgrid(i),order(j)), 2);
|
||||
z(j, i) = coordinate(nodes(frontgrid(i),order(j)), 3)-max(coordinate(:,3))-2000;
|
||||
dis(j, i) = v(frontgrid(i));
|
||||
end
|
||||
end
|
||||
fill3(x,y,z,dis,'edgeColor','interp');
|
||||
|
||||
%后面
|
||||
order=[3,4,8,7,3];
|
||||
nel=size(order,2);
|
||||
nmc=size(backgrid,2);
|
||||
dis = zeros(nel, nmc);
|
||||
x = zeros(nel, nmc);
|
||||
y = zeros(nel, nmc);
|
||||
z = zeros(nel, nmc);
|
||||
for i = 1 : nmc
|
||||
for j = 1 : nel
|
||||
x(j, i) = coordinate(nodes(backgrid(i),order(j)), 1);
|
||||
y(j, i) = coordinate(nodes(backgrid(i),order(j)), 2);
|
||||
z(j, i) = coordinate(nodes(backgrid(i),order(j)), 3)-max(coordinate(:,3))-2000;
|
||||
dis(j, i) = v(backgrid(i));
|
||||
end
|
||||
end
|
||||
fill3(x,y,z,dis,'edgeColor','interp');
|
||||
|
||||
%上面
|
||||
order=[5,6,8,7,5];
|
||||
nel=size(order,2);
|
||||
nmc=size(upgrid,2);
|
||||
dis = zeros(nel, nmc);
|
||||
x = zeros(nel, nmc);
|
||||
y = zeros(nel, nmc);
|
||||
z = zeros(nel, nmc);
|
||||
for i = 1 : nmc
|
||||
for j = 1 : nel
|
||||
x(j, i) = coordinate(nodes(upgrid(i),order(j)), 1);
|
||||
y(j, i) = coordinate(nodes(upgrid(i),order(j)), 2);
|
||||
z(j, i) = coordinate(nodes(upgrid(i),order(j)), 3)-max(coordinate(:,3))-2000;
|
||||
dis(j, i) = v(upgrid(i));
|
||||
end
|
||||
end
|
||||
fill3(x,y,z,dis,'edgeColor','interp');
|
||||
set(gca,'FontName','Times New Roman','FontSize',10,'FontWeight','bold');
|
||||
xlabel('x, m');
|
||||
ylabel('y, m');
|
||||
zlabel('z, m');
|
||||
view(3);
|
||||
% 绘制油藏框架
|
||||
% plotframe( r );
|
||||
alpha(1)
|
||||
% caxis([0.2,0.8]);
|
||||
caxis([10,13]);
|
||||
% caxis([12,22]);
|
||||
colormap jet
|
||||
colorbar
|
||||
% zlim([-2020,-2000]);
|
||||
% axis equal
|
||||
axis tight
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
function plot_3d_grid_data_scatter(nx, ny, nz, dx, dy, dz, data)
|
||||
% 绘制三维网格数据的点云图
|
||||
% 输入参数:
|
||||
% nx, ny, nz - 各方向的网格数
|
||||
% dx, dy, dz - 各方向的网格尺寸向量
|
||||
% data - 物理量数据,维度为(nx, ny, nz)
|
||||
|
||||
% 计算每个网格点的坐标位置
|
||||
x = zeros(1, nx);
|
||||
x(1) = dx(1)/2;
|
||||
for i = 2:nx
|
||||
x(i) = x(i-1) + (dx(i-1) + dx(i))/2;
|
||||
end
|
||||
|
||||
y = zeros(1, ny);
|
||||
y(1) = dy(1)/2;
|
||||
for i = 2:ny
|
||||
y(i) = y(i-1) + (dy(i-1) + dy(i))/2;
|
||||
end
|
||||
|
||||
z = zeros(1, nz);
|
||||
z(1) = dz(1)/2;
|
||||
for i = 2:nz
|
||||
z(i) = z(i-1) + (dz(i-1) + dz(i))/2;
|
||||
end
|
||||
|
||||
% 创建所有网格点的坐标矩阵
|
||||
[X, Y, Z] = ndgrid(x, y, z);
|
||||
% data已经是(nx, ny, nz)格式,与ndgrid输出匹配
|
||||
|
||||
% 将数据展平用于scatter3
|
||||
X_flat = X(:);
|
||||
Y_flat = Y(:);
|
||||
Z_flat = Z(:);
|
||||
data_flat = data(:);
|
||||
|
||||
% 创建新图形
|
||||
figure('Position', [100, 100, 800, 600]);
|
||||
|
||||
% 使用scatter3绘制点云图
|
||||
scatter3(X_flat, Y_flat, Z_flat, 20, data_flat, 'filled');
|
||||
colorbar;
|
||||
colormap('jet');
|
||||
xlabel('X');
|
||||
ylabel('Y');
|
||||
zlabel('Z');
|
||||
title('三维网格物理量分布(点云图)');
|
||||
axis equal;
|
||||
view(3);
|
||||
grid on;
|
||||
|
||||
% 添加透明度设置(可选,用于显示内部点)
|
||||
alpha(0.8);
|
||||
end
|
||||
@@ -0,0 +1,52 @@
|
||||
function plot_3d_grid_data_slice(nx, ny, nz, dx, dy, dz, data)
|
||||
% 绘制三维网格数据的切片图
|
||||
% 输入参数:
|
||||
% nx, ny, nz - 各方向的网格数
|
||||
% dx, dy, dz - 各方向的网格尺寸向量
|
||||
% data - 物理量数据,维度为(nx, ny, nz)
|
||||
|
||||
% 计算每个网格点的坐标位置(取网格中心点)
|
||||
x = zeros(1, nx);
|
||||
x(1) = dx(1)/2;
|
||||
for i = 2:nx
|
||||
x(i) = x(i-1) + (dx(i-1) + dx(i))/2;
|
||||
end
|
||||
|
||||
y = zeros(1, ny);
|
||||
y(1) = dy(1)/2;
|
||||
for i = 2:ny
|
||||
y(i) = y(i-1) + (dy(i-1) + dy(i))/2;
|
||||
end
|
||||
|
||||
z = zeros(1, nz);
|
||||
z(1) = dz(1)/2;
|
||||
for i = 2:nz
|
||||
z(i) = z(i-1) + (dz(i-1) + dz(i))/2;
|
||||
end
|
||||
|
||||
% 创建三维网格
|
||||
[X, Y, Z] = meshgrid(x, y, z);
|
||||
% 注意:meshgrid生成的数组维度顺序为(ny, nx, nz)
|
||||
% 如果data是(nx, ny, nz),需要转置
|
||||
data_plot = permute(data, [2, 1, 3]);
|
||||
|
||||
% 创建新图形
|
||||
figure('Position', [100, 100, 800, 600]);
|
||||
|
||||
% 使用slice绘制三个正交切面
|
||||
xslice = [x(round(nx/4)), x(round(nx/2)), x(round(3*nx/4))];
|
||||
yslice = [y(round(ny/4)), y(round(ny/2)), y(round(3*ny/4))];
|
||||
zslice = [z(round(nz/4)), z(round(nz/2)), z(round(3*nz/4))];
|
||||
|
||||
slice(X, Y, Z, data_plot, xslice, yslice, zslice);
|
||||
shading interp;
|
||||
colorbar;
|
||||
colormap('jet');
|
||||
xlabel('X');
|
||||
ylabel('Y');
|
||||
zlabel('Z');
|
||||
title('三维网格物理量分布(切片图)');
|
||||
axis equal;
|
||||
view(3);
|
||||
grid on;
|
||||
end
|
||||
@@ -0,0 +1,66 @@
|
||||
function plot_3d_grid_data_volume(nx, ny, nz, dx, dy, dz, data)
|
||||
% 绘制三维网格数据的体绘制图
|
||||
% 输入参数:
|
||||
% nx, ny, nz - 各方向的网格数
|
||||
% dx, dy, dz - 各方向的网格尺寸向量
|
||||
% data - 物理量数据,维度为(nx, ny, nz)
|
||||
|
||||
% 计算每个网格点的坐标位置
|
||||
x = zeros(1, nx);
|
||||
x(1) = dx(1)/2;
|
||||
for i = 2:nx
|
||||
x(i) = x(i-1) + (dx(i-1) + dx(i))/2;
|
||||
end
|
||||
|
||||
y = zeros(1, ny);
|
||||
y(1) = dy(1)/2;
|
||||
for i = 2:ny
|
||||
y(i) = y(i-1) + (dy(i-1) + dy(i))/2;
|
||||
end
|
||||
|
||||
z = zeros(1, nz);
|
||||
z(1) = dz(1)/2;
|
||||
for i = 2:nz
|
||||
z(i) = z(i-1) + (dz(i-1) + dz(i))/2;
|
||||
end
|
||||
|
||||
% 创建三维网格
|
||||
[X, Y, Z] = meshgrid(x, y, z);
|
||||
% 调整data维度
|
||||
data_plot = permute(data, [2, 1, 3]);
|
||||
|
||||
% 创建新图形
|
||||
figure('Position', [100, 100, 900, 700]);
|
||||
|
||||
% 方法1:使用vol3d v2(如果安装了File Exchange的vol3d工具)
|
||||
% 如果没有安装,可以使用以下基本体绘制
|
||||
|
||||
% 创建多个等值面
|
||||
levels = linspace(min(data(:)), max(data(:)), 5);
|
||||
for i = 2:length(levels)-1
|
||||
p = patch(isosurface(X, Y, Z, data_plot, levels(i)));
|
||||
isonormals(X, Y, Z, data_plot, p);
|
||||
set(p, 'FaceColor', 'interp', 'EdgeColor', 'none');
|
||||
|
||||
% 根据数据值设置颜色
|
||||
cdata = get(p, 'FaceVertexCData');
|
||||
set(p, 'FaceVertexCData', cdata);
|
||||
end
|
||||
|
||||
% 添加一些切片来显示内部结构
|
||||
hold on;
|
||||
h = slice(X, Y, Z, data_plot, x(round(nx/2)), y(round(ny/2)), z(round(nz/2)));
|
||||
set(h, 'FaceAlpha', 0.6, 'EdgeColor', 'none');
|
||||
|
||||
colorbar;
|
||||
colormap('jet');
|
||||
xlabel('X');
|
||||
ylabel('Y');
|
||||
zlabel('Z');
|
||||
title('三维网格物理量分布(体绘制)');
|
||||
axis equal;
|
||||
view(3);
|
||||
grid on;
|
||||
camlight;
|
||||
lighting gouraud;
|
||||
end
|
||||
@@ -0,0 +1,128 @@
|
||||
function plot_3d_grid_patch_optimized(nx, ny, nz, dx, dy, dz, data)
|
||||
% 使用patch一次性绘制所有网格(优化版本)
|
||||
% 输入参数:
|
||||
% nx, ny, nz - 各方向的网格数
|
||||
% dx, dy, dz - 各方向的网格尺寸向量
|
||||
% data - 物理量数据,维度为(nx, ny, nz)
|
||||
|
||||
% 计算每个网格的边界坐标
|
||||
x_edges = zeros(nx+1, 1);
|
||||
x_edges(1) = 0;
|
||||
for i = 1:nx
|
||||
x_edges(i+1) = x_edges(i) + dx(i);
|
||||
end
|
||||
|
||||
y_edges = zeros(ny+1, 1);
|
||||
y_edges(1) = 0;
|
||||
for i = 1:ny
|
||||
y_edges(i+1) = y_edges(i) + dy(i);
|
||||
end
|
||||
|
||||
z_edges = zeros(nz+1, 1);
|
||||
z_edges(1) = 0;
|
||||
for i = 1:nz
|
||||
z_edges(i+1) = z_edges(i) + dz(i);
|
||||
end
|
||||
|
||||
% 创建网格顶点坐标
|
||||
[X_edges, Y_edges, Z_edges] = ndgrid(x_edges, y_edges, z_edges);
|
||||
|
||||
% 重新排列顶点
|
||||
vertices = [X_edges(:), Y_edges(:), Z_edges(:)];
|
||||
|
||||
% 创建每个体素的8个顶点索引
|
||||
n_cells = nx * ny * nz;
|
||||
faces = zeros(n_cells * 6, 4); % 每个体素6个面,每个面4个顶点
|
||||
face_colors = zeros(n_cells * 6, 1);
|
||||
|
||||
% 顶点编号方式:按照(i,j,k)顺序
|
||||
% 每个体素的8个顶点索引
|
||||
% v1: (i,j,k)
|
||||
% v2: (i+1,j,k)
|
||||
% v3: (i+1,j+1,k)
|
||||
% v4: (i,j+1,k)
|
||||
% v5: (i,j,k+1)
|
||||
% v6: (i+1,j,k+1)
|
||||
% v7: (i+1,j+1,k+1)
|
||||
% v8: (i,j+1,k+1)
|
||||
|
||||
face_idx = 1;
|
||||
for i = 1:nx
|
||||
for j = 1:ny
|
||||
for k = 1:nz
|
||||
% 计算当前体素的8个顶点索引
|
||||
idx = @(ii, jj, kk) (ii-1)*(ny+1)*(nz+1) + (jj-1)*(nz+1) + kk;
|
||||
|
||||
v1 = idx(i, j, k);
|
||||
v2 = idx(i+1, j, k);
|
||||
v3 = idx(i+1, j+1, k);
|
||||
v4 = idx(i, j+1, k);
|
||||
v5 = idx(i, j, k+1);
|
||||
v6 = idx(i+1, j, k+1);
|
||||
v7 = idx(i+1, j+1, k+1);
|
||||
v8 = idx(i, j+1, k+1);
|
||||
|
||||
% 当前体素的值
|
||||
cell_value = data(i, j, k);
|
||||
|
||||
% 底面 (k层)
|
||||
faces(face_idx, :) = [v1, v2, v3, v4];
|
||||
face_colors(face_idx) = cell_value;
|
||||
face_idx = face_idx + 1;
|
||||
|
||||
% 顶面 (k+1层)
|
||||
faces(face_idx, :) = [v5, v6, v7, v8];
|
||||
face_colors(face_idx) = cell_value;
|
||||
face_idx = face_idx + 1;
|
||||
|
||||
% 前面 (j层)
|
||||
faces(face_idx, :) = [v1, v2, v6, v5];
|
||||
face_colors(face_idx) = cell_value;
|
||||
face_idx = face_idx + 1;
|
||||
|
||||
% 后面 (j+1层)
|
||||
faces(face_idx, :) = [v4, v3, v7, v8];
|
||||
face_colors(face_idx) = cell_value;
|
||||
face_idx = face_idx + 1;
|
||||
|
||||
% 左面 (i层)
|
||||
faces(face_idx, :) = [v1, v4, v8, v5];
|
||||
face_colors(face_idx) = cell_value;
|
||||
face_idx = face_idx + 1;
|
||||
|
||||
% 右面 (i+1层)
|
||||
faces(face_idx, :) = [v2, v3, v7, v6];
|
||||
face_colors(face_idx) = cell_value;
|
||||
face_idx = face_idx + 1;
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
% 创建图形
|
||||
figure('Position', [100, 100, 1000, 800]);
|
||||
|
||||
% 绘制所有面
|
||||
patch('Vertices', vertices, 'Faces', faces, ...
|
||||
'FaceVertexCData', face_colors, ...
|
||||
'FaceColor', 'flat', ...
|
||||
'CDataMapping', 'scaled', ...
|
||||
'EdgeColor', 'none', ...
|
||||
'FaceAlpha', 0.9);
|
||||
|
||||
% 设置属性
|
||||
colorbar;
|
||||
colormap jet;
|
||||
xlabel('X');
|
||||
ylabel('Y');
|
||||
zlabel('Z');
|
||||
title('三维笛卡尔网格全充满物理量分布(优化版)');
|
||||
axis equal;
|
||||
view(3);
|
||||
grid on;
|
||||
box on;
|
||||
|
||||
% 光照设置
|
||||
lighting gouraud;
|
||||
light('Position', [1 1 1], 'Style', 'infinite');
|
||||
light('Position', [-1 -1 -1], 'Style', 'infinite');
|
||||
end
|
||||
@@ -0,0 +1,105 @@
|
||||
function plot_3d_grid_transparent(nx, ny, nz, dx, dy, dz, data)
|
||||
% 绘制半透明效果的三维网格
|
||||
% 输入参数:
|
||||
% nx, ny, nz - 各方向的网格数
|
||||
% dx, dy, dz - 各方向的网格尺寸向量
|
||||
% data - 物理量数据,维度为(nx, ny, nz)
|
||||
|
||||
% 计算每个网格的边界坐标
|
||||
x_edges = zeros(nx+1, 1);
|
||||
x_edges(1) = 0;
|
||||
for i = 1:nx
|
||||
x_edges(i+1) = x_edges(i) + dx(i);
|
||||
end
|
||||
|
||||
y_edges = zeros(ny+1, 1);
|
||||
y_edges(1) = 0;
|
||||
for i = 1:ny
|
||||
y_edges(i+1) = y_edges(i) + dy(i);
|
||||
end
|
||||
|
||||
z_edges = zeros(nz+1, 1);
|
||||
z_edges(1) = 0;
|
||||
for i = 1:nz
|
||||
z_edges(i+1) = z_edges(i) + dz(i);
|
||||
end
|
||||
|
||||
% 创建图形
|
||||
figure('Position', [100, 100, 1000, 800]);
|
||||
hold on;
|
||||
|
||||
% 设置颜色映射
|
||||
colormap jet;
|
||||
caxis([min(data(:)), max(data(:))]);
|
||||
|
||||
% 根据物理量值设置透明度
|
||||
% 值越大越不透明,值越小越透明
|
||||
data_min = min(data(:));
|
||||
data_max = max(data(:));
|
||||
data_range = data_max - data_min;
|
||||
|
||||
for i = 1:nx
|
||||
for j = 1:ny
|
||||
for k = 1:nz
|
||||
% 获取当前体素的边界
|
||||
x_min = x_edges(i);
|
||||
x_max = x_edges(i+1);
|
||||
y_min = y_edges(j);
|
||||
y_max = y_edges(j+1);
|
||||
z_min = z_edges(k);
|
||||
z_max = z_edges(k+1);
|
||||
|
||||
% 获取当前体素的物理量值
|
||||
value = data(i, j, k);
|
||||
|
||||
% 根据值设置透明度(值越大越不透明)
|
||||
% alpha_val = 0.3 + 0.6 * (value - data_min) / data_range;
|
||||
alpha_val = 1;
|
||||
|
||||
% 创建体素的8个顶点
|
||||
vertices = [x_min, y_min, z_min;
|
||||
x_max, y_min, z_min;
|
||||
x_max, y_max, z_min;
|
||||
x_min, y_max, z_min;
|
||||
x_min, y_min, z_max;
|
||||
x_max, y_min, z_max;
|
||||
x_max, y_max, z_max;
|
||||
x_min, y_max, z_max];
|
||||
|
||||
% 创建6个面的顶点索引
|
||||
faces = [1 2 3 4; % 底面
|
||||
5 6 7 8; % 顶面
|
||||
1 2 6 5; % 前面
|
||||
2 3 7 6; % 右面
|
||||
3 4 8 7; % 后面
|
||||
4 1 5 8]; % 左面
|
||||
|
||||
% 绘制体素
|
||||
patch('Vertices', vertices, 'Faces', faces, ...
|
||||
'FaceColor', 'flat', ...
|
||||
'FaceVertexCData', value, ...
|
||||
'CDataMapping', 'scaled', ...
|
||||
'FaceAlpha', alpha_val, ...
|
||||
'EdgeColor', 'none');
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
% 设置图形属性
|
||||
colorbar;
|
||||
xlabel('X');
|
||||
ylabel('Y');
|
||||
zlabel('Z');
|
||||
title('三维笛卡尔网格全充满物理量分布(透明度与数值相关)');
|
||||
axis equal;
|
||||
view(3);
|
||||
grid on;
|
||||
box on;
|
||||
|
||||
% 光照设置
|
||||
lighting gouraud;
|
||||
light('Position', [1 1 1], 'Style', 'infinite');
|
||||
light('Position', [-1 -1 -1], 'Style', 'infinite');
|
||||
|
||||
hold off;
|
||||
end
|
||||
@@ -0,0 +1,99 @@
|
||||
function plot_3d_grid_voxel_full(nx, ny, nz, dx, dy, dz, data)
|
||||
% 绘制三维笛卡尔网格全充满的体素图(每个网格单一颜色)
|
||||
% 输入参数:
|
||||
% nx, ny, nz - 各方向的网格数
|
||||
% dx, dy, dz - 各方向的网格尺寸向量
|
||||
% data - 物理量数据,维度为(nx, ny, nz)
|
||||
|
||||
% 计算每个网格的边界坐标
|
||||
x_edges = zeros(nx+1, 1);
|
||||
x_edges(1) = 0;
|
||||
for i = 1:nx
|
||||
x_edges(i+1) = x_edges(i) + dx(i);
|
||||
end
|
||||
|
||||
y_edges = zeros(ny+1, 1);
|
||||
y_edges(1) = 0;
|
||||
for i = 1:ny
|
||||
y_edges(i+1) = y_edges(i) + dy(i);
|
||||
end
|
||||
|
||||
z_edges = zeros(nz+1, 1);
|
||||
z_edges(1) = 0;
|
||||
for i = 1:nz
|
||||
z_edges(i+1) = z_edges(i) + dz(i);
|
||||
end
|
||||
|
||||
% 创建图形窗口
|
||||
figure('Position', [100, 100, 1000, 800]);
|
||||
hold on;
|
||||
|
||||
% 设置颜色映射
|
||||
colormap jet;
|
||||
caxis([min(data(:)), max(data(:))]);
|
||||
|
||||
% 绘制每个体素
|
||||
alpha_value = 0.9; % 透明度
|
||||
|
||||
for i = 1:nx
|
||||
for j = 1:ny
|
||||
for k = 1:nz
|
||||
% 获取当前体素的边界
|
||||
x_min = x_edges(i);
|
||||
x_max = x_edges(i+1);
|
||||
y_min = y_edges(j);
|
||||
y_max = y_edges(j+1);
|
||||
z_min = z_edges(k);
|
||||
z_max = z_edges(k+1);
|
||||
|
||||
% 获取当前体素的物理量值
|
||||
value = data(i, j, k);
|
||||
|
||||
% 创建体素的8个顶点
|
||||
vertices = [x_min, y_min, z_min;
|
||||
x_max, y_min, z_min;
|
||||
x_max, y_max, z_min;
|
||||
x_min, y_max, z_min;
|
||||
x_min, y_min, z_max;
|
||||
x_max, y_min, z_max;
|
||||
x_max, y_max, z_max;
|
||||
x_min, y_max, z_max];
|
||||
|
||||
% 创建6个面的顶点索引
|
||||
faces = [1 2 3 4; % 底面
|
||||
5 6 7 8; % 顶面
|
||||
1 2 6 5; % 前面
|
||||
2 3 7 6; % 右面
|
||||
3 4 8 7; % 后面
|
||||
4 1 5 8]; % 左面
|
||||
|
||||
% 关键修改:使用 'flat' 确保每个面单一颜色
|
||||
% 并且为每个面指定相同的颜色值
|
||||
patch('Vertices', vertices, 'Faces', faces, ...
|
||||
'FaceColor', 'flat', ... % 'flat' 确保每个面单一颜色
|
||||
'FaceVertexCData', value * ones(size(faces, 1), 1), ... % 所有面使用相同颜色值
|
||||
'CDataMapping', 'scaled', ...
|
||||
'FaceAlpha', alpha_value, ...
|
||||
'EdgeColor', 'none');
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
% 设置图形属性
|
||||
colorbar;
|
||||
xlabel('X');
|
||||
ylabel('Y');
|
||||
zlabel('Z');
|
||||
title('三维笛卡尔网格全充满物理量分布(每个网格单一颜色)');
|
||||
axis equal;
|
||||
view(3);
|
||||
grid on;
|
||||
box on;
|
||||
|
||||
% 设置光照
|
||||
lighting gouraud;
|
||||
light('Position', [1 1 1], 'Style', 'infinite');
|
||||
light('Position', [-1 -1 -1], 'Style', 'infinite');
|
||||
|
||||
hold off;
|
||||
end
|
||||
@@ -0,0 +1,105 @@
|
||||
function plot_3d_grid_voxel_function_fixed(nx, ny, nz, dx, dy, dz, data)
|
||||
% 使用自定义voxel函数绘制三维网格(每个网格单一颜色)
|
||||
% 输入参数:
|
||||
% nx, ny, nz - 各方向的网格数
|
||||
% dx, dy, dz - 各方向的网格尺寸向量
|
||||
% data - 物理量数据,维度为(nx, ny, nz)
|
||||
|
||||
% 计算每个网格的中心坐标
|
||||
x_center = zeros(nx, 1);
|
||||
x_center(1) = dx(1)/2;
|
||||
for i = 2:nx
|
||||
x_center(i) = x_center(i-1) + (dx(i-1) + dx(i))/2;
|
||||
end
|
||||
|
||||
y_center = zeros(ny, 1);
|
||||
y_center(1) = dy(1)/2;
|
||||
for i = 2:ny
|
||||
y_center(i) = y_center(i-1) + (dy(i-1) + dy(i))/2;
|
||||
end
|
||||
|
||||
z_center = zeros(nz, 1);
|
||||
z_center(1) = dz(1)/2;
|
||||
for i = 2:nz
|
||||
z_center(i) = z_center(i-1) + (dz(i-1) + dz(i))/2;
|
||||
end
|
||||
|
||||
% 创建图形
|
||||
figure('Position', [100, 100, 1000, 800]);
|
||||
hold on;
|
||||
|
||||
% 设置颜色映射
|
||||
colormap jet;
|
||||
caxis([min(data(:)), max(data(:))]);
|
||||
|
||||
% 绘制每个体素
|
||||
alpha_val = 0.9; % 透明度
|
||||
|
||||
for i = 1:nx
|
||||
for j = 1:ny
|
||||
for k = 1:nz
|
||||
% 绘制体素 - 传递当前网格的值
|
||||
voxel_fixed([x_center(i), y_center(j), z_center(k)], ...
|
||||
[dx(i), dy(j), dz(k)], ...
|
||||
data(i, j, k), alpha_val);
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
% 设置图形属性
|
||||
colorbar;
|
||||
xlabel('X');
|
||||
ylabel('Y');
|
||||
zlabel('Z');
|
||||
title('三维笛卡尔网格全充满物理量分布(体素法,单一颜色)');
|
||||
axis equal;
|
||||
view(3);
|
||||
grid on;
|
||||
box on;
|
||||
|
||||
% 光照设置
|
||||
lighting gouraud;
|
||||
light('Position', [1 1 1], 'Style', 'infinite');
|
||||
light('Position', [-1 -1 -1], 'Style', 'infinite');
|
||||
|
||||
hold off;
|
||||
end
|
||||
|
||||
function voxel_fixed(center, size, value, alpha)
|
||||
% 绘制单个体素的辅助函数(每个面使用相同颜色)
|
||||
% center: [x, y, z] 中心坐标
|
||||
% size: [dx, dy, dz] 尺寸
|
||||
% value: 物理量值
|
||||
% alpha: 透明度
|
||||
|
||||
% 计算8个顶点
|
||||
x = center(1) + [-size(1)/2, size(1)/2];
|
||||
y = center(2) + [-size(2)/2, size(2)/2];
|
||||
z = center(3) + [-size(3)/2, size(3)/2];
|
||||
|
||||
% 创建8个顶点
|
||||
vertices = [x(1), y(1), z(1);
|
||||
x(2), y(1), z(1);
|
||||
x(2), y(2), z(1);
|
||||
x(1), y(2), z(1);
|
||||
x(1), y(1), z(2);
|
||||
x(2), y(1), z(2);
|
||||
x(2), y(2), z(2);
|
||||
x(1), y(2), z(2)];
|
||||
|
||||
% 6个面的顶点索引
|
||||
faces = [1 2 3 4;
|
||||
5 6 7 8;
|
||||
1 2 6 5;
|
||||
2 3 7 6;
|
||||
3 4 8 7;
|
||||
4 1 5 8];
|
||||
|
||||
% 关键修改:使用 'flat' 并确保所有面使用相同的颜色值
|
||||
patch('Vertices', vertices, 'Faces', faces, ...
|
||||
'FaceColor', 'flat', ... % 'flat' 确保每个面单一颜色
|
||||
'FaceVertexCData', value * ones(size(faces, 1), 1), ... % 所有面相同颜色
|
||||
'CDataMapping', 'scaled', ...
|
||||
'FaceAlpha', alpha, ...
|
||||
'EdgeColor', 'none');
|
||||
end
|
||||
@@ -0,0 +1,51 @@
|
||||
function plot_SP_DP(k, r)
|
||||
coordinate=r.coordinates;
|
||||
nodes=r.nodes;
|
||||
nz=r.nz;
|
||||
nx=r.nx;
|
||||
ny=r.ny;
|
||||
nmc = size(nodes,1);
|
||||
% nel = size(nodes,2);
|
||||
nel = 4;
|
||||
v = r.sigma;
|
||||
% if type == 1
|
||||
% % v = r.kx;
|
||||
% v = OutputRs{i}.p;
|
||||
% else
|
||||
% v = 1-OutputRs{i}.sw;%º¬Æø±¥ºÍ¶È
|
||||
% end
|
||||
dis = zeros(nel, nx*ny);
|
||||
x = zeros(nel, nx*ny);
|
||||
y = zeros(nel, nx*ny);
|
||||
for i = 1 :nx*ny
|
||||
for j = 1 :nel
|
||||
grid_numbering = i+(nz-k)*nx*ny;
|
||||
x(j, i) = coordinate(nodes(grid_numbering,j), 1);
|
||||
y(j, i) = coordinate(nodes(grid_numbering,j), 2);
|
||||
if j == 3
|
||||
x(j, i) = coordinate(nodes(grid_numbering,4), 1);
|
||||
y(j, i) = coordinate(nodes(grid_numbering,4), 2);
|
||||
end
|
||||
if j == 4
|
||||
x(j, i) = coordinate(nodes(grid_numbering,3), 1);
|
||||
y(j, i) = coordinate(nodes(grid_numbering,3), 2);
|
||||
end
|
||||
dis(j, i) = v(grid_numbering);
|
||||
end
|
||||
end
|
||||
% fill(x,y,dis,'EdgeAlpha',1);
|
||||
figure('color','w');
|
||||
fill(x,y,dis,'EdgeColor','interp');
|
||||
xlabel('x, m','FontSize',14);
|
||||
ylabel('y, m','FontSize',14);
|
||||
ax = gca;
|
||||
ax.FontSize = 14;
|
||||
axis equal;
|
||||
axis tight
|
||||
% xlim([0,60]);
|
||||
% ylim([0,60]);
|
||||
% clim([10,15]);
|
||||
colorbar
|
||||
colormap jet
|
||||
% fill(x,y,dis);
|
||||
% axis off
|
||||
@@ -0,0 +1,40 @@
|
||||
function [ downgrid, frontgrid ,leftgrid, rightgrid, backgrid, upgrid ] = preplot_dis( r )
|
||||
%PREPLOT 此处显示有关此函数的摘要
|
||||
% 此处显示详细说明
|
||||
nx=r.nx;
|
||||
ny=r.ny;
|
||||
nz=r.nz;
|
||||
downgrid=[];
|
||||
frontgrid=[];
|
||||
leftgrid=[];
|
||||
rightgrid=[];
|
||||
backgrid=[];
|
||||
upgrid=[];
|
||||
for k=1:nz
|
||||
for j=1:ny
|
||||
for i=1:nx
|
||||
rao=i+(j-1)*nx+(k-1)*nx*ny;
|
||||
if k==1
|
||||
downgrid=[downgrid rao];
|
||||
end
|
||||
if k==nz
|
||||
upgrid=[upgrid rao];
|
||||
end
|
||||
if i==1
|
||||
leftgrid=[leftgrid rao];
|
||||
end
|
||||
if i==nx
|
||||
rightgrid=[rightgrid rao];
|
||||
end
|
||||
if j==1
|
||||
frontgrid=[frontgrid rao];
|
||||
end
|
||||
if j==ny
|
||||
backgrid=[backgrid rao];
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
function [ downgrid, frontgrid ,leftgrid, rightgrid, backgrid, upgrid ] = preplot_dislayer( r,k )
|
||||
%PREPLOT 此处显示有关此函数的摘要
|
||||
% 此处显示详细说明
|
||||
% k表示从上面数的层数
|
||||
nx=r.nx;
|
||||
ny=r.ny;
|
||||
nz=r.nz;
|
||||
downgrid=[];
|
||||
frontgrid=[];
|
||||
leftgrid=[];
|
||||
rightgrid=[];
|
||||
backgrid=[];
|
||||
upgrid=[];
|
||||
xiang=nz+1-k;
|
||||
for j=1:ny
|
||||
for i=1:nx
|
||||
rao=i+(j-1)*nx+(xiang-1)*nx*ny;
|
||||
|
||||
downgrid=[downgrid rao];
|
||||
|
||||
|
||||
upgrid=[upgrid rao];
|
||||
|
||||
if i==1
|
||||
leftgrid=[leftgrid rao];
|
||||
end
|
||||
if i==nx
|
||||
rightgrid=[rightgrid rao];
|
||||
end
|
||||
if j==1
|
||||
frontgrid=[frontgrid rao];
|
||||
end
|
||||
if j==ny
|
||||
backgrid=[backgrid rao];
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
function [ f,fellip ] = sort_fracture( inputf )
|
||||
nf=size(inputf,1);
|
||||
f=[];fellip=[];
|
||||
for i=1:nf
|
||||
ft1=inputf{i,1};
|
||||
alpha=inputf{i,2}/180*pi;beta=inputf{i,3}/180*pi;gama=inputf{i,4}/180*pi;%角度转换为弧度制
|
||||
lf=inputf{i,5};hf=inputf{i,6};
|
||||
ft2=lf/2*[cos(alpha)*cos(gama)+sin(alpha)*cos(beta)*sin(gama),-cos(alpha)*cos(beta)*sin(gama)+sin(alpha)*cos(gama),...
|
||||
sin(beta)*sin(gama)];
|
||||
ft3=hf/2*[sin(alpha)*cos(beta)*cos(gama)-cos(alpha)*sin(gama),-sin(alpha)*sin(gama)-cos(alpha)*cos(beta)*cos(gama),sin(beta)*cos(gama)];
|
||||
if inputf{i,7}==1 %矩形缝
|
||||
ft4=[-1,1,0];ft5=[-1,1,0];
|
||||
f=[f;ft1;ft2;ft3;ft4;ft5];
|
||||
f(abs(f)<=1e-4)=0;
|
||||
else %椭圆缝
|
||||
ft4=[0,0,1];ft5=[0,0,1];
|
||||
fellip=[fellip;ft1;ft2;ft3;ft4;ft5];
|
||||
fellip(abs(fellip)<=1e-4)=0;
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
function [ f,fellip ] = sort_fracture_project( inputf )
|
||||
nf=size(inputf{1,1},1);
|
||||
f=[];fellip=[];
|
||||
for i=1:nf
|
||||
ft1=inputf{1,1}(i,:);
|
||||
% alpha=inputf{i,2}/180*pi;beta=inputf{i,3}/180*pi;gama=inputf{i,4}/180*pi;%角度转换为弧度制
|
||||
% lf=inputf{i,5};hf=inputf{i,6};
|
||||
alpha=90/180*pi;beta=90/180*pi;gama=0/180*pi;%角度转换为弧度制
|
||||
lf=200;hf=5;
|
||||
ft2=lf/2*[cos(alpha)*cos(gama)+sin(alpha)*cos(beta)*sin(gama),-cos(alpha)*cos(beta)*sin(gama)+sin(alpha)*cos(gama),...
|
||||
sin(beta)*sin(gama)];
|
||||
ft3=hf/2*[sin(alpha)*cos(beta)*cos(gama)-cos(alpha)*sin(gama),-sin(alpha)*sin(gama)-cos(alpha)*cos(beta)*cos(gama),sin(beta)*cos(gama)];
|
||||
% if inputf{i,7}==1 %矩形缝
|
||||
ft4=[-1,1,0];ft5=[-1,1,0];
|
||||
f=[f;ft1;ft2;ft3;ft4;ft5];
|
||||
f(abs(f)<=1e-4)=0;
|
||||
% else %椭圆缝
|
||||
% ft4=[0,0,1];ft5=[0,0,1];
|
||||
% fellip=[fellip;ft1;ft2;ft3;ft4;ft5];
|
||||
% fellip(abs(fellip)<=1e-4)=0;
|
||||
% end
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
function [ input_modi ] = sort_input( input,nx,ny,nz )
|
||||
input=reshape(input',[],1);
|
||||
input(input==0)=0.0001;
|
||||
% hei=length(input);
|
||||
hei=nx*ny*nz;
|
||||
input=input(1:hei,1);
|
||||
input_modi=zeros(hei,1);
|
||||
for i=1:hei
|
||||
zz=floor((i-1)/(nx*ny));
|
||||
zzz=nz-zz;
|
||||
yy=floor((i-zz*nx*ny-1)/nx);
|
||||
yyy=ny-yy;
|
||||
% yyy=yy+1;
|
||||
xxx=mod(i-zz*nx*ny-1,nx);
|
||||
if xxx==0 xxx=nx;
|
||||
end
|
||||
input_modi(xxx+(yyy-1)*nx+(zzz-1)*nx*ny,1)=input(i);
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
% 加载生成的数据
|
||||
load('test_data.mat');
|
||||
|
||||
% 使用高斯分布数据绘制切片图
|
||||
plot_3d_grid_data_slice(nx, ny, nz, dx, dy, dz, data1);
|
||||
|
||||
% 使用球壳分布数据绘制点云图
|
||||
plot_3d_grid_data_scatter(nx, ny, nz, dx, dy, dz, data2);
|
||||
|
||||
% 使用波纹分布数据绘制体绘制图
|
||||
plot_3d_grid_data_volume(nx, ny, nz, dx, dy, dz, data3);
|
||||
Reference in New Issue
Block a user