1 | %Test Name: SquareShelfSMBarma
|
---|
2 | md=triangle(model(),'../Exp/Square.exp',80000.);
|
---|
3 | md=setmask(md,'all','');
|
---|
4 | md=parameterize(md,'../Par/SquareShelfConstrained.par');
|
---|
5 | md=setflowequation(md,'SSA','all');
|
---|
6 | md.cluster=generic('name',oshostname(),'np',3);
|
---|
7 | md.transient.requested_outputs={'default','IceVolume','SmbMassBalance'};
|
---|
8 |
|
---|
9 | ymax = max(md.mesh.y);
|
---|
10 | xmax = max(md.mesh.x);
|
---|
11 | %Generate basin IDs for 3 basins
|
---|
12 | idbasin = zeros(md.mesh.numberofelements,1);
|
---|
13 | iid1 = find(md.mesh.y>=2/3*ymax);
|
---|
14 | iid2 = intersect(find(md.mesh.y<2/3*ymax),find(md.mesh.x>=1/3*xmax));
|
---|
15 | iid3 = intersect(find(md.mesh.y<2/3*ymax),find(md.mesh.x<1/3*xmax));
|
---|
16 | for ii=1:md.mesh.numberofelements
|
---|
17 | for vertex=1:3
|
---|
18 | if any(iid1==md.mesh.elements(ii,vertex)) %one vertex in basin 1
|
---|
19 | idbasin(ii) = 1;
|
---|
20 | end
|
---|
21 | end
|
---|
22 | if idbasin(ii)==0 %no vertex was found in basin 1
|
---|
23 | for vertex=1:3
|
---|
24 | if any(iid2==md.mesh.elements(ii,vertex)) %one vertex in basin 2
|
---|
25 | idbasin(ii) = 2;
|
---|
26 | end
|
---|
27 | end
|
---|
28 | end
|
---|
29 | if idbasin(ii)==0 %no vertex was found in basin 1 and 2
|
---|
30 | idbasin(ii) = 3;
|
---|
31 | end
|
---|
32 | end
|
---|
33 |
|
---|
34 | %SMB parameters
|
---|
35 | numparams = 2;
|
---|
36 | numbreaks = 1;
|
---|
37 | intercept = [0.5,1.0;1.0,0.6;,2.0,3.0]; %intercept values of SMB in basins [m ice eq./yr]
|
---|
38 | trendlin = [0.0,0.0;0.01,0.001;-0.01,0]; %trend values of SMB in basins [m ice eq./yr^2]
|
---|
39 | polynomialparams = cat(3,intercept,trendlin);
|
---|
40 | datebreaks = [3;3;3];
|
---|
41 |
|
---|
42 | md.timestepping.start_time = 0;
|
---|
43 | md.timestepping.time_step = 1/12;
|
---|
44 | md.timestepping.final_time = 2;
|
---|
45 | md.smb = SMBarma();
|
---|
46 | md.smb.num_basins = 3; %number of basins
|
---|
47 | md.smb.basin_id = idbasin; %prescribe basin ID number to elements
|
---|
48 | md.smb.num_params = numparams; %number of parameters in the polynomial
|
---|
49 | md.smb.num_breaks = numbreaks; %number of breakpoints
|
---|
50 | md.smb.polynomialparams = polynomialparams;
|
---|
51 | md.smb.datebreaks = datebreaks;
|
---|
52 | md.smb.ar_order = 4;
|
---|
53 | md.smb.ma_order = 1;
|
---|
54 | md.smb.arma_timestep = 2.0; %timestep of the ARMA model [yr]
|
---|
55 | md.smb.arlag_coefs = [[0.2,0.1,0.05,0.01];[0.4,0.2,-0.2,0.1];[0.4,-0.4,0.1,-0.1]];
|
---|
56 | md.smb.malag_coefs = [1.0;0;0.2];
|
---|
57 | lm0 = [1e-4*[1,-0.1,-1];1e-6*[1,-0.1,-1];1e-5*[1,-0.1,-1]];
|
---|
58 | lm1 = [1e-4*[2,-0.2,-2];1e-6*[2,-0.2,-2];1e-5*[2,-0.2,-2]];
|
---|
59 | lm2 = [1e-4*[3,-0.3,-3];1e-6*[3,-0.3,-3];1e-5*[3,-0.3,-3]];
|
---|
60 | lm3 = [1e-4*[4,-0.4,-4];1e-6*[4,-0.4,-4];1e-5*[4,-0.4,-4]];
|
---|
61 | lm4 = [1e-4*[5,-0.5,-5];1e-6*[5,-0.5,-5];1e-5*[5,-0.5,-5]];
|
---|
62 | lm5 = [1e-4*[6,-0.6,-6];1e-6*[6,-0.6,-6];1e-5*[6,-0.6,-6]];
|
---|
63 | lm6 = [1e-4*[7,-0.7,-7];1e-6*[7,-0.7,-7];1e-5*[7,-0.7,-7]];
|
---|
64 | lm7 = [1e-4*[8,-0.8,-8];1e-6*[8,-0.8,-8];1e-5*[8,-0.8,-8]];
|
---|
65 | lm8 = [1e-4*[9,-0.9,-9];1e-6*[9,-0.9,-9];1e-5*[9,-0.9,-9]];
|
---|
66 | lm9 = [1e-4*[10,-1,-10];1e-6*[10,-1.0,-10];1e-5*[10,-1.0,-10]];
|
---|
67 | lm10 = [1e-4*[11,-1.1,-11];1e-6*[11,-1.1,-11];1e-5*[11,-1.1,-11]];
|
---|
68 | lm11 = [1e-4*[12,-1.2,-12];1e-6*[12,-1.2,-12];1e-5*[12,-1.2,-12]];
|
---|
69 | md.smb.lapserates = cat(3,lm0,lm1,lm2,lm3,lm4,lm5,lm6,lm7,lm8,lm9,lm10,lm11);
|
---|
70 | md.smb.elevationbins = repmat([100,300;200,400;250,450],1,1,12);
|
---|
71 |
|
---|
72 | %Stochastic forcing
|
---|
73 | md.stochasticforcing.isstochasticforcing = 1;
|
---|
74 | md.stochasticforcing.fields = [{'SMBarma'}];
|
---|
75 | md.stochasticforcing.covariance = [[0.15 0.08 -0.02];[0.08 0.12 -0.05];[-0.02 -0.05 0.1]]; %global covariance among- and between-fields
|
---|
76 | md.stochasticforcing.randomflag = 0; %fixed random seeds
|
---|
77 | md.stochasticforcing.stochastictimestep = 1.0;
|
---|
78 |
|
---|
79 | md=solve(md,'Transient');
|
---|
80 |
|
---|
81 | %Fields and tolerances to track changes
|
---|
82 | field_names ={'Vx1','Vy1','Vel1','Thickness1','Volume1','SmbMassBalance1','Vx2','Vy2','Vel2','Thickness2','Volume2','SmbMassBalance2','Vx3','Vy3','Vel3','Thickness3','Volume3','SmbMassBalance3'};
|
---|
83 | field_tolerances={1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,...
|
---|
84 | 1e-13,1e-13,1e-13,1e-13,1e-13,1e-13...
|
---|
85 | 1e-12,1e-12,1e-12,1e-12,1e-12,1e-12};
|
---|
86 | field_values={...
|
---|
87 | (md.results.TransientSolution(1).Vx),...
|
---|
88 | (md.results.TransientSolution(1).Vy),...
|
---|
89 | (md.results.TransientSolution(1).Vel),...
|
---|
90 | (md.results.TransientSolution(1).Thickness),...
|
---|
91 | (md.results.TransientSolution(1).IceVolume),...
|
---|
92 | (md.results.TransientSolution(1).SmbMassBalance),...
|
---|
93 | (md.results.TransientSolution(12).Vx),...
|
---|
94 | (md.results.TransientSolution(12).Vy),...
|
---|
95 | (md.results.TransientSolution(12).Vel),...
|
---|
96 | (md.results.TransientSolution(12).Thickness),...
|
---|
97 | (md.results.TransientSolution(12).IceVolume),...
|
---|
98 | (md.results.TransientSolution(12).SmbMassBalance),...
|
---|
99 | (md.results.TransientSolution(24).Vx),...
|
---|
100 | (md.results.TransientSolution(24).Vy),...
|
---|
101 | (md.results.TransientSolution(24).Vel),...
|
---|
102 | (md.results.TransientSolution(24).Thickness),...
|
---|
103 | (md.results.TransientSolution(24).IceVolume),...
|
---|
104 | (md.results.TransientSolution(24).SmbMassBalance),...
|
---|
105 | };
|
---|