Skip to content

Commit b57aedc

Browse files
author
Abhinab Bhattacharjee
committed
Added parallel run for each sample
1 parent 4fefc9d commit b57aedc

File tree

6 files changed

+580
-64
lines changed

6 files changed

+580
-64
lines changed

src/+datools/+examples/+sandu/runexperiments.m

Lines changed: 32 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ function runexperiments(user)
2424
% localization
2525
localize = user.localize;
2626

27+
% numberof samples for averaging runs
28+
numsamples = user.ns;
29+
2730
%% Remaining code%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2831
% rank histogram for the 1st state only (for now)
2932
histvar = 1:1:1;
@@ -62,21 +65,44 @@ function runexperiments(user)
6265
switch modelname
6366
case 'Lorenz63'
6467
natureODE = otp.lorenz63.presets.Canonical;
68+
nature0 = randn(natureODE.NumVars, 1); % natureODE.NumVars are the number of variables for the model
69+
natureODE.TimeSpan = [0, Dt];
70+
6571
modelODE = otp.lorenz63.presets.Canonical;
72+
modelODE.TimeSpan = [0, Dt];
73+
74+
% Propogate the model
75+
[tt, yy] = ode45(natureODE.RHS.F, [0, 10], nature0);
76+
natureODE.Y0 = yy(end, :).';
6677
case 'Lorenz96'
6778
natureODE = otp.lorenz96.presets.Canonical;
79+
nature0 = randn(natureODE.NumVars, 1); % natureODE.NumVars are the number of variables for the model
80+
natureODE.TimeSpan = [0, Dt];
81+
6882
modelODE = otp.lorenz96.presets.Canonical;
83+
modelODE.TimeSpan = [0, Dt];
84+
85+
% Propogate the model
86+
[tt, yy] = ode45(natureODE.RHS.F, [0, 10], nature0);
87+
natureODE.Y0 = yy(end, :).';
88+
case 'QG'
89+
natureODE = otp.qg.presets.Canonical('Size', [63, 127]);
90+
nature0 = natureODE.Y0;
91+
natureODE.TimeSpan = [0, Dt];
92+
93+
modelODE = otp.qg.presets.Canonical('Size', [63, 127]);
94+
modelODE.TimeSpan = [0, Dt];
6995
end
7096

71-
nature0 = randn(natureODE.NumVars, 1); % natureODE.NumVars are the number of variables for the model
72-
natureODE.TimeSpan = [0, Dt];
97+
% nature0 = randn(natureODE.NumVars, 1); % natureODE.NumVars are the number of variables for the model
98+
% natureODE.TimeSpan = [0, Dt];
7399

74100

75-
modelODE.TimeSpan = [0, Dt];
101+
%modelODE.TimeSpan = [0, Dt];
76102

77103
% Propogate the model
78-
[tt, yy] = ode45(natureODE.RHS.F, [0, 10], nature0);
79-
natureODE.Y0 = yy(end, :).';
104+
% [tt, yy] = ode45(natureODE.RHS.F, [0, 10], nature0);
105+
% natureODE.Y0 = yy(end, :).';
80106

81107
% initialize model
82108
model = datools.Model('Solver', solvermodel, 'ODEModel', modelODE);
@@ -142,7 +168,7 @@ function runexperiments(user)
142168
ensN = ensNs(ensNi);
143169
end
144170

145-
ns = 1;
171+
ns = numsamples;
146172
sE = zeros(ns, 1);
147173

148174
for sample = 1:ns

0 commit comments

Comments
 (0)