优化点5,6
This commit is contained in:
@@ -48,29 +48,32 @@ switch metric
|
||||
case "GPR"
|
||||
field_name = 'qg';
|
||||
y_label = 'Gas production rate, m^3/d';
|
||||
for i = 1:n, data(i) = wellpara{i}{1, well_index}.(field_name); end
|
||||
for i = 1:n, data(i) = get_well_metric_value(wellpara, i, well_index, field_name); end
|
||||
plot(ax, times, data, 'k^-', 'LineWidth', 1.2);
|
||||
case "OPR"
|
||||
field_name = 'qo';
|
||||
y_label = 'Oil production rate, m^3/d';
|
||||
for i = 1:n, data(i) = wellpara{i}{1, well_index}.(field_name); end
|
||||
for i = 1:n, data(i) = get_well_metric_value(wellpara, i, well_index, field_name); end
|
||||
plot(ax, times, data, 'k^-', 'LineWidth', 1.2);
|
||||
case "WPR"
|
||||
field_name = 'qw';
|
||||
y_label = 'Water production rate, m^3/d';
|
||||
for i = 1:n, data(i) = wellpara{i}{1, well_index}.(field_name); end
|
||||
for i = 1:n, data(i) = get_well_metric_value(wellpara, i, well_index, field_name); end
|
||||
plot(ax, times, data, 'k^-', 'LineWidth', 1.2);
|
||||
case "DPWF"
|
||||
y_label = 'Pressure derivative, MPa';
|
||||
for i = 1:n
|
||||
if i == 1
|
||||
data(i) = (wellpara{i + 1}{1, well_index}.pwf - wellpara{i}{1, well_index}.pwf) / ...
|
||||
data(i) = (get_well_metric_value(wellpara, i + 1, well_index, 'pwf') - ...
|
||||
get_well_metric_value(wellpara, i, well_index, 'pwf')) / ...
|
||||
(log(times(i + 1)) - log(times(i)));
|
||||
elseif i == n
|
||||
data(i) = (wellpara{i}{1, well_index}.pwf - wellpara{i - 1}{1, well_index}.pwf) / ...
|
||||
data(i) = (get_well_metric_value(wellpara, i, well_index, 'pwf') - ...
|
||||
get_well_metric_value(wellpara, i - 1, well_index, 'pwf')) / ...
|
||||
(log(times(i)) - log(times(i - 1)));
|
||||
else
|
||||
data(i) = (wellpara{i + 1}{1, well_index}.pwf - wellpara{i - 1}{1, well_index}.pwf) / ...
|
||||
data(i) = (get_well_metric_value(wellpara, i + 1, well_index, 'pwf') - ...
|
||||
get_well_metric_value(wellpara, i - 1, well_index, 'pwf')) / ...
|
||||
(log(times(i + 1)) - log(times(i - 1)));
|
||||
end
|
||||
end
|
||||
@@ -79,7 +82,7 @@ switch metric
|
||||
otherwise
|
||||
field_name = 'pwf';
|
||||
y_label = 'BHP, MPa';
|
||||
for i = 1:n, data(i) = wellpara{i}{1, well_index}.(field_name); end
|
||||
for i = 1:n, data(i) = get_well_metric_value(wellpara, i, well_index, field_name); end
|
||||
plot(ax, times, data, 'k^-', 'LineWidth', 1.2);
|
||||
end
|
||||
|
||||
@@ -89,6 +92,47 @@ ylabel(ax, y_label);
|
||||
title(ax, sprintf('Well Response: well %d, %s', well_index, metric));
|
||||
end
|
||||
|
||||
function value = get_well_metric_value(wellpara, time_index, well_index, field_name)
|
||||
well_entry = get_well_entry(wellpara, time_index, well_index);
|
||||
if isempty(well_entry)
|
||||
value = NaN;
|
||||
return;
|
||||
end
|
||||
if ~isstruct(well_entry)
|
||||
value = NaN;
|
||||
return;
|
||||
end
|
||||
if ~isfield(well_entry, field_name)
|
||||
value = NaN;
|
||||
return;
|
||||
end
|
||||
value = well_entry.(field_name);
|
||||
end
|
||||
|
||||
function well_entry = get_well_entry(wellpara, time_index, well_index)
|
||||
time_entry = wellpara{time_index};
|
||||
|
||||
if iscell(time_entry)
|
||||
if isempty(time_entry)
|
||||
well_entry = [];
|
||||
return;
|
||||
end
|
||||
if well_index > numel(time_entry)
|
||||
well_entry = [];
|
||||
return;
|
||||
end
|
||||
well_entry = time_entry{well_index};
|
||||
elseif isstruct(time_entry)
|
||||
if numel(time_entry) < well_index
|
||||
well_entry = [];
|
||||
return;
|
||||
end
|
||||
well_entry = time_entry(well_index);
|
||||
else
|
||||
well_entry = [];
|
||||
end
|
||||
end
|
||||
|
||||
function render_2d_layer(ax, config, results, options)
|
||||
r = results.r;
|
||||
output = results.OutputRs{get_option(options, 'time_step', numel(results.OutputRs))};
|
||||
|
||||
Reference in New Issue
Block a user