-
Notifications
You must be signed in to change notification settings - Fork 0
/
endtoend.m
55 lines (50 loc) · 1.5 KB
/
endtoend.m
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
%end to end *alpha version*
%model is now independent of number of zooplankton size classes
%mass balance
%HTL mortality transfer to NUM
%Allocation to growth changed in FEISTY
%fishing
%add path to feisty folder,
addpath('/Simple_run')
%choose parameters:
%[20 200 500 1000];%
mAdult=[0.2,2,20,200,1000,1250]; %logspace(log10(0.2),log10(1000),10); %set number of zooplankton groups and max sizes
L=100; %set light conditions
pudeep=50; %set deep nutrients
d=0.11; %set mixing rate
%in case there is a previous simulation
if ~exist('onceagain','var') || ~isstruct(onceagain)
onceagain=[];
end
[p,param]=parametersendtoend(mAdult,L,pudeep,d,onceagain);
%% warmup - here we can have the NUM model converged before the loop simulation begins
p.tEnd=1000; %days
%Run the NUM chemostat model, returns a structure named warmup
if ~isstruct(onceagain)
disp('warmup')
warmup=simulateChemostat(p, p.L);
else
warmup=[];
end
%% Setup and run the linked model
%setup Feisty parameters
p.InitEnd=1000; %____________________________________%%%%% Days
p.tEnd=1;
[sim,result,zoomort]=simulateendtoend(p,param,p.InitEnd,warmup);
disp('packing results')
tic
s=packresults(sim);
r=packresults(result);
toc
% disp('plotting')
% p.tEnd=p.InitEnd;
% s.p.tEnd=p.InitEnd;
%plotSimulation(s)
% plotPoemf(param, r)
% plotdiet(param,r)
%setup and loop once again, repeat as long as needed for steady state
onceagain.onceagainnum=s.u(end,:);
onceagain.onceagainfeisty=r.y(end,:);
%save 4zoo30L002d.mat onceagain
clear sim result r s
endtoend