% Last modified: 30/12/2012 by Pete

% truereac      true reaction equation of tracer in system [1,9]
% Re            Reynolds number
% randseed      rng seed for observation noise realization (set to -1 to
%               suppress addition of noise to observations)

function Pete_RunDet( truereac, Re, randseed )

app.toptic = tic ;
fprintf(['Stochastic microorganism tracer system: ',...
    'deterministic realization.\n'])

trunk = regexp(pwd,'.*trunk','match','once') ; Pete_src
app.tag = sprintf('tracer_truereac%d_Re%d_randseed%d', ...
    truereac, Re, randseed) ;
savemain = [trunk,'/Save/',app.tag] ;
addpath(genpath([trunk,'/Cases/Pete_tracer']))

% GENERAL SYSTEM PARAMETERS
app.truereac = ...     % rho evolution model
    truereac ;
app.nu = 1/Re ;         % viscosity (1/Re)
app.a = 12 ;            % domain size in x-direction
app.b = 6 ;             % domain size in y-direction
app.dx = 1/10 ;         % element size in x-direction
app.dy = 1/10 ;         % element size in y-direction
app.dt = 1/50 ;         % time step duration
app.T = 50 ;            % total simulation time
app.SaveIntrvl = ...    % number of time steps between each call of
    1.0/app.dt ;        % saving script
app.GenFig = 1 ;        % 1 = generate figures,
                        % 0 = do not generate figures

% OBSERVATION PARAMETERS
app.truenoise = 0.05 ;  % actual standard deviation of observation noise
app.modelnoise = 0.25 ; % modeled standard deviation of observation noise
app.EnKF = 1 ;          % 1 = use ensemble Kalman filter,
                        % 0 = use GMM-DO filter
app.ObsTimes = ...      % times at which to call observation script
    ( 21:1:app.T ) ;    % (rounded down to nearest saving times)
app.ObsLocs = ...       % spatial coordinates (x,y) at which to make
              ...       % observations
    [ app.a/2 - 1 , app.b/2 + 1 ;
      app.a/2 - 1 , app.b/2     ;
      app.a/2 - 1 , app.b/2 - 1 ;
      app.a/2     , app.b/2 + 1 ;
      app.a/2     , app.b/2     ;
      app.a/2     , app.b/2 - 1 ;
      app.a/2 + 1 , app.b/2 + 1 ;
      app.a/2 + 1 , app.b/2     ;
      app.a/2 + 1 , app.b/2 - 1 ] ;

% call deterministic solver
app.reac = truereac ;
if ( randseed < 0 )
    app.truenoise = 0 ;
else
    rng(randseed)
end
Pete_DetSolver( app ) ;

fprintf( 'Phew! Total time = %02d:%02d.\n', ...
    floor(toc(app.toptic)/3600), floor(mod(toc(app.toptic),3600)/60) )

