-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathplot_result.m
More file actions
153 lines (117 loc) · 3.88 KB
/
plot_result.m
File metadata and controls
153 lines (117 loc) · 3.88 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
function fig = plot_result(strata_trapped, param_id, args)
arguments
strata_trapped (1,1) struct
param_id (1,1) uint8
args.font_size = 14
args.kr_scale = "log"
args.parent = struct([]);
args.visible char = 'on';
end
if isempty(args.parent)
fig = figure('Visible',args.visible);
else
fig = args.parent;
clf(fig);
end
[t_all,t_kr,t_krw,t_krg,ax_pc,ax_krw_x,ax_krw_y,ax_krw_z,ax_krg_x,ax_krg_y,ax_krg_z] ...
= nested_tiles(fig);
saturation = strata_trapped.saturation(param_id,:);
leverett_j = dequantize(strata_trapped.tables(param_id,1)).leverett_j;
[~, ax_pc] = stat_plot(ax_pc,saturation,...
@(sw)strata_trapped.params(param_id).cap_pressure.leverett_j.func(sw),...
leverett_j,param_id,true);
title(ax_pc,'Leverett J-function');
ylabel(ax_pc,'[-]');
ax_pc.YScale='log';
curves_plot([ax_krw_x,ax_krw_y,ax_krw_z;ax_krg_x,ax_krg_y,ax_krg_z], saturation, ...
strata_trapped.tables(param_id,:), strata_trapped.params(param_id), args.kr_scale);
xlabel(t_all,'Wetting phase saturation',FontSize=args.font_size);
title(t_kr,'Relative permeability',FontSize=args.font_size);
title(t_krw,'Water',FontSize=args.font_size);
title(t_krg,'Gas',FontSize=args.font_size);
subtitle(ax_krw_x,'x','Interpreter','latex');
subtitle(ax_krw_y,'y','Interpreter','latex');
subtitle(ax_krw_z,'z','Interpreter','latex');
subtitle(ax_krg_x,'x','Interpreter','latex');
subtitle(ax_krg_y,'y','Interpreter','latex');
subtitle(ax_krg_z,'z','Interpreter','latex');
end
function curves_plot(ax_kr, saturation, dequantized, params, scale)
arguments
ax_kr
saturation
dequantized
params
scale = "log"
end
stat_plot(ax_kr(1,1),saturation,@(sw)params.krw.func(sw),dequantized(1).krw,[]);
ax_kr(1,1).YScale = scale;
stat_plot(ax_kr(2,1),saturation,@(sw) params.krg.func(1-sw),dequantized(1).krg,[]);
ax_kr(2,1).YScale = scale;
stat_plot(ax_kr(1,2),saturation,@(sw)params.krw.func(sw),dequantized(2).krw,[]);
ax_kr(1,2).YScale = scale;
stat_plot(ax_kr(2,2),saturation,@(sw) params.krg.func(1-sw),dequantized(2).krg,[]);
ax_kr(2,2).YScale = scale;
stat_plot(ax_kr(1,3),saturation,@(sw)params.krw.func(sw),dequantized(3).krw,[]);
ax_kr(1,3).YScale = scale;
stat_plot(ax_kr(2,3),saturation,@(sw) params.krg.func(1-sw),dequantized(3).krg,[]);
ax_kr(2,3).YScale = scale;
end
function [y_lim, ax] = stat_plot(ax, x_data, base_func, data, param_id, show_legend,color)
arguments
ax
x_data (1,:) double
base_func
data (:,:) double
param_id
show_legend (1,1) logical = false
color = 'blue'
end
parallelcoords(ax,data,'Quantile',0.01,'XData',x_data,'Color',color);
if ~isempty(base_func)
hold(ax,'on');
plot(ax,x_data,base_func(x_data),'-r');
hold(ax,'off');
end
ylabel(ax,'');
xlabel(ax,'');
ax.XTickMode='auto';
ax.XTickLabelMode='auto';
ax.XLimitMethod="tickaligned";
ax.YLimitMethod="tight";
if show_legend
legends = {'Median','Quantiles 0.01 and 0.99',''};
if ~isempty(base_func)
legends{end+1} = sprintf('Fine-scale curve (id: %u)',param_id);
end
legend(ax,legends,'Location','northoutside');
end
try
[yu,yl,ym] = ax.Children(:).YData;
ydata = [yu,yl,ym];
y_lim = [min(ydata),max(ydata)];
catch
y_lim = [nan,nan];
end
end
function [t_all,t_kr,t_krw,t_krg,ax_pc,ax_krw_x,ax_krw_y,ax_krw_z,ax_krg_x,ax_krg_y,ax_krg_z] ...
= nested_tiles(fig)
params = {'TileSpacing','tight','Padding','tight'};
t_all = tiledlayout(fig,1,3,params{:});
t_pc = tiledlayout(t_all,1,1,params{:});
t_pc.Layout.Tile = 1;
ax_pc = nexttile(t_pc);
t_kr = tiledlayout(t_all,1,2,params{:});
t_kr.Layout.Tile = 2;
t_kr.Layout.TileSpan = [1,2];
t_krw = tiledlayout(t_kr,3,1,params{:});
t_krw.Layout.Tile = 1;
ax_krw_x = nexttile(t_krw,1);
ax_krw_y = nexttile(t_krw,2);
ax_krw_z = nexttile(t_krw,3);
t_krg = tiledlayout(t_kr,3,1,params{:});
t_krg.Layout.Tile = 2;
ax_krg_x = nexttile(t_krg,1);
ax_krg_y = nexttile(t_krg,2);
ax_krg_z = nexttile(t_krg,3);
end