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,200 @@
function [ r, Times, OutputRs, Wellpara, trun ] = main1()
%% ==================================PART 1: ========================================
% 1-- classical EDFM
modelflag = 1;% 1
%% ==================================PART 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);
NTG= 1*ones(nx*ny*nz,1);
r = GridProp_pre(dx, dy,dz,nx,ny,nz,NTG);
%% ==================================PART 3: =====================================
% : 1234.fab文件读取
input_style = 1;
%% 1
%
% 123456127
if input_style==1
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);
flowBarrierFlags = [];
m=size(f,1);n=size(fellip,1);nf=(m+n)/5;
frac_information = fractureInformation_input_engineering_vector(f,fellip,flowBarrierFlags);
end
%% 2
%
%5
%
%
%
if input_style==2
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;
];
%
% 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=[];
m=size(f,1);n=size(fellip,1);nf=(m+n)/5;%
frac_information = fractureInformation_input_engineering_vector(f,fellip);
end
%% 3
% load('fractures_generated.mat');
% fractureLines = fractures_generated;
if input_style==3
fractureLines = [
105,150;105,350;
205,150;205,350;
305,150;305,350;
405,150;405,350;
505,150;505,350;
605,150;605,350;
705,150;705,350;
805,150;805,350;
905,150;905,350;
];
fellip=[]; %
fractureHeights = [
10;10;10;10;10;10;10;10;10];
%
fellip=[];
flowBarrierFlags = [];% flowBarrierFlags = [1;2;3;4];
[f,frac_information] = input_fracture_2D(fractureLines,fractureHeights,flowBarrierFlags);
m=size(f,1);n=size(fellip,1);nf=(m+n)/5;%
end
%% 4.fab文件读取 Frac_PT
if input_style==4
end
%% ==================================PART 4: =====================================
% 1--
% 2--
grid_model = 1;
if grid_model == 1
r = grid_discretization_SP_model(modelflag, r, f, frac_information, fellip, nf);
end
if grid_model == 2
r = grid_discretization_DP_model(modelflag, r, f, frac_information, fellip, nf);
end
%%
os = OperatorRS(r.N, r.nex, r.nc);
%% ==================================PART 5: =========================================
% 1--
% 2--
flow_model = 1;
if flow_model == 1
[f,state0] = gas_water_flow(r);
end
if flow_model == 2
[f,state0] = oil_water_flow(r);
end
if flow_model == 3
[f,state0] = multi_component_flow(r);
end
%% ==================================PART 6: schedule设定================================================
%
%%
% Wellcpara: wellname(1) nperf(2) index(3) rw(4) skin(5) welltype(6)
% welltype=1 welltype=2 沿x方向welltype=3 沿y方向 welltype=4
%
% eclipse一致的方式
% px,py,pz确定x方向y方向的网格编号z反方向上的网格编号
well1={
% 'w1', 2, [20 10 1;20 10 2;], 0.178/2, 0, 1;
% 'w2', 2, [80 10 1;80 10 2;], 0.178/2, 0, 1;
% 'w3', 1, [20 40 1;], 0.178/2, 0, 1;
% 'w4', 1, [80 40 1;], 0.178/2, 0, 1;
};
well1 = handle_well1(well1,r);
%%
%
num_fracture_wells = 1;
welloc = cell(num_fracture_wells,1);
perfnum = cell(num_fracture_wells,1);
welloc{1,1}=[
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;
];
for i = 1:num_fracture_wells
perfnum{i,1} = findWelloc(r, welloc{i,1});%Wellc0之中
end
% perfnum2 = findWelloc(r, welloc2);
well2={
'w1', length(perfnum{1,1}), perfnum{1,1}, 0.178/2, 0,4;
};
Wellc = handle_well1_well2(well1,well2,welloc,r); %
%% /便
number_phases = 5;
well_schedules = cell(number_phases,1);
time = zeros(number_phases,1);
%
% dtmaxdtmin都需要小一些
dtmax = zeros(number_phases,1);
dtmin = zeros(number_phases,1);
% (1)well state: 'open''close''open'0
% (2)well type: 'pro''inj';
% (3)protype'const_q''const_pwf'
% (4)value
% (5)value3
time(1) = 1e-3; dtmax(1) = 0.00002; dtmin(1) = 0.00001;
well_schedules{1,1} = {
'w1','open','pro','const_q',10000,10000};
time(2) = 99e-3; dtmax(2) = 0.0002; dtmin(2) = 0.0001;
well_schedules{2,1} = {
'w1','open','pro','const_q',10000,10000};
time(3) = 0.9; dtmax(3) = 0.002; dtmin(3) = 0.001;
well_schedules{3,1} = {
'w1','open','pro','const_q',10000,10000};
time(4) = 100; dtmax(4) = 2; dtmin(4) = 0.01;
well_schedules{4,1} = {
'w1','open','pro','const_q',10000,10000};
time(5) = 900; dtmax(5) = 10; dtmin(5) = 0.01;
well_schedules{5,1} = {
'w1','open','pro','const_q',10000,10000};
%% ======================================PART 7: Solver设置===========================================
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 = 10;
% dtmin = 0.000001;
% dtmax = 0.0001;
%% ======================================PART 8: ===========================================
[Times, OutputRs, Wellpara, trun] = solver_NR(r, flow_model, f, os, state0, yitap,yitas,omega,Nmax,epsave,epsmax,dtmin,dtmax,Wellc,time,well_schedules);
run_time=toc;
trun.run_time=run_time;
end