-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathrunExample.m
More file actions
134 lines (100 loc) · 2.96 KB
/
runExample.m
File metadata and controls
134 lines (100 loc) · 2.96 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
%% Compile Mex files
of = cd ('toolbox_graph');
compile_mex;
cd(of);
of = cd('toolbox_graph');
compile_mex;
cd(of);
%% Binary geology example
clear;
load BWGanges.mat;
nNodes = 50;
plotRes = 1;
topoMapper(BW(1:2:end,1:2:end), nNodes, plotRes);
%% 2D heterogeneous porous media example
clear;
load spe10data.mat
layer = 10;
nNodes = 20;
plotRes = 1;
% log K
logK2D = permFieldUpperNess(:,1:200,layer);
% milliDarcy
K2D = exp(logK2D);
figure
subplot(2,1,1)
imagesc(logK2D);
title('Log K')
colorbar
set(gca, 'FontSize', 18)
subplot(2,1,2)
imagesc(K2D);
title('K [mD]')
colorbar
set(gca, 'FontSize', 18)
G2D = permTopoMapper(K2D, nNodes, plotRes);
%% Compute distances between multiple graph realizations of two 3D cases
% indices
isel = 11:50;
jsel = 51:150;
ksel = 1:20;
% number of nodes
nNodes = 30;
% Two 3D cubes
K1 = exp(permFieldTarbert(isel, jsel, ksel));
K2 = exp(permFieldUpperNess(isel, jsel, ksel));
% examples for each case
permTopoMapper(K1, nNodes, 1);
permTopoMapper(K2, nNodes, 1);
% multiple realizations of the same 3D cubes
nReal = 10;
laplacianSpectrumReducedGraphs1 = zeros(nReal, nNodes);
laplacianSpectrumFullGraphs1 = zeros(nReal, nNodes*30);
laplacianSpectrumReducedGraphs2 = zeros(nReal, nNodes);
laplacianSpectrumFullGraphs2 = zeros(nReal, nNodes*30);
for i = 1:nReal
% map graphs
G1 = permTopoMapper(K1, nNodes, 0);
G2 = permTopoMapper(K2, nNodes, 0);
% compute eigenvalues
laplacianSpectrumReducedGraphs1(i,:) = computeLaplacianEV(G1.Wred);
laplacianSpectrumReducedGraphs2(i,:) = computeLaplacianEV(G2.Wred);
laplacianSpectrumFullGraphs1(i,:) = computeLaplacianEV(G1.W);
laplacianSpectrumFullGraphs2(i,:) = computeLaplacianEV(G2.W);
end
% plot log-transformed eigenvalues of full graph
eps = 100;
figure
plot (log(laplacianSpectrumFullGraphs1(1,:)' + eps),'r')
hold on
plot (log(laplacianSpectrumFullGraphs2(1,:)' + eps),'b')
plot (log(laplacianSpectrumFullGraphs1' + eps),'r')
hold on
plot (log(laplacianSpectrumFullGraphs2' + eps),'b')
legend('Tarbert','Upper Ness')
title('Full Graph Spectrum')
xlabel('Eigenvalue Number')
ylabel('log [\lambda]')
set(gca, 'FontSize', 18)
% plot distributions of full graphs
EVfull = [laplacianSpectrumFullGraphs1; laplacianSpectrumFullGraphs2];
showDistributions(EVfull, 2, eps, {'r', 'b'})
title('Full Graph Spectrum Distributions')
% plot eigenvalues of reduced graph
eps = 100;
figure
plot (log(laplacianSpectrumReducedGraphs1(1,:)' + eps),'r')
hold on
plot (log(laplacianSpectrumReducedGraphs2(1,:)' + eps),'b')
plot (log(laplacianSpectrumReducedGraphs1' + eps),'r')
hold on
plot (log(laplacianSpectrumReducedGraphs2' + eps),'b')
legend('Tarbert','Upper Ness')
title('Reduced Graph Spectrum')
xlabel('Eigenvalue Number')
ylabel('log [\lambda]')
set(gca, 'FontSize', 18)
% plot distributions of reduced graphs
EVred = [laplacianSpectrumReducedGraphs1; laplacianSpectrumReducedGraphs2];
showDistributions(EVred, 2, eps, {'r', 'b'})
title('Reduced Graph Spectrum Distributions')