% build the random field model for the coefficients for the sisc galerkin
% paper

%% clean up
close all; clear all;
load ntw_mesh

%%
c=[1 1]; sigma=1;
cv = @(x1,x2) gp_exp_cov(x1,x2,c,sigma);
mesh = p';

%%
[F,KL] = randomfield(cv, mesh, 'trunc', 100);
        

%%
save('sisc_kl.mat','KL');

%% some plots of the field
trunc=6;
W=4*rand(trunc,10)-2;
F2=KL.mean*ones(1,10)+KL.bases(:,1:trunc)*diag(KL.sv(1:trunc))*W;

for i=1:10
    figure;
    pdesurf(p,t,exp(F2(:,i)));
    
end
