Commit b85b16f56d44db8556a5afd68216def089f3cc98

Authored by Jérémy Baudry
1 parent d6594dfd
Exists in master

clean for winter school

nml/bio_parameter.nml
... ... @@ -11,8 +11,20 @@
11 11 ! q0 : internal nutrient subsistence quota (for bio_model=2) [mol N/mol C]
12 12 ! mortality : mortality rate [s-1]
13 13 ! Kn : Half saturation constant [mol N/m3]
14   -! Vmax : maximum nutrient uptake rate [molP/molC/s-1]
15   -! Nutrient_0 : Initial Nutrient concentration [mol N/m3]
  14 +! Vmax : maximum nutrient uptake rate [molP/molC/s]
  15 +!
  16 +! nut_profile : initial nutrient profile
  17 +! 1: uniform in the watercolumn (mixed conditions)
  18 +! 2: two layers (stratified conditions)
  19 +!
  20 +! nut_layer : Depth of the bottom layer (for nut_profile=2) [m]
  21 +! Nutrient_0 : Initial Nutrient concentration (for nut_profile=1) [mol N/m3]
  22 +! Nutrient_1 : Initial nutrient concentration in the surface layer [mol N/m3]
  23 +! Nutrient_2 : Initial nutrient concentration in the bottom layer [mol N/m3]
  24 +! bottom_flux : Nutrient replenishment at the bottom [mol N/m3/s]
  25 +! nut_relax : Relax nutrient profile to initial profile
  26 +! 0: false
  27 +! 1: True
16 28 ! w_s : Plankton settling velocity [m/s]
17 29 ! part_management : algorithm management number particles
18 30 ! mu_r : Respiration rate constant [s-1]
... ... @@ -25,17 +37,23 @@
25 37  
26 38 bio_calc = 1
27 39 bio_model = 2
28   -mu_max = 2.3148e-5
29   -q0 = 5e-02
  40 +mu_max = 2.8935e-5
  41 +q0 = 0.05
30 42 mortality = 0
31   -Kn = 9.3870e-6
  43 +Kn = 2.14e-4
32 44 Vmax = 9.3870e-6
33   -Nutrient_0 = 5e-3
  45 +nut_profile = 1
  46 +nut_layer = 15
  47 +Nutrient_0 = 5e-4
  48 +Nutrient_1 = 1e-6
  49 +Nutrient_2 = 5e-3
  50 +bottom_flux = 0
  51 +nut_relax = 0
34 52 w_s = 0
35   -part_management = 1
  53 +part_management = 0
36 54 mu_r = 1.1574e-06
37 55 kw = 0
38   -q_max = 0.25
  56 +q_max = 0.5
39 57 m0 = 1e-12
40 58  
41 59 /
... ...
nml/model_parameter.nml
... ... @@ -32,17 +32,17 @@
32 32 !------------------------------------------------------------------------------------------
33 33  
34 34 &model_parameter_nml
35   -name_exp ='1depth200'
36   -depth = 200
  35 +name_exp ='exp3'
  36 +depth = 40
37 37 dz = 0.5
38 38 K_value = 1e-6
39 39 time_step = 60
40   -ndays = 2
41   -output_time = 2
  40 +ndays = 10
  41 +output_time = 10
42 42 mix_state = 1
43 43 particle_distribution = 2
44   -nbpart = 5000
45   -z_0 = 10
  44 +nbpart = 20000
  45 +z_0 = 5
46 46 day_length = 16
47 47 rad_max = 600
48 48 k_bg = 0.4
... ...
scripts_matlab/PHLAG.m 0 → 100644
... ... @@ -0,0 +1,710 @@
  1 +function PHLAG
  2 +evalin('base','clear all')
  3 +evalin('base','close all')
  4 +main_window=figure('Name','PHLAG','position',[40 40 894 435],'CloseRequestFcn',@my_closereq,'Numbertitle','off','menubar','none');
  5 +wallpaper=imshow('phyto.jpg','border','tight');
  6 +set(main_window,'color',[0 0 0])
  7 +
  8 +load_button= uicontrol('Style', 'pushbutton', 'String', 'load file',...
  9 + 'Position', [20 250 200 100],...
  10 + 'Callback', @loadfun,'BackgroundColor',[.2 .2 .2],...
  11 + 'ForegroundColor','w','fontsize',12);
  12 +
  13 +select_button= uicontrol('Style', 'pushbutton', 'String', 'Draw',...
  14 + 'Position', [20 120 200 100],...
  15 + 'Callback', @drawfun,'BackgroundColor',[.2 .2 .2],...
  16 + 'ForegroundColor','w','fontsize',12);
  17 +
  18 +txt_intro='Visualize PHLAG2014 outputs';
  19 +uicontrol('Style','text',...
  20 + 'Position',[250 200 500 100],...
  21 + 'String',txt_intro,'fontsize',30,'BackgroundColor',[0 0 0],'ForegroundColor','w');
  22 +
  23 +
  24 +
  25 + function my_closereq(source,event)
  26 + selection = questdlg('Are you sure you want to close?',...
  27 + 'Close Request Function',...
  28 + 'Yes','No','Yes');
  29 + switch selection,
  30 + case 'Yes',
  31 + delete(gcf)
  32 + evalin('base','clear all')
  33 + case 'No'
  34 + return
  35 + end
  36 + end
  37 +
  38 + function closebio(source,event)
  39 +
  40 +
  41 + ise = evalin( 'base', 'exist(''linebio'') == 1' );
  42 + if ise
  43 + evalin('base','clear linebio')
  44 + evalin('base','clear linebio2')
  45 + end
  46 + ise = evalin( 'base', 'exist(''linenut'') == 1' );
  47 + if ise
  48 + evalin('base','clear linenut')
  49 + evalin('base','clear linenut2')
  50 + end
  51 + delete(gcf)
  52 + end
  53 +
  54 + function loadfun(source,event)
  55 + evalin('base','clear all')
  56 + directory= uigetdir('.');
  57 + popup =msgbox('Importing files...');
  58 +
  59 +
  60 +
  61 + eulbio_path=[directory,'/EULER_BIOMASS.dat'];
  62 + eulbio=load(eulbio_path);
  63 + assignin('base', 'eulbio', eulbio)
  64 + lagbio_path=[directory,'/LAGRANGE_BIOMASS.dat'];
  65 + lagbio=load(lagbio_path);
  66 + assignin('base', 'lagbio', lagbio)
  67 +
  68 + eulnut_path=[directory,'/EULER_NUTRIENTS.dat'];
  69 + eulnut=load(eulnut_path);
  70 + assignin('base', 'eulnut', eulnut)
  71 + lagnut_path=[directory,'/LAGRANGE_NUTRIENTS.dat'];
  72 + lagnut=load(lagnut_path);
  73 + assignin('base', 'lagnut', lagnut)
  74 +
  75 +
  76 +
  77 + time_path=[directory,'/TIME.dat'];
  78 + time=load(time_path);
  79 + assignin('base', 'time', time)
  80 + depth_path=[directory,'/DEPTH.dat'];
  81 + depth=load(depth_path);
  82 + assignin('base', 'depth', depth)
  83 + eulQ_path=[directory,'/EULER_CELL_QUOTA.dat'];
  84 + eulQ=load(eulQ_path);
  85 + assignin('base', 'eulQ', eulQ)
  86 + lagQ_path=[directory,'/LAGRANGE_CELL_QUOTA.dat'];
  87 + lagQ=load(lagQ_path);
  88 + assignin('base', 'lagQ', lagQ)
  89 + Qdistrib_path=[directory,'/out.nc'];
  90 + Qdistrib=ncread(Qdistrib_path,'cell quota');
  91 + assignin('base', 'Qdistrib', Qdistrib)
  92 + diffusivity_path=[directory,'/DIFFUSIVITY.dat'];
  93 + diffusivity=load(diffusivity_path);
  94 + assignin('base', 'diffusivity', diffusivity)
  95 + light_path=[directory,'/LIGHT_PROFILE.dat'];
  96 + light=load(light_path);
  97 + assignin('base', 'light', light)
  98 + growtheul_path=[directory,'/EULER_GROWTHRATE.dat'];
  99 + eulgrowth=load(growtheul_path);
  100 + assignin('base', 'eulgrowth', eulgrowth)
  101 + growthlag_path=[directory,'/LAGRANGE_GROWTHRATE.dat'];
  102 + laggrowth=load(growthlag_path);
  103 + assignin('base', 'laggrowth', laggrowth)
  104 + growthdistrib_path=[directory,'/out.nc'];
  105 + growthdistrib=ncread(growthdistrib_path,'growth_rate');
  106 + assignin('base', 'growthdistrib', growthdistrib)
  107 + growthcat=ncread(Qdistrib_path,'growthcat');
  108 + assignin('base', 'growthcat', growthcat)
  109 + Qcat=ncread(Qdistrib_path,'Qcat');
  110 + assignin('base', 'Qcat', Qcat)
  111 +
  112 +
  113 + close(popup)
  114 + row1=['loaded directory: ',directory];
  115 + uicontrol('Style','text',...
  116 + 'Position',[250 160 500 20],...
  117 + 'String',char({row1}),'BackgroundColor',[.8 .8 .8]);
  118 +
  119 + end
  120 +
  121 + function drawfun(source,event)
  122 + eulbio=evalin('base','eulbio');
  123 + lagbio=evalin('base','lagbio');
  124 + eulnut=evalin('base','eulnut');
  125 + lagnut=evalin('base','lagnut');
  126 + time=evalin('base','time');
  127 + depth=evalin('base','depth');
  128 + eulgrowth=evalin('base','eulgrowth');
  129 + laggrowth=evalin('base','laggrowth');
  130 + eulQ=evalin('base','eulQ');
  131 + lagQ=evalin('base','lagQ');
  132 + cm=colormap('jet');
  133 + cm1(1,:)=[0 0 0];
  134 + for i=2:10
  135 + cm1(i,:)=[0 0.05*i 0.1*i];
  136 + end
  137 + cmap(1:10,:)=cm1;
  138 + cmap(11:59,:)=cm(16:end,:);
  139 + [s,v] = listdlg('PromptString','Type of selection',...
  140 + 'SelectionMode','single',...
  141 + 'ListString',char({'Biomass';'Growth rate';'Cell quota';'External nutrients';'Light';'Diffusivity'}));
  142 +
  143 + if s==1
  144 +
  145 + figbio=figure('Name','BIOMASS','position',[200 200 1100 550],'Numbertitle','off','menubar','none','CloseRequestFcn',@closebio);
  146 + set(figbio,'color',[0.2 0.2 0.2])
  147 + assignin('base','figbio',figbio)
  148 +
  149 +
  150 + biotot_button= uicontrol('Style', 'pushbutton', 'String', 'Total Biomass',...
  151 + 'Position', [20,250,200,40],...
  152 + 'Callback', @calc_biotot,'BackgroundColor',[.2 .2 .2],...
  153 + 'ForegroundColor','w','fontsize',12);
  154 +
  155 +
  156 + bio1=subplot(2,2,1);
  157 + pcolor(time,depth,lagbio')
  158 + shading interp
  159 + c1=colorbar;
  160 + xlabel('Time [Days]')
  161 + ylabel('Depth [m]')
  162 + title('LAGRANGIAN')
  163 + ax=gca;
  164 + ax.XAxis.Color='w';
  165 + ax.YAxis.Color='w';
  166 + set(ax,'yticklabel',flipud(get(ax,'yticklabel')))
  167 + set(c1,'color','w')
  168 + ylabel(c1,'Biomas [mol C/m^3]')
  169 + hold on
  170 + bio2=subplot(2,2,3);
  171 + pcolor(time,depth,eulbio')
  172 + shading interp
  173 + c2=colorbar;
  174 + colormap(cmap)
  175 + hold on
  176 +
  177 +
  178 + ylabel(c2,'Biomas [mol C/m^3]')
  179 + xlabel('Time [Days]')
  180 + ylabel('Depth [m]')
  181 + ax=gca;
  182 + ax.XAxis.Color='w';
  183 + ax.YAxis.Color='w';
  184 + set(c2,'color','w')
  185 + set(ax,'yticklabel',flipud(get(ax,'yticklabel')))
  186 + title('EULERIAN')
  187 + assignin('base', 'bio1', bio1)
  188 + assignin('base', 'bio2', bio2)
  189 +
  190 + uicontrol('Parent',figbio,'Style','slider','Position',[320,250,200,20],...
  191 + 'value',0.5, 'min',0, 'max',1,'callback',@colorscale);
  192 + uicontrol('Style','text',...
  193 + 'Position',[320,270,200,20],...
  194 + 'String','color scale','backgroundColor',get(figbio,'color'),'ForegroundColor','w');
  195 +
  196 + set(bio1,'units','pixel')
  197 + set(bio2,'units','pixel')
  198 +
  199 + set(bio2,'Position',[60 50 420 180])
  200 + set(bio1,'Position',[60 330 420 180])
  201 + set(bio1,'fontsize',12)
  202 + set(bio2,'fontsize',12)
  203 +
  204 + curs=datacursormode(figbio);
  205 + set(curs,'enable','on');
  206 + set(curs,'UpdateFcn', @plotbiomass )
  207 +
  208 +%
  209 + elseif s==4
  210 +
  211 +
  212 + fignut=figure('Name','Nutrients','position',[200 200 1100 550],'Numbertitle','off','menubar','none','CloseRequestFcn',@closebio);
  213 + set(fignut,'color',[0.2 0.2 0.2])
  214 + assignin('base','fignut',fignut)
  215 +
  216 +
  217 +
  218 + nut1=subplot(2,2,1);
  219 + pcolor(time,depth,lagnut')
  220 + shading interp
  221 + c1=colorbar;
  222 + ylabel(c1,'Nutrients [mol N/m^3]')
  223 + xlabel('Time [Days]')
  224 + ylabel('Depth [m]')
  225 + ax=gca;
  226 + ax.XAxis.Color='w';
  227 + ax.YAxis.Color='w';
  228 + set(c1,'color','w')
  229 + set(ax,'yticklabel',flipud(get(ax,'yticklabel')))
  230 + title('LAGRANGIAN')
  231 + hold on
  232 + nut2=subplot(2,2,3);
  233 + pcolor(time,depth,eulnut')
  234 + shading interp
  235 + c2=colorbar;
  236 + ylabel(c2,'Nutrients [mol N/m^3]')
  237 + colormap(cmap)
  238 + hold on
  239 + xlabel('Time [Days]')
  240 + ylabel('Depth [m]')
  241 + ax=gca;
  242 + ax.XAxis.Color='w';
  243 + ax.YAxis.Color='w';
  244 + set(c2,'color','w')
  245 + set(ax,'yticklabel',flipud(get(ax,'yticklabel')))
  246 + title('EULERIAN')
  247 + assignin('base', 'nut1', nut1)
  248 + assignin('base', 'nut2', nut2)
  249 +
  250 +
  251 + uicontrol('Parent',fignut,'Style','slider','Position',[320,250,200,20],...
  252 + 'value',0.5, 'min',0, 'max',1,'callback',@colorscalenut);
  253 + uicontrol('Style','text',...
  254 + 'Position',[320,270,200,20],...
  255 + 'String','color scale','backgroundColor',get(fignut,'color'),'ForegroundColor','w');
  256 +
  257 + set(nut1,'units','pixel')
  258 + set(nut2,'units','pixel')
  259 +
  260 + set(nut2,'Position',[60 50 420 180])
  261 + set(nut1,'Position',[60 330 420 180])
  262 + set(nut1,'fontsize',12)
  263 + set(nut2,'fontsize',12)
  264 +
  265 +
  266 + curs=datacursormode(fignut);
  267 + set(curs,'enable','on');
  268 + set(curs,'UpdateFcn', @plotnut )
  269 +
  270 +
  271 + elseif s==2
  272 + figgrowth=figure('Name','GROWTH RATE','position',[200 200 1100 550],'Numbertitle','off','menubar','none');
  273 + set(figgrowth,'color',[0.2 0.2 0.2])
  274 + assignin('base','figgrowth',figgrowth)
  275 +
  276 +
  277 +
  278 + growth1=subplot(2,2,1);
  279 + assignin('base','growth1',growth1)
  280 + pcolor(time,depth,laggrowth')
  281 + shading interp
  282 + c1=colorbar;
  283 +
  284 + ylabel(c1,'Growth rate [/s]')
  285 + xlabel('Time [Days]')
  286 + ylabel('Depth [m]')
  287 + ax=gca;
  288 + ax.XAxis.Color='w';
  289 + ax.YAxis.Color='w';
  290 + set(c1,'color','w')
  291 + set(ax,'yticklabel',flipud(get(ax,'yticklabel')))
  292 + title('LAGRANGIAN')
  293 + growth2=subplot(2,2,3);
  294 + pcolor(time,depth,eulgrowth')
  295 + shading interp
  296 + c2=colorbar;
  297 +
  298 + ylabel(c2,'Growth rate [/s]')
  299 + colormap(cmap)
  300 + xlabel('Time [Days]')
  301 + ylabel('Depth [m]')
  302 + ax=gca;
  303 + ax.XAxis.Color='w';
  304 + ax.YAxis.Color='w';
  305 + set(c2,'color','w')
  306 + title('EULERIAN')
  307 + set(ax,'yticklabel',flipud(get(ax,'yticklabel')))
  308 + assignin('base', 'growth1', growth1)
  309 + assignin('base', 'growth2', growth2)
  310 + uicontrol('Parent',figgrowth,'Style','slider','Position',[320,250,200,20],...
  311 + 'value',0.5, 'min',0, 'max',1,'callback',@colorscalegrowth);
  312 + uicontrol('Style','text',...
  313 + 'Position',[320,270,200,20],...
  314 + 'String','color scale','backgroundColor',get(figgrowth,'color'),'ForegroundColor','w');
  315 +
  316 + set(growth1,'units','pixel')
  317 + set(growth2,'units','pixel')
  318 +
  319 + set(growth2,'Position',[60 50 420 180])
  320 + set(growth1,'Position',[60 330 420 180])
  321 + set(growth1,'fontsize',12)
  322 + set(growth2,'fontsize',12)
  323 +
  324 +
  325 +
  326 + curs=datacursormode(figgrowth);
  327 + set(curs,'enable','on');
  328 + set(curs,'UpdateFcn', @plotgrowthdistrib )
  329 + elseif s==3
  330 +
  331 +
  332 + figQ=figure('Name','NUTRIENT CELL QUOTA','position',[200 200 1100 550],'Numbertitle','off','menubar','none');
  333 + set(figQ,'color',[0.2 0.2 0.2])
  334 + assignin('base','figQ',figQ)
  335 +
  336 +
  337 +
  338 + Q1=subplot(2,2,1);
  339 + assignin('base','Q1',Q1)
  340 + pcolor(time,depth,lagQ')
  341 + shading interp
  342 + c1=colorbar;
  343 + xlabel('Time [Days]')
  344 + ylabel('Depth [m]')
  345 +
  346 + ax=gca;
  347 + ax.XAxis.Color='w';
  348 + ax.YAxis.Color='w';
  349 + set(c1,'color','w')
  350 + title('LAGRANGIAN')
  351 +
  352 + ylabel(c1,'Cell quota [mol N/mol C]')
  353 + Q2=subplot(2,2,3);
  354 + pcolor(time,depth,eulQ')
  355 + shading interp
  356 + c2=colorbar;
  357 + set(c2,'color','w')
  358 + ylabel(c2,'Cell quota [mol N/mol C]')
  359 + colormap(cmap)
  360 + xlabel('Time [Days]')
  361 + ylabel('Depth [m]')
  362 + ax=gca;
  363 + ax.XAxis.Color='w';
  364 + ax.YAxis.Color='w';
  365 + assignin('base', 'Q1', Q1)
  366 + assignin('base', 'Q2', Q2)
  367 + title('EULERIAN')
  368 + uicontrol('Parent',figQ,'Style','slider','Position',[320,250,200,20],...
  369 + 'value',0.5, 'min',0, 'max',1,'callback',@colorscaleQ);
  370 + uicontrol('Style','text',...
  371 + 'Position',[320,270,200,20],...
  372 + 'String','color scale','backgroundColor',get(figQ,'color'),'ForegroundColor','w');
  373 +
  374 + set(Q1,'units','pixel')
  375 + set(Q2,'units','pixel')
  376 +
  377 + set(Q2,'Position',[60 50 420 180])
  378 + set(Q1,'Position',[60 330 420 180])
  379 + set(Q1,'fontsize',12)
  380 + set(Q2,'fontsize',12)
  381 +
  382 + curs=datacursormode(figQ);
  383 + set(curs,'enable','on');
  384 + set(curs,'UpdateFcn', @plotQdistrib )
  385 +
  386 + elseif s==5
  387 + light=evalin('base','light');
  388 + figlight=figure('Name','INCIDENT LIGHT','position',[200 200 800 300],'Numbertitle','off','menubar','none');
  389 + set(figlight,'color',[0.2 0.2 0.2])
  390 + assignin('base','figlight',figlight)
  391 + plot(time(2:end),light,'linewidth',1.5,'color','y')
  392 + xlabel('Time [Days]')
  393 + ylabel('Incident light')
  394 + set(gca,'color','none')
  395 + ax=gca;
  396 + ax.XAxis.Color='w';
  397 + ax.YAxis.Color='w';
  398 + grid on
  399 +
  400 + elseif s==6
  401 + diffusivity=evalin('base','diffusivity');
  402 + figdif=figure('Name','DIFFUSIVITY','position',[200 200 800 350],'Numbertitle','off','menubar','none');
  403 +
  404 + assignin('base','figdif',figdif)
  405 + pcolor(time,depth,diffusivity(:,1:end-1)')
  406 + shading interp
  407 + colorbar
  408 + colormap(cmap)
  409 + xlabel('Time [Days]')
  410 + ylabel('Depth [m]')
  411 + set(gca,'color','none')
  412 + ax=gca;
  413 + ax.XAxis.Color='w';
  414 + ax.YAxis.Color='w';
  415 +
  416 +
  417 + end
  418 +
  419 +
  420 + end
  421 +
  422 + function colorscale(source,event)
  423 + bio1=evalin('base','bio1');
  424 + bio2= evalin( 'base','bio2');
  425 + up=get(source,'value');
  426 + current_cax=caxis(bio1);
  427 + caxis(bio1,[0 up])
  428 + caxis(bio2,[0 up])
  429 +
  430 +
  431 + end
  432 + function colorscaleQ(source,event)
  433 + Q1=evalin('base','Q1');
  434 + Q2= evalin( 'base','Q2');
  435 + up=get(source,'value');
  436 + current_cax=caxis(Q1);
  437 + caxis(Q1,[0 up])
  438 + caxis(Q2,[0 up])
  439 +
  440 +
  441 + end
  442 + function colorscalegrowth(source,event)
  443 + growth1=evalin('base','growth1');
  444 + growth2= evalin( 'base','growth2');
  445 + up=get(source,'value');
  446 + current_cax=caxis(growth1);
  447 + caxis(growth1,[0 up])
  448 + caxis(growth2,[0 up])
  449 +
  450 +
  451 + end
  452 + function colorscalenut(source,event)
  453 + nut1=evalin('base','nut1');
  454 + nut2= evalin( 'base','nut2');
  455 + up=get(source,'value');
  456 + current_cax=caxis(nut1);
  457 + caxis(nut1,[0 up])
  458 + caxis(nut2,[0 up])
  459 +
  460 +
  461 + end
  462 +
  463 +
  464 +
  465 +
  466 + function calc_biotot(source,event)
  467 + figbiotot=figure('Name',' TOTAL BIOMASS','position',[200 200 500 500],'Numbertitle','off','menubar','none');
  468 + set(figbiotot,'color',[0.2 0.2 0.2])
  469 + eulbio=evalin('base','eulbio');
  470 + lagbio=evalin('base','lagbio');
  471 + depth=evalin('base','depth');
  472 + time=evalin('base','time');
  473 + dz=diff(depth);
  474 + dz=dz(1);
  475 + biototeul=sum(eulbio,2)*dz;
  476 + biototlag=sum(lagbio,2)*dz;
  477 + plot(time,biototlag,'color','r','linewidth',1.5)
  478 + hold on
  479 + plot(time,biototeul,'linewidth',1.5,'color','b')
  480 + hold off
  481 + ylabel('total biomass [mol]')
  482 + xlabel('Time [Days]')
  483 + l=legend('LAGRANGIAN','EULERIAN');
  484 + set(l,'box','off')
  485 + set(gca,'color','none')
  486 + ax=gca;
  487 + ax.XAxis.Color='w';
  488 + ax.YAxis.Color='w';
  489 +
  490 + grid on
  491 +
  492 + end
  493 +
  494 +
  495 + function txt = plotQdistrib(source,event)
  496 +
  497 + Q1=evalin('base','Q1');
  498 + figQ=evalin('base','figQ');
  499 + set(figQ,'color',[0.2 0.2 0.2])
  500 + Qdistrib=evalin('base','Qdistrib');
  501 + time=evalin('base','time');
  502 + depth=evalin('base','depth');
  503 + Qcat=evalin('base','Qcat');
  504 + eulQ=evalin('base','eulQ');
  505 + lagQ=evalin('base','lagQ');
  506 + posQ = get(event,'Position');
  507 +
  508 + txt = {['Time: ',num2str(posQ(1))],...
  509 + ['Depth: ',num2str(posQ(2))]};
  510 +
  511 + if (gca==Q1)
  512 + Q3= subplot(2,2,[2 4]) ;
  513 + set(gca,'color','none')
  514 + ax=gca;
  515 + ax.XAxis.Color='w';
  516 + ax.YAxis.Color='w';
  517 + set(Q3,'units','pixel')
  518 + set(Q3,'fontsize',12)
  519 + set(Q3,'Position',[680 50 400 480])
  520 +
  521 + [~,posQx]=min(abs(time-posQ(1)));
  522 + [~,posQy]=min(abs(depth-posQ(2)));
  523 + areaQ=area(Qcat,Qdistrib(round(posQy),:,round(posQx)));
  524 + alpha 0.5
  525 + set(areaQ,'edgecolor','none')
  526 + hold on
  527 + plot([eulQ(posQx,posQy) eulQ(posQx,posQy)],ylim,'linewidth',2,'color','b')
  528 + plot([lagQ(posQx,posQy) lagQ(posQx,posQy)],ylim,'linewidth',2,'color','r')
  529 +
  530 + set(areaQ,'Facecolor','g')
  531 +
  532 +
  533 + xlabel('Cell quota [mol N/mol C]')
  534 + ylabel('Density [m]')
  535 + l=legend('Distribution of cell quota','Eulerian','mean Lagrangian');
  536 + set(l,'box','off')
  537 + ax=gca;
  538 + set(gca,'color','none')
  539 + ax.XAxis.Color='w';
  540 + ax.YAxis.Color='w';
  541 + grid on
  542 +
  543 + end
  544 +
  545 + end
  546 +
  547 + function txt = plotgrowthdistrib(source,event)
  548 +
  549 + growth1=evalin('base','growth1');
  550 + figgrowth=evalin('base','figgrowth');
  551 + set(figgrowth,'color',[0.2 0.2 0.2])
  552 + growthdistrib=evalin('base','growthdistrib');
  553 + time=evalin('base','time');
  554 + depth=evalin('base','depth');
  555 + growthcat=evalin('base','growthcat');
  556 + eulgrowth=evalin('base','eulgrowth');
  557 + laggrowth=evalin('base','laggrowth');
  558 + posgrowth = get(event,'Position');
  559 + txt = {['Time: ',num2str(posgrowth(1))],...
  560 + ['Depth: ',num2str(posgrowth(2))]};
  561 +
  562 + if (gca==growth1)
  563 + growth3= subplot(2,2,2) ;
  564 + set(growth3,'units','pixel')
  565 + set(growth3,'fontsize',12)
  566 + set(growth3,'Position',[680 50 400 480])
  567 +
  568 + [~,posgrowthx]=min(abs(time-posgrowth(1)));
  569 + [~,posgrowthy]=min(abs(depth-posgrowth(2)));
  570 + areagrowth=area(growthcat,growthdistrib(round(posgrowthy),:,round(posgrowthx)));
  571 + alpha 0.5
  572 + set(areagrowth,'edgecolor','none')
  573 + hold on
  574 +
  575 + plot([eulgrowth(posgrowthx,posgrowthy) eulgrowth(posgrowthx,posgrowthy)],ylim,'linewidth',2,'color','b')
  576 + plot([laggrowth(posgrowthx,posgrowthy) laggrowth(posgrowthx,posgrowthy)],ylim,'linewidth',2,'color','r')
  577 + set(areagrowth,'Facecolor','g')
  578 +
  579 + l=legend('Distribution of cell quota','Eulerian','mean Lagrangian');
  580 + set(l,'box','off')
  581 + xlabel('Growth rate [/s]')
  582 + ylabel('Density [m]')
  583 + ax=gca;
  584 + set(gca,'color','none')
  585 + ax.XAxis.Color='w';
  586 + ax.YAxis.Color='w';
  587 + grid on
  588 +
  589 + end
  590 +
  591 + end
  592 + function txt = plotbiomass(source,event)
  593 +
  594 + bio1=evalin('base','bio1');
  595 + bio2=evalin('base','bio2');
  596 + figbio=evalin('base','figbio');
  597 + set(figbio,'color',[0.2 0.2 0.2])
  598 + time=evalin('base','time');
  599 + depth=evalin('base','depth');
  600 + eulbio=evalin('base','eulbio');
  601 + lagbio=evalin('base','lagbio');
  602 + posbio = get(event,'Position');
  603 + txt = {['Time: ',num2str(posbio(1))]};
  604 +
  605 + if (gca==bio1 || gca==bio2)
  606 +% %
  607 + ise = evalin( 'base', 'exist(''linebio'') == 1' );
  608 +
  609 + if ise
  610 +
  611 + evalin('base', 'set(linebio,''visible'',''off'')')
  612 + evalin('base', 'set(linebio2,''visible'',''off'')')
  613 + end
  614 +
  615 +
  616 + bio3= subplot(2,2,2) ;
  617 + set(bio3,'units','pixel')
  618 + set(bio3,'fontsize',12)
  619 + set(bio3,'Position',[680 50 400 480])
  620 + [~,posbiox]=min(abs(time-posbio(1)));
  621 + plot(eulbio(posbiox,:),depth,'linewidth',1.5)
  622 + hold on
  623 + plot(lagbio(posbiox,:),depth,'linewidth',1.5,'color','r')
  624 + xlim([0 max(max(lagbio))])
  625 +
  626 + l=legend('Eulerian','Lagrangian');
  627 + set(l,'box','off')
  628 + xlabel('Biomass [mol C/m^3]')
  629 + ylabel('Depth [m]')
  630 + set(gca,'color','none')
  631 + ax=gca;
  632 + ax.XAxis.Color='w';
  633 + ax.YAxis.Color='w';
  634 + set(ax,'yticklabel',flipud(get(ax,'yticklabel')))
  635 + grid on
  636 +
  637 + linebio=plot(bio1,[posbio(1) posbio(1)],ylim(bio1),'linewidth',1.5,'color',[0.2 0.2 0.6]);
  638 + linebio2=plot(bio2,[posbio(1) posbio(1)],ylim(bio2),'linewidth',1.5,'color',[0.2 0.2 0.6]);
  639 + assignin('base','linebio',linebio)
  640 + assignin('base','linebio2',linebio2)
  641 +
  642 + end
  643 +
  644 + end
  645 + function txt = plotnut(source,event)
  646 +
  647 + nut1=evalin('base','nut1');
  648 + nut2=evalin('base','nut2');
  649 + fignut=evalin('base','fignut');
  650 + time=evalin('base','time');
  651 + depth=evalin('base','depth');
  652 + eulnut=evalin('base','eulnut');
  653 + lagnut=evalin('base','lagnut');
  654 + posnut = get(event,'Position');
  655 + txt = {['Time: ',num2str(posnut(1))]};
  656 +
  657 + if (gca==nut1 || gca==nut2)
  658 +% %
  659 + ise = evalin( 'base', 'exist(''linenut'') == 1' );
  660 +
  661 + if ise
  662 +
  663 + evalin('base', 'set(linenut,''visible'',''off'')')
  664 + evalin('base', 'set(linenut2,''visible'',''off'')')
  665 + end
  666 +
  667 +
  668 + nut3= subplot(2,2,2) ;
  669 + set(nut3,'units','pixel')
  670 + set(nut3,'fontsize',12)
  671 + set(nut3,'Position',[680 50 400 480])
  672 + [~,posnutx]=min(abs(time-posnut(1)));
  673 + plot(eulnut(posnutx,:),depth,'linewidth',1.5)
  674 + hold on
  675 + plot(lagnut(posnutx,:),depth,'linewidth',1.5,'color','r')
  676 + xlim([0 max(max(lagnut))])
  677 +
  678 + l=legend('Eulerian','Lagrangian');
  679 + set(l,'box','off')
  680 + xlabel('Nutrients [mol N/m^3]')
  681 + ylabel('Depth [m]')
  682 + ax=gca;
  683 + ax.XAxis.Color='w';
  684 + ax.YAxis.Color='w';
  685 + set(ax,'yticklabel',flipud(get(ax,'yticklabel')))
  686 +
  687 + grid on
  688 +
  689 + linenut=plot(nut1,[posnut(1) posnut(1)],ylim(nut1),'linewidth',1.5,'color',[0.2 0.2 0.6]);
  690 + linenut2=plot(nut2,[posnut(1) posnut(1)],ylim(nut2),'linewidth',1.5,'color',[0.2 0.2 0.6]);
  691 + assignin('base','linenut',linenut)
  692 + assignin('base','linenut2',linenut2)
  693 + set(gca,'color','none')
  694 +
  695 + end
  696 +
  697 + end
  698 +
  699 +
  700 +end
  701 +
  702 +
  703 +
  704 +
  705 +
  706 +
  707 +
  708 +
  709 +
  710 +
... ...
scripts_matlab/phyto.jpg 0 → 100644