% 
% Two-Box Climate Model main program
%
% (c) A. Czaja, v.3 Feb. 2009.
% http://www.sp.ph.ic.ac.uk/~arnaud/EP_ClimateModel.html

%----------------------
% Initial conditions
%----------------------

  clear;
  RESTART =1,
  INPUTfile = 'Output_CTRLv3_50YR'; %name of input file if restart
  %INPUTfile = 'Output_2XCO2FromCTRLv3_Yr900_1000';
  %INPUTfile = 'movingup'; %name of input file if restart
  TwoBox_Init; %calls initialization routine

  % Time integration
  Nyr = 100; %length of integration (in years)
  Dt = 1*DAY; %Model time step (<=2 days otherwise unstable scheme)
  Nt = round(Nyr*YEAR/Dt);
  Time = [0:1:Nt-1]*Dt;
  
%-----------
% Forcing
%-----------

  Te1 = TEMI1;    %emission temperature for tropical Box
  Te2 = TEMI2;    %emission temperature for extra-tropical Box 
  TAU_CO2 = 5*YEAR; %timescale for CO2 emission
  CO2 = 2*280 * ones(1,Nt);    %Constant CO2 concentration (ppm)
  %CO2 = 280*( 2-exp(-Time/TAU_CO2) ); %doubling over a timescale TAU_CO2
  %figure(10), clf, plot(Time/YEAR,CO2); return
  WAVAFEEDBACK = 0, %if 1, water vapour feedback is on. It is off otherwise.
  
%------------------
%Time integration
%------------------

  PICTUREonline = 0, %if plot of on-going results is wanted
  TwoBox_Run; %Run Two-Box Model
  
%---------------
% Diagnostics
%---------------

  TwoBox_Diagnos; %run a few diagnostics
  
%----------------------
% Figures
%----------------------
  
  TwoBox_Plots; %plot model outputs

%--------------------
% Save Model output
%--------------------

  return; %to avoid rewriting on save files
  TwoBox_Save;
